Skip to content

Commit

Permalink
Release v1.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
techfg committed Feb 21, 2021
1 parent 3593e7a commit 294061b
Show file tree
Hide file tree
Showing 11 changed files with 209 additions and 136 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
- Make callback data structures consistent
- Improve docs

## Version 1.5.4 - 2021.02.20
- [Issue 83](https://github.com/jamietre/ImageMapster/issues/83) Fix boundlist sync with selected state
- [Issue 377](https://github.com/jamietre/ImageMapster/issues/377) onConfigured not called after rebind
- [Issue 378](https://github.com/jamietre/ImageMapster/issues/378) drawn areas do not match selected state after rebind
- [Issue 380](https://github.com/jamietre/ImageMapster/issues/380) onGetList not called when isSelectable !== true
- [Issue 381](https://github.com/jamietre/ImageMapster/issues/381) tests not waiting for onConfigured before continuing

## Version 1.5.3 - 2021.02.14
- [Issue 374](https://github.com/jamietre/ImageMapster/issues/374) Uncaught RangeError: Maximum call stack size exceeded when includeKeys has circular reference

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ ImageMapster includes several examples. To view the examples:

## Zepto Compatibility

As of ImageMapster v1.3.2, ImageMapster contains full support for Zepto v1.2.0. The latest Zepto compatible version of ImageMapster is [1.5.3](https://github.com/jamietre/ImageMapster/releases/tag/v1.5.3).
As of ImageMapster v1.3.2, ImageMapster contains full support for Zepto v1.2.0. The latest Zepto compatible version of ImageMapster is [1.5.4](https://github.com/jamietre/ImageMapster/releases/tag/v1.5.4).

Prior to ImageMapster v1.3.2 and with any version of Zepto except v1.2.0, ImageMapster is unlikely to work as expected. In the early versions of ImageMapster, Zepto support was maintained, however due to changes in Zepto, as of v1.2.5 of ImageMapster, support for Zepto compatability was not maintained as it required too much effort and pushing ImageMapster forward with jQuery was the priority.

Expand All @@ -177,8 +177,8 @@ To use ImageMapster >= v1.3.2 < 2.0.0 with Zepto v.1.2.0, Zepto must contain the

:warning: **_As of ImageMapster v1.3.0, if targeting ES5 browers, you must include a Promise polyfill such as [es6-promise](https://www.npmjs.com/package/es6-promise). See [Issue 341](https://github.com/jamietre/ImageMapster/issues/341) for details._**

1. [jsDelivr](https://www.jsdelivr.com/package/npm/imagemapster?version=1.5.3) - https://www.jsdelivr.com/package/npm/imagemapster?version=1.5.3
2. [cdnjs](https://cdnjs.com/libraries/imagemapster/1.5.3) - https://cdnjs.com/libraries/imagemapster/1.5.3
1. [jsDelivr](https://www.jsdelivr.com/package/npm/imagemapster?version=1.5.4) - https://www.jsdelivr.com/package/npm/imagemapster?version=1.5.4
2. [cdnjs](https://cdnjs.com/libraries/imagemapster/1.5.4) - https://cdnjs.com/libraries/imagemapster/1.5.4

Use `jquery.imagemapster.zepto.min.js`

Expand All @@ -194,7 +194,7 @@ Use `jquery.imagemapster.zepto.min.js`
></script>
<script
language="text/javascript"
src="/path/to/cdn/for/v1.5.3/dist/jquery.imagemapster.zepto.min.js"
src="/path/to/cdn/for/v1.5.4/dist/jquery.imagemapster.zepto.min.js"
></script>
```

Expand All @@ -207,7 +207,7 @@ Using `webpack` and `zepto-modules` as an example:
#### Install from NPM

```sh
npm install zepto-modules imagemapster@1.5.3 --save
npm install zepto-modules imagemapster@1.5.4 --save
```

#### src/yourzepto.js
Expand Down
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.5.3",
"version": "1.5.4",
"homepage": "https://github.com/jamietre/ImageMapster",
"description": "jQuery plugin that activates areas in HTML imagemaps with support for highlighting, selecting, tooltips, resizing and more",
"main": "dist/jquery.imagemapster.min.js",
Expand Down
155 changes: 94 additions & 61 deletions dist/jquery.imagemapster.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* imagemapster - v1.5.3 - 2021-02-14
* imagemapster - v1.5.4 - 2021-02-20
* https://github.com/jamietre/ImageMapster/
* Copyright (c) 2011 - 2021 James Treworgy
* License: MIT
Expand Down Expand Up @@ -99,15 +99,15 @@
}
})(jQuery);

/*
/*
core.js
ImageMapster core
ImageMapster core
*/

(function ($) {
'use strict';

var mapster_version = '1.5.3';
var mapster_version = '1.5.4';

// all public functions in $.mapster.impl are methods
$.fn.mapster = function (method) {
Expand Down Expand Up @@ -478,24 +478,6 @@
});
return result;
},
// Causes changes to the bound list based on the user action (select or deselect)
// area: the jQuery area object
// returns the matching elements from the bound list for the first area passed (normally only one should be passed, but
// a list can be passed
setBoundListProperties: function (opts, target, selected) {
target.each(function (_, e) {
if (opts.listSelectedClass) {
if (selected) {
$(e).addClass(opts.listSelectedClass);
} else {
$(e).removeClass(opts.listSelectedClass);
}
}
if (opts.listSelectedAttribute) {
$(e).prop(opts.listSelectedAttribute, selected);
}
});
},
getMapDataIndex: function (obj) {
var img, id;
switch (obj.tagName && obj.tagName.toLowerCase()) {
Expand Down Expand Up @@ -939,14 +921,7 @@
// Clean up after a group that applied to the same map
function finishSetForMap(map_data) {
$.each(area_list, function (_, el) {
var newState = setSelection(el);
if (map_data.options.boundList) {
m.setBoundListProperties(
map_data.options,
m.getBoundList(map_data.options, key_list),
newState
);
}
setSelection(el);
});
if (!selected) {
map_data.removeSelectionFinish();
Expand Down Expand Up @@ -1026,6 +1001,7 @@
me.bindImages().then(function () {
me.buildDataset(true);
me.complete = true;
me.onConfigured();
});
//this.redrawSelections();
},
Expand Down Expand Up @@ -2410,10 +2386,6 @@
if (canChangeState) {
ar.toggle();
}

if (opts.boundList && opts.boundList.length > 0) {
m.setBoundListProperties(opts, list_target, ar.isSelected());
}
}

mousedown.call(this, e);
Expand Down Expand Up @@ -2735,6 +2707,63 @@
}
});
},
// Causes changes to the bound list based on the user action (select or deselect)
// area: the jQuery area object
// returns the matching elements from the bound list for the first area passed
// (normally only one should be passed, but a list can be passed)
setBoundListProperties: function (opts, target, selected) {
target.each(function (_, e) {
if (opts.listSelectedClass) {
if (selected) {
$(e).addClass(opts.listSelectedClass);
} else {
$(e).removeClass(opts.listSelectedClass);
}
}
if (opts.listSelectedAttribute) {
$(e).prop(opts.listSelectedAttribute, selected);
}
});
},
clearBoundListProperties: function (opts) {
var me = this;
if (!opts.boundList) {
return;
}
me.setBoundListProperties(opts, opts.boundList, false);
},
refreshBoundList: function (opts) {
var me = this;
me.clearBoundListProperties(opts);
me.setBoundListProperties(
opts,
m.getBoundList(opts, me.getSelected()),
true
);
},
setBoundList: function (opts) {
var me = this,
sorted_list = me.data.slice(0),
sort_func;
if (opts.sortList) {
if (opts.sortList === 'desc') {
sort_func = function (a, b) {
return a === b ? 0 : a > b ? -1 : 1;
};
} else {
sort_func = function (a, b) {
return a === b ? 0 : a < b ? -1 : 1;
};
}

sorted_list.sort(function (a, b) {
a = a.value;
b = b.value;
return sort_func(a, b);
});
}
me.options.boundList = opts.onGetList.call(me.image, sorted_list);
},
///called when images are done loading
initialize: function () {
var imgCopy,
Expand All @@ -2746,8 +2775,6 @@
i,
size,
img,
sort_func,
sorted_list,
scale,
me = this,
opts = me.options;
Expand Down Expand Up @@ -2859,38 +2886,23 @@

u.setOpacity(me.images[1], 1);

if (opts.isSelectable && opts.onGetList) {
sorted_list = me.data.slice(0);
if (opts.sortList) {
if (opts.sortList === 'desc') {
sort_func = function (a, b) {
return a === b ? 0 : a > b ? -1 : 1;
};
} else {
sort_func = function (a, b) {
return a === b ? 0 : a < b ? -1 : 1;
};
}

sorted_list.sort(function (a, b) {
a = a.value;
b = b.value;
return sort_func(a, b);
});
}

me.options.boundList = opts.onGetList.call(me.image, sorted_list);
}

me.complete = true;
me.processCommandQueue();

if (opts.enableAutoResizeSupport === true) {
me.configureAutoResize();
}

me.onConfigured();
},

onConfigured: function () {
var me = this,
$img = $(me.image),
opts = me.options;

if (opts.onConfigured && typeof opts.onConfigured === 'function') {
opts.onConfigured.call(img, true);
opts.onConfigured.call($img, true);
}
},

Expand Down Expand Up @@ -2966,6 +2978,7 @@
if (rebind) {
mapArea = me.mapAreas[$area.data('mapster') - 1];
mapArea.configure(curKey);
mapArea.areaDataXref = [];
} else {
mapArea = new m.MapArea(me, area, curKey);
me.mapAreas.push(mapArea);
Expand Down Expand Up @@ -3033,7 +3046,20 @@

// populate areas from config options
me.setAreaOptions(opts.areas);
me.redrawSelections();
if (opts.onGetList) {
me.setBoundList(opts);
}

if (opts.boundList && opts.boundList.length > 0) {
me.refreshBoundList(opts);
}

if (rebind) {
me.graphics.removeSelections();
me.graphics.refreshSelections();
} else {
me.redrawSelections();
}
},
processCommandQueue: function () {
var cur,
Expand Down Expand Up @@ -3407,6 +3433,13 @@
selected: state
});
}
if (state_type === 'select' && this.owner.options.boundList) {
this.owner.setBoundListProperties(
this.owner.options,
m.getBoundList(this.owner.options, this.key),
state
);
}
},

// highlight this area
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.

Loading

0 comments on commit 294061b

Please sign in to comment.