Issue #41 was similar and got closed but I could not find a solution yet, although the closing comment states a PR had a fix.
I understand the script expects the image to be at the image map's size. If that's not the case the scale calculated factor is wrong. I accept to loose some automation and I added data attributes to the image map that give the original size.
// Image Map in HTML with data attributes
<map name="map-name" data-map-width="950" data-map-height="690">
// var scalingFactor
width : image.width / mapOriginalWidth,
height : image.height / mapOriginalHeight
// function setup
mapOriginalHeight = map.getAttribute("data-map-height");
mapOriginalWidth = map.getAttribute("data-map-width");
// var
mapOriginalHeight = null,
mapOriginalWidth = null;
Issue #41 was similar and got closed but I could not find a solution yet, although the closing comment states a PR had a fix.
I understand the script expects the image to be at the image map's size. If that's not the case the scale calculated factor is wrong. I accept to loose some automation and I added data attributes to the image map that give the original size.