svgmap 1.3.4 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +20 -4
- package/assets/create-map-paths.html +991 -8
- package/assets/map-optimized.svg +984 -1058
- package/dist/svgMap.js +262 -218
- package/dist/svgMap.min.js +1 -1
- package/package.json +4 -4
- package/src/js/svgMap/map.js +25 -5
- package/src/js/svgMap/mapPaths.js +221 -210
- package/src/js/svgMap/tooltip.js +8 -3
- package/src/js/svgMap.js +8 -2
package/src/js/svgMap/tooltip.js
CHANGED
|
@@ -30,8 +30,13 @@ svgMap.prototype.hideTooltip = function () {
|
|
|
30
30
|
|
|
31
31
|
// Move the tooltip
|
|
32
32
|
svgMap.prototype.moveTooltip = function (e) {
|
|
33
|
-
var x = e.pageX;
|
|
34
|
-
var y = e.pageY;
|
|
33
|
+
var x = e.pageX || (e.touches && e.touches[0] ? e.touches[0].pageX : null);
|
|
34
|
+
var y = e.pageY || (e.touches && e.touches[0] ? e.touches[0].pageY : null);
|
|
35
|
+
|
|
36
|
+
if (x === null || y === null) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
35
40
|
var offsetToWindow = 6;
|
|
36
41
|
var offsetToPointer = 12;
|
|
37
42
|
var offsetToPointerFlipped = 32;
|
|
@@ -64,4 +69,4 @@ svgMap.prototype.moveTooltip = function (e) {
|
|
|
64
69
|
|
|
65
70
|
this.tooltip.style.left = x + 'px';
|
|
66
71
|
this.tooltip.style.top = y + 'px';
|
|
67
|
-
};
|
|
72
|
+
};
|
package/src/js/svgMap.js
CHANGED
|
@@ -14,7 +14,7 @@ svgMap.prototype.init = function (options) {
|
|
|
14
14
|
|
|
15
15
|
// Minimum and maximum zoom
|
|
16
16
|
minZoom: 1,
|
|
17
|
-
maxZoom:
|
|
17
|
+
maxZoom: 25,
|
|
18
18
|
|
|
19
19
|
// Initial zoom
|
|
20
20
|
initialZoom: 1.06,
|
|
@@ -40,7 +40,13 @@ svgMap.prototype.init = function (options) {
|
|
|
40
40
|
hideFlag: false,
|
|
41
41
|
|
|
42
42
|
// The default text to be shown when no data is present
|
|
43
|
-
noDataText: 'No data available'
|
|
43
|
+
noDataText: 'No data available',
|
|
44
|
+
|
|
45
|
+
// Country specific options
|
|
46
|
+
countries: {
|
|
47
|
+
// Western Sahara: Set to false to combine Morocco (MA) and Western Sahara (EH)
|
|
48
|
+
EH: true
|
|
49
|
+
}
|
|
44
50
|
};
|
|
45
51
|
|
|
46
52
|
this.options = Object.assign({}, defaultOptions, (options || {}));
|