Skip to content

resizing an image that is not at its natural size originally #69

@kevin-rowe

Description

@kevin-rowe

After a few tweaks, this script works perfectly.

I have made some changes to my copy of the code to allow an image that is not displayed at natural dimensions to have its map resized.

        var scalingFactor = {
            //                width  : image.width  / image.naturalWidth,
            //                height : image.height / image.naturalHeight
            width: window.innerWidth / origwindowwidth,
            height: window.innerHeight / origwindowheight
        };

...
var
/*jshint validthis:true */
map = this,
areas = null, cachedAreaCoordsArray = null, image = null, timer = null,
origwindowwidth = window.innerWidth,
origwindowheight = window.innerHeight;

This works for me.
You could probably refine this to work individual images with origimageheight as a variable in the map and use the image.height on startup if you had multiple maps that could be independently resized.

Thought I'd share.

Kevin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions