Skip to content

Commit

Permalink
Release v1.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
techfg committed Dec 22, 2024
1 parent 7604585 commit 99be87b
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 40 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ImageMapster",
"version": "1.8.0",
"version": "1.8.1",
"homepage": "https://jamietre.github.io/ImageMapster",
"description": "jQuery plugin that activates areas in HTML image maps with support for highlighting, selecting, tooltips, resizing and more",
"main": "dist/jquery.imagemapster.min.js",
Expand Down
26 changes: 17 additions & 9 deletions dist/jquery.imagemapster.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* imagemapster - v1.8.0 - 2024-05-01
* imagemapster - v1.8.1 - 2024-12-21
* https://jamietre.github.io/ImageMapster
* Copyright (c) 2011 - 2024 James Treworgy
* License: MIT
Expand Down Expand Up @@ -222,7 +222,7 @@
(function ($) {
'use strict';

var mapster_version = '1.8.0';
var mapster_version = '1.8.1';

// all public functions in $.mapster.impl are methods
$.fn.mapster = function (method) {
Expand Down Expand Up @@ -282,6 +282,7 @@
configTimeout: 30000,
noHrefIsMask: true,
scaleMap: true,
scaleMapBounds: { below: 0.98, above: 1.02 },
enableAutoResizeSupport: false, // TODO: Remove in next major release
autoResize: false,
autoResizeDelay: 0,
Expand Down Expand Up @@ -2935,7 +2936,8 @@
me.scaleInfo = scale = u.scaleMap(
me.images[0],
me.images[1],
opts.scaleMap
opts.scaleMap,
opts.scaleMapBounds
);

me.base_canvas = base_canvas = me.graphics.createVisibleCanvas(me);
Expand Down Expand Up @@ -3815,15 +3817,19 @@
u = m.utils,
p = m.MapArea.prototype;

m.utils.getScaleInfo = function (eff, actual) {
m.utils.getScaleInfo = function (eff, actual, scaleMapBounds) {
var pct;
if (!actual) {
pct = 1;
actual = eff;
} else {
pct = eff.width / actual.width || eff.height / actual.height;
// make sure a float error doesn't muck us up
if (pct > 0.98 && pct < 1.02) {
if (
scaleMapBounds &&
pct > scaleMapBounds.below &&
pct < scaleMapBounds.above
) {
pct = 1;
}
}
Expand All @@ -3838,7 +3844,7 @@
};
};
// Scale a set of AREAs, return old data as an array of objects
m.utils.scaleMap = function (image, imageRaw, scale) {
m.utils.scaleMap = function (image, imageRaw, scale, scaleMapBounds) {
// stunningly, jQuery width can return zero even as width does not, seems to happen only
// with adBlock or maybe other plugins. These must interfere with onload events somehow.

Expand All @@ -3851,7 +3857,7 @@
if (!vis.complete()) {
vis = raw;
}
return this.getScaleInfo(vis, scale ? raw : null);
return this.getScaleInfo(vis, scale ? raw : null, scaleMapBounds);
};

/**
Expand All @@ -3875,6 +3881,7 @@

// allow omitting duration
callback = callback || duration;
duration = u.isNumeric(duration) ? duration : 0;

function sizeCanvas(canvas, w, h) {
if (m.hasCanvas()) {
Expand Down Expand Up @@ -3926,7 +3933,8 @@
{
width: me.scaleInfo.realWidth,
height: me.scaleInfo.realHeight
}
},
me.options.scaleMapBounds
);
$.each(me.data, function (_, e) {
$.each(e.areas(), function (_, e) {
Expand Down Expand Up @@ -3999,7 +4007,7 @@
/*
When autoresize is enabled, we obtain the width of the wrapper element and resize to that, however when we're hidden because of
one of our ancenstors, jQuery width function returns 0. Ideally, we could use ResizeObserver/MutationObserver to detect
when we hide/show and resize on that event instead of resizing while we are not visible but until official support of older
when we hide/show and resize on that event instead of resizing while we are not visible but until official support of older
browsers is dropped, we need to go this route.
*/
me.resize(
Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.imagemapster.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/jquery.imagemapster.min.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/jquery.imagemapster.min.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/jquery.imagemapster.min.mjs.map

Large diffs are not rendered by default.

26 changes: 17 additions & 9 deletions dist/jquery.imagemapster.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* imagemapster - v1.8.0 - 2024-05-01
* imagemapster - v1.8.1 - 2024-12-21
* https://jamietre.github.io/ImageMapster
* Copyright (c) 2011 - 2024 James Treworgy
* License: MIT
Expand Down Expand Up @@ -198,7 +198,7 @@ function imagemapsterFactory(jQuery) {
(function ($) {
'use strict';

var mapster_version = '1.8.0';
var mapster_version = '1.8.1';

// all public functions in $.mapster.impl are methods
$.fn.mapster = function (method) {
Expand Down Expand Up @@ -258,6 +258,7 @@ function imagemapsterFactory(jQuery) {
configTimeout: 30000,
noHrefIsMask: true,
scaleMap: true,
scaleMapBounds: { below: 0.98, above: 1.02 },
enableAutoResizeSupport: false, // TODO: Remove in next major release
autoResize: false,
autoResizeDelay: 0,
Expand Down Expand Up @@ -2911,7 +2912,8 @@ function imagemapsterFactory(jQuery) {
me.scaleInfo = scale = u.scaleMap(
me.images[0],
me.images[1],
opts.scaleMap
opts.scaleMap,
opts.scaleMapBounds
);

me.base_canvas = base_canvas = me.graphics.createVisibleCanvas(me);
Expand Down Expand Up @@ -3791,15 +3793,19 @@ function imagemapsterFactory(jQuery) {
u = m.utils,
p = m.MapArea.prototype;

m.utils.getScaleInfo = function (eff, actual) {
m.utils.getScaleInfo = function (eff, actual, scaleMapBounds) {
var pct;
if (!actual) {
pct = 1;
actual = eff;
} else {
pct = eff.width / actual.width || eff.height / actual.height;
// make sure a float error doesn't muck us up
if (pct > 0.98 && pct < 1.02) {
if (
scaleMapBounds &&
pct > scaleMapBounds.below &&
pct < scaleMapBounds.above
) {
pct = 1;
}
}
Expand All @@ -3814,7 +3820,7 @@ function imagemapsterFactory(jQuery) {
};
};
// Scale a set of AREAs, return old data as an array of objects
m.utils.scaleMap = function (image, imageRaw, scale) {
m.utils.scaleMap = function (image, imageRaw, scale, scaleMapBounds) {
// stunningly, jQuery width can return zero even as width does not, seems to happen only
// with adBlock or maybe other plugins. These must interfere with onload events somehow.

Expand All @@ -3827,7 +3833,7 @@ function imagemapsterFactory(jQuery) {
if (!vis.complete()) {
vis = raw;
}
return this.getScaleInfo(vis, scale ? raw : null);
return this.getScaleInfo(vis, scale ? raw : null, scaleMapBounds);
};

/**
Expand All @@ -3851,6 +3857,7 @@ function imagemapsterFactory(jQuery) {

// allow omitting duration
callback = callback || duration;
duration = u.isNumeric(duration) ? duration : 0;

function sizeCanvas(canvas, w, h) {
if (m.hasCanvas()) {
Expand Down Expand Up @@ -3902,7 +3909,8 @@ function imagemapsterFactory(jQuery) {
{
width: me.scaleInfo.realWidth,
height: me.scaleInfo.realHeight
}
},
me.options.scaleMapBounds
);
$.each(me.data, function (_, e) {
$.each(e.areas(), function (_, e) {
Expand Down Expand Up @@ -3975,7 +3983,7 @@ function imagemapsterFactory(jQuery) {
/*
When autoresize is enabled, we obtain the width of the wrapper element and resize to that, however when we're hidden because of
one of our ancenstors, jQuery width function returns 0. Ideally, we could use ResizeObserver/MutationObserver to detect
when we hide/show and resize on that event instead of resizing while we are not visible but until official support of older
when we hide/show and resize on that event instead of resizing while we are not visible but until official support of older
browsers is dropped, we need to go this route.
*/
me.resize(
Expand Down
26 changes: 17 additions & 9 deletions dist/jquery.imagemapster.zepto.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* imagemapster - v1.8.0 - 2024-05-01
* imagemapster - v1.8.1 - 2024-12-21
* https://jamietre.github.io/ImageMapster
* Copyright (c) 2011 - 2024 James Treworgy
* License: MIT
Expand Down Expand Up @@ -289,7 +289,7 @@
(function ($) {
'use strict';

var mapster_version = '1.8.0';
var mapster_version = '1.8.1';

// all public functions in $.mapster.impl are methods
$.fn.mapster = function (method) {
Expand Down Expand Up @@ -349,6 +349,7 @@
configTimeout: 30000,
noHrefIsMask: true,
scaleMap: true,
scaleMapBounds: { below: 0.98, above: 1.02 },
enableAutoResizeSupport: false, // TODO: Remove in next major release
autoResize: false,
autoResizeDelay: 0,
Expand Down Expand Up @@ -3002,7 +3003,8 @@
me.scaleInfo = scale = u.scaleMap(
me.images[0],
me.images[1],
opts.scaleMap
opts.scaleMap,
opts.scaleMapBounds
);

me.base_canvas = base_canvas = me.graphics.createVisibleCanvas(me);
Expand Down Expand Up @@ -3882,15 +3884,19 @@
u = m.utils,
p = m.MapArea.prototype;

m.utils.getScaleInfo = function (eff, actual) {
m.utils.getScaleInfo = function (eff, actual, scaleMapBounds) {
var pct;
if (!actual) {
pct = 1;
actual = eff;
} else {
pct = eff.width / actual.width || eff.height / actual.height;
// make sure a float error doesn't muck us up
if (pct > 0.98 && pct < 1.02) {
if (
scaleMapBounds &&
pct > scaleMapBounds.below &&
pct < scaleMapBounds.above
) {
pct = 1;
}
}
Expand All @@ -3905,7 +3911,7 @@
};
};
// Scale a set of AREAs, return old data as an array of objects
m.utils.scaleMap = function (image, imageRaw, scale) {
m.utils.scaleMap = function (image, imageRaw, scale, scaleMapBounds) {
// stunningly, jQuery width can return zero even as width does not, seems to happen only
// with adBlock or maybe other plugins. These must interfere with onload events somehow.

Expand All @@ -3918,7 +3924,7 @@
if (!vis.complete()) {
vis = raw;
}
return this.getScaleInfo(vis, scale ? raw : null);
return this.getScaleInfo(vis, scale ? raw : null, scaleMapBounds);
};

/**
Expand All @@ -3942,6 +3948,7 @@

// allow omitting duration
callback = callback || duration;
duration = u.isNumeric(duration) ? duration : 0;

function sizeCanvas(canvas, w, h) {
if (m.hasCanvas()) {
Expand Down Expand Up @@ -3993,7 +4000,8 @@
{
width: me.scaleInfo.realWidth,
height: me.scaleInfo.realHeight
}
},
me.options.scaleMapBounds
);
$.each(me.data, function (_, e) {
$.each(e.areas(), function (_, e) {
Expand Down Expand Up @@ -4066,7 +4074,7 @@
/*
When autoresize is enabled, we obtain the width of the wrapper element and resize to that, however when we're hidden because of
one of our ancenstors, jQuery width function returns 0. Ideally, we could use ResizeObserver/MutationObserver to detect
when we hide/show and resize on that event instead of resizing while we are not visible but until official support of older
when we hide/show and resize on that event instead of resizing while we are not visible but until official support of older
browsers is dropped, we need to go this route.
*/
me.resize(
Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.imagemapster.zepto.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/jquery.imagemapster.zepto.min.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "imagemapster",
"version": "1.8.0",
"version": "1.8.1",
"description": "jQuery plugin that activates areas in HTML image maps with support for highlighting, selecting, tooltips, resizing and more",
"main": "dist/jquery.imagemapster.min.js",
"module": "dist/jquery.imagemapster.min.mjs",
Expand Down

0 comments on commit 99be87b

Please sign in to comment.