svgmap 2.7.1 → 2.9.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Stephan Wagner
3
+ Copyright (c) 2022 Stephan Wagner
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -23,8 +23,8 @@ import 'svgmap/dist/svgMap.min.css';
23
23
 
24
24
  ```html
25
25
  <script src="https://cdn.jsdelivr.net/npm/svg-pan-zoom@3.6.1/dist/svg-pan-zoom.min.js"></script>
26
- <script src="https://cdn.jsdelivr.net/gh/StephanWagner/svgMap@v2.7.1/dist/svgMap.min.js"></script>
27
- <link href="https://cdn.jsdelivr.net/gh/StephanWagner/svgMap@v2.7.1/dist/svgMap.min.css" rel="stylesheet">
26
+ <script src="https://cdn.jsdelivr.net/gh/StephanWagner/svgMap@v2.9.0/dist/svgMap.min.js"></script>
27
+ <link href="https://cdn.jsdelivr.net/gh/StephanWagner/svgMap@v2.9.0/dist/svgMap.min.css" rel="stylesheet">
28
28
  ```
29
29
 
30
30
  ---
@@ -81,7 +81,9 @@ You can pass the following options into svgMap:
81
81
  | `maxZoom` | `float` | `25` | Maximal zoom level |
82
82
  | `initialZoom` | `float` | `1.06` | Initial zoom level |
83
83
  | `initialPan` | `object` | | Initial pan on x and y axis (e.g. `{ x: 30, y: 60 }`) |
84
+ | `showContinentSelector` | `boolean` | `false` | Show continent selector |
84
85
  | `zoomScaleSensitivity` | `float` | `0.2` | Sensitivity when zooming |
86
+ | `showZoomReset` | `boolean` | `false` | Show zoom reset button |
85
87
  | `mouseWheelZoomEnabled` | `boolean` | `true` | Enables or disables zooming with the scroll wheel |
86
88
  | `mouseWheelZoomWithKey` | `boolean` | `false` | Allow zooming only when one of the following keys is pressed: SHIFT, CONTROL, ALT, COMMAND, OPTION |
87
89
  | `mouseWheelKeyMessage` | `string` | `'Press the [ALT] key to zoom'` | The message when trying to scroll without a key |
@@ -8,7 +8,6 @@
8
8
  <svg id ="map" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 1001">
9
9
 
10
10
  <!-- copy map path in here -->
11
-
12
11
  <path id="AF" d="M1369.9,333.8h-5.4l-3.8-0.5l-2.5,2.9l-2.1,0.7l-1.5,1.3l-2.6-2.1l-1-5.4l-1.6-0.3v-2l-3.2-1.5l-1.7,2.3l0.2,2.6
13
12
  l-0.6,0.9l-3.2-0.1l-0.9,3l-2.1-1.3l-3.3,2.1l-1.8-0.8l-4.3-1.4h-2.9l-1.6-0.2l-2.9-1.7l-0.3,2.3l-4.1,1.2l0.1,5.2l-2.5,2l-4,0.9
14
13
  l-0.4,3l-3.9,0.8l-5.9-2.4l-0.5,8l-0.5,4.7l2.5,0.9l-1.6,3.5l2.7,5.1l1.1,4l4.3,1.1l1.1,4l-3.9,5.8l9.6,3.2l5.3-0.9l3.3,0.8l0.9-1.4
@@ -295,7 +294,7 @@
295
294
  l-1.3,1.5l-6.1,0.2L882.8,488.5L882.8,488.5z"/>
296
295
  <path id="GW" d="M900.2,492.1l-10.3-0.3l-1.5,0.7l-1.8-0.2l-3,1.1l0.3,1.3l1.7,1.4v0.9l1.2,1.8l2.4,0.5l2.9,2.6l2.6-3.1l1.7,0.1
297
296
  l1.4-1h1.3l0.8-0.9l-0.4-2.1l0.6-0.7L900.2,492.1L900.2,492.1z"/>
298
- <path id="GQ" d="M1040.1,557.8l-9.2-0.2l-1.9,7.2l1,0.9l1.9-0.3h8.2V557.8L1040.1,557.8z"/>
297
+ <path id="GQ" d="M 1040.1 557.8 l -9.2 -0.2 l -1.9 7.2 l 1 0.9 l 1.9 -0.3 h 8.2 V 557.8 L 1040.1 557.8 z M 1023 551 L 1023.6 550.2 L 1023.6 549.8 L 1024.6 548.25 L 1024.45 547.5 L 1023.04 547.4 L 1022.5 548.2 L 1022.55 548.55 L 1022.25 549.36 L 1021.55 549.5 L 1021.25 550.15 L 1021.5 550.7 L 1023 551 M 1003.8 580.2 L 1003.9 580.44 L 1003.82 580.62 L 1003.65 580.55 L 1003.63 580.232 L 1003.8 580.2"/>
299
298
  <path id="GR" d="M1101.9,344.9l-0.8,2.8l6.6,1.2v1.1l7.6-0.6l0.5-1.9l-2.8,0.8v-1.1l-3.9-0.5l-4.1,0.4L1101.9,344.9L1101.9,344.9z
300
299
  M1113.4,307.5l-2.7-1.6l0.3,3l-4.6,0.6l-3.9-2.1l-3.9,1.7l-3.8-0.2l-1,0.2l-0.7,1.1l-2.8-0.1l-1.9,1.3l-3.3,0.6v1.6l-1.6,0.9
301
300
  l-0.1,2.1l-2.1,3l0.5,1.9l2.9,3.6l2.3,3l1.3,4.3l2.3,5.1l4.6,2.9l3.4-0.1l-2.4-5.7l3.3-0.7l-1.9-3.3l5,1.7l-0.4-3.7l-2.7-1.8l-3.2-3
@@ -288,7 +288,7 @@
288
288
  l-1.3,1.5l-6.1,0.2L882.8,488.5L882.8,488.5z"/>
289
289
  <path id="GW" d="M900.2,492.1l-10.3-0.3l-1.5,0.7l-1.8-0.2l-3,1.1l0.3,1.3l1.7,1.4v0.9l1.2,1.8l2.4,0.5l2.9,2.6l2.6-3.1l1.7,0.1
290
290
  l1.4-1h1.3l0.8-0.9l-0.4-2.1l0.6-0.7L900.2,492.1L900.2,492.1z"/>
291
- <path id="GQ" d="M1040.1,557.8l-9.2-0.2l-1.9,7.2l1,0.9l1.9-0.3h8.2V557.8L1040.1,557.8z"/>
291
+ <path id="GQ" d="M 1040.1 557.8 l -9.2 -0.2 l -1.9 7.2 l 1 0.9 l 1.9 -0.3 h 8.2 V 557.8 L 1040.1 557.8 z M 1023 551 L 1023.6 550.2 L 1023.6 549.8 L 1024.6 548.25 L 1024.45 547.5 L 1023.04 547.4 L 1022.5 548.2 L 1022.55 548.55 L 1022.25 549.36 L 1021.55 549.5 L 1021.25 550.15 L 1021.5 550.7 L 1023 551 M 1003.8 580.2 L 1003.9 580.44 L 1003.82 580.62 L 1003.65 580.55 L 1003.63 580.232 L 1003.8 580.2"/>
292
292
  <path id="GR" d="M1101.9,344.9l-0.8,2.8l6.6,1.2v1.1l7.6-0.6l0.5-1.9l-2.8,0.8v-1.1l-3.9-0.5l-4.1,0.4L1101.9,344.9L1101.9,344.9z
293
293
  M1113.4,307.5l-2.7-1.6l0.3,3l-4.6,0.6l-3.9-2.1l-3.9,1.7l-3.8-0.2l-1,0.2l-0.7,1.1l-2.8-0.1l-1.9,1.3l-3.3,0.6v1.6l-1.6,0.9
294
294
  l-0.1,2.1l-2.1,3l0.5,1.9l2.9,3.6l2.3,3l1.3,4.3l2.3,5.1l4.6,2.9l3.4-0.1l-2.4-5.7l3.3-0.7l-1.9-3.3l5,1.7l-0.4-3.7l-2.7-1.8l-3.2-3
@@ -346,6 +346,18 @@
346
346
  "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
347
347
  "dev": true
348
348
  },
349
+ "acorn": {
350
+ "version": "8.7.0",
351
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz",
352
+ "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==",
353
+ "dev": true
354
+ },
355
+ "acorn-walk": {
356
+ "version": "8.2.0",
357
+ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
358
+ "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
359
+ "dev": true
360
+ },
349
361
  "address": {
350
362
  "version": "1.1.2",
351
363
  "resolved": "https://registry.npmjs.org/address/-/address-1.1.2.tgz",
@@ -2039,9 +2051,9 @@
2039
2051
  }
2040
2052
  },
2041
2053
  "minimist": {
2042
- "version": "1.2.5",
2043
- "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
2044
- "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
2054
+ "version": "1.2.6",
2055
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
2056
+ "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
2045
2057
  "dev": true
2046
2058
  },
2047
2059
  "minipass": {
@@ -2145,9 +2157,9 @@
2145
2157
  "dev": true
2146
2158
  },
2147
2159
  "nanoid": {
2148
- "version": "3.1.25",
2149
- "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz",
2150
- "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==",
2160
+ "version": "3.2.0",
2161
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz",
2162
+ "integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==",
2151
2163
  "dev": true
2152
2164
  },
2153
2165
  "negotiator": {
@@ -2296,9 +2308,9 @@
2296
2308
  }
2297
2309
  },
2298
2310
  "nth-check": {
2299
- "version": "2.0.0",
2300
- "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.0.tgz",
2301
- "integrity": "sha512-i4sc/Kj8htBrAiH1viZ0TgU8Y5XqCaV/FziYK6TBczxmeKm3AEFWqqF3195yKudrarqy7Zu80Ra5dobFjn9X/Q==",
2311
+ "version": "2.0.1",
2312
+ "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.1.tgz",
2313
+ "integrity": "sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w==",
2302
2314
  "dev": true,
2303
2315
  "requires": {
2304
2316
  "boolbase": "^1.0.0"
@@ -3335,10 +3347,14 @@
3335
3347
  }
3336
3348
  },
3337
3349
  "vm2": {
3338
- "version": "3.9.3",
3339
- "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.3.tgz",
3340
- "integrity": "sha512-smLS+18RjXYMl9joyJxMNI9l4w7biW8ilSDaVRvFBDwOH8P0BK1ognFQTpg0wyQ6wIKLTblHJvROW692L/E53Q==",
3341
- "dev": true
3350
+ "version": "3.9.7",
3351
+ "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.7.tgz",
3352
+ "integrity": "sha512-g/GZ7V0Mlmch3eDVOATvAXr1GsJNg6kQ5PjvYy3HbJMCRn5slNbo/u73Uy7r5yUej1cRa3ZjtoVwcWSQuQ/fow==",
3353
+ "dev": true,
3354
+ "requires": {
3355
+ "acorn": "^8.7.0",
3356
+ "acorn-walk": "^8.2.0"
3357
+ }
3342
3358
  },
3343
3359
  "walk-up-path": {
3344
3360
  "version": "1.0.0",
@@ -6,7 +6,7 @@
6
6
  "license": "MIT",
7
7
  "main": "index.js",
8
8
  "dependencies": {
9
- "svgmap": "2.7.0"
9
+ "svgmap": "2.8.0"
10
10
  },
11
11
  "devDependencies": {
12
12
  "snowpack": "^3.8.3"
@@ -45,7 +45,8 @@
45
45
  data: svgMapDataPopulation,
46
46
  flagType: 'emoji',
47
47
  mouseWheelZoomEnabled: true,
48
- mouseWheelZoomWithKey: true
48
+ mouseWheelZoomWithKey: true,
49
+ showContinentSelector: true
49
50
  });
50
51
  </script>
51
52
  </div>
@@ -70,7 +71,8 @@
70
71
  mouseWheelZoomEnabled: true,
71
72
  mouseWheelZoomWithKey: true,
72
73
  mouseWheelKeyMessage: 'Bitte [ALT] drücken um zu zoomen',
73
- mouseWheelKeyMessageMac: 'Bitte [COMMAND] drücken um zu zoomen'
74
+ mouseWheelKeyMessageMac: 'Bitte [COMMAND] drücken um zu zoomen',
75
+ showZoomReset: true
74
76
  });
75
77
  </script>
76
78
  </div>
package/dist/svgMap.css CHANGED
@@ -114,6 +114,12 @@
114
114
  width: 11px;
115
115
  height: 3px;
116
116
  }
117
+ .svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button.svgMap-zoom-reset-button::before {
118
+ width: 11px;
119
+ height: 11px;
120
+ background: none;
121
+ border: 2px solid #666;
122
+ }
117
123
  @media (hover: hover) {
118
124
  .svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button:hover:before, .svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button:hover:after {
119
125
  background: #111;
@@ -125,6 +131,10 @@
125
131
  .svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button.svgMap-disabled:before, .svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button.svgMap-disabled:after {
126
132
  background: #ccc;
127
133
  }
134
+ .svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button.svgMap-zoom-reset-button.svgMap-disabled:before {
135
+ border: 2px solid #ccc;
136
+ background: none;
137
+ }
128
138
  .svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-in-button {
129
139
  margin: 1px 0 1px 1px;
130
140
  }
@@ -135,6 +145,15 @@
135
145
  .svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-out-button {
136
146
  margin: 1px 1px 1px 0;
137
147
  }
148
+ .svgMap-map-wrapper .svgMap-map-continent-controls-wrapper {
149
+ position: absolute;
150
+ top: 10px;
151
+ right: 10px;
152
+ z-index: 1;
153
+ display: flex;
154
+ border-radius: 2px;
155
+ box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
156
+ }
138
157
  .svgMap-map-wrapper .svgMap-country {
139
158
  stroke: #fff;
140
159
  stroke-width: 1;
package/dist/svgMap.js CHANGED
@@ -64,6 +64,9 @@ function svgMapWrapper(svgPanZoom) {
64
64
  // Set to true to open the link on mobile devices, set to false (default) to show the tooltip
65
65
  touchLink: false,
66
66
 
67
+ // Set to true to show the to show a zoom reset button
68
+ showZoomReset: false,
69
+
67
70
  // Called when a tooltip is created to custimize the tooltip content
68
71
  onGetTooltip: function (tooltipDiv, countryID, countryValues) {
69
72
  return null;
@@ -76,7 +79,10 @@ function svgMapWrapper(svgPanZoom) {
76
79
 
77
80
  // Crimea: Set to 'RU' to make the Crimea part of Russia, by default it is part of the Ukraine
78
81
  Crimea: 'UA'
79
- }
82
+ },
83
+
84
+ // Set to true to show a drop down menu with the continents
85
+ showContinentSelector: false,
80
86
  };
81
87
 
82
88
  this.options = Object.assign({}, defaultOptions, options || {});
@@ -679,6 +685,69 @@ function svgMapWrapper(svgPanZoom) {
679
685
  ZW: '🇿🇼'
680
686
  };
681
687
 
688
+ svgMap.prototype.continents = {
689
+ "EA": {
690
+ "iso": "EA",
691
+ "name": "World"
692
+ },
693
+ "AF": {
694
+ "iso": "AF",
695
+ "name": "Africa",
696
+ "pan": {
697
+ x: 454, y: 250
698
+ },
699
+ "zoom": 1.90
700
+ },
701
+ "AS": {
702
+ "iso": "AS",
703
+ "name": "Asia",
704
+ "pan": {
705
+ x: 904, y: 80
706
+ },
707
+ "zoom": 1.8
708
+ },
709
+ "EU": {
710
+ "iso": "EU",
711
+ "name": "Europe",
712
+ "pan": {
713
+ x: 404, y: 80
714
+ },
715
+ "zoom": 5
716
+ },
717
+ "NA": {
718
+ "iso": "NA",
719
+ "name": "North America",
720
+ "pan": {
721
+ x: 104, y: 55
722
+ },
723
+ "zoom": 2.6
724
+ },
725
+
726
+ "MA": {
727
+ "iso": "MA",
728
+ "name": "Middle America",
729
+ "pan": {
730
+ x: 104, y: 200
731
+ },
732
+ "zoom": 2.6
733
+ },
734
+ "SA": {
735
+ "iso": "SA",
736
+ "name": "South America",
737
+ "pan": {
738
+ x: 104, y: 340
739
+ },
740
+ "zoom": 2.2
741
+ },
742
+ "OC": {
743
+ "iso": "OC",
744
+ "name": "Oceania",
745
+ "pan": {
746
+ x: 954, y: 350
747
+ },
748
+ "zoom": 1.90
749
+ },
750
+ }
682
751
  // Create the SVG map
683
752
 
684
753
  svgMap.prototype.createMap = function () {
@@ -699,6 +768,7 @@ function svgMapWrapper(svgPanZoom) {
699
768
  this.mapImage.classList.add('svgMap-map-image');
700
769
  this.mapWrapper.appendChild(this.mapImage);
701
770
 
771
+
702
772
  // Add controls
703
773
  var mapControlsWrapper = this.createElement(
704
774
  'div',
@@ -710,25 +780,27 @@ function svgMapWrapper(svgPanZoom) {
710
780
  'svgMap-map-controls-zoom',
711
781
  mapControlsWrapper
712
782
  );
713
- ['in', 'out'].forEach(
783
+ ['in', 'out', 'reset'].forEach(
714
784
  function (item) {
715
- var zoomControlName =
716
- 'zoomControl' + item.charAt(0).toUpperCase() + item.slice(1);
717
- this[zoomControlName] = this.createElement(
718
- 'button',
719
- 'svgMap-control-button svgMap-zoom-button svgMap-zoom-' +
785
+ if (item === 'reset' && this.options.showZoomReset || item !== 'reset') {
786
+ var zoomControlName =
787
+ 'zoomControl' + item.charAt(0).toUpperCase() + item.slice(1);
788
+ this[zoomControlName] = this.createElement(
789
+ 'button',
790
+ 'svgMap-control-button svgMap-zoom-button svgMap-zoom-' +
720
791
  item +
721
792
  '-button',
722
- zoomContainer
723
- );
724
- this[zoomControlName].type = 'button';
725
- this[zoomControlName].addEventListener(
726
- 'click',
727
- function () {
728
- this.zoomMap(item);
729
- }.bind(this),
730
- { passive: true }
731
- );
793
+ zoomContainer
794
+ );
795
+ this[zoomControlName].type = 'button';
796
+ this[zoomControlName].addEventListener(
797
+ 'click',
798
+ function () {
799
+ this.zoomMap(item);
800
+ }.bind(this),
801
+ { passive: true }
802
+ );
803
+ }
732
804
  }.bind(this)
733
805
  );
734
806
 
@@ -736,6 +808,41 @@ function svgMapWrapper(svgPanZoom) {
736
808
  this.zoomControlIn.setAttribute('aria-label', 'Zoom in');
737
809
  this.zoomControlOut.setAttribute('aria-label', 'Zoom out');
738
810
 
811
+ if (this.options.showContinentSelector) {
812
+ // Add continent controls
813
+ var mapContinentControlsWrapper = this.createElement(
814
+ 'div',
815
+ 'svgMap-map-continent-controls-wrapper',
816
+ this.mapWrapper
817
+ );
818
+ this["continentSelect"] = this.createElement(
819
+ 'select',
820
+ 'svgMap-continent-select',
821
+ mapContinentControlsWrapper
822
+ );
823
+ var that = this;
824
+ Object.keys(svgMap.prototype.continents).forEach(
825
+ function (item) {
826
+ let element = that.createElement(
827
+ 'option',
828
+ 'svgMap-continent-option svgMap-continent-iso-' + svgMap.prototype.continents[item].iso,
829
+ that["continentSelect"],
830
+ svgMap.prototype.continents[item].name
831
+ );
832
+ element.value = item
833
+ }
834
+ );
835
+
836
+ this.continentSelect.addEventListener(
837
+ 'change',
838
+ function (e) {
839
+ const continent = e.target.value;
840
+ if (continent) this.zoomContinent(e.target.value);
841
+ }.bind(that),
842
+ { passive: true }
843
+ );
844
+ mapContinentControlsWrapper.setAttribute('aria-label', 'Select continent');
845
+ }
739
846
  // Fix countries
740
847
  var mapPaths = Object.assign({}, this.mapPaths);
741
848
 
@@ -845,7 +952,17 @@ function svgMapWrapper(svgPanZoom) {
845
952
  this.options.data.values[countryID]['linkTarget']
846
953
  );
847
954
  }
848
- countryElement.addEventListener('click', function (e) {
955
+
956
+ let dragged = false;
957
+ countryElement.addEventListener('mousedown', function () { dragged = false });
958
+ countryElement.addEventListener('touchstart', function () { dragged = false });
959
+ countryElement.addEventListener('mousemove', function () { dragged = true });
960
+ countryElement.addEventListener('touchmove', function () { dragged = true });
961
+ const clickHandler = function (e) {
962
+ if (dragged) {
963
+ return;
964
+ }
965
+
849
966
  const link = countryElement.getAttribute('data-link');
850
967
  const target = countryElement.getAttribute('data-link-target');
851
968
 
@@ -854,7 +971,10 @@ function svgMapWrapper(svgPanZoom) {
854
971
  } else {
855
972
  window.location.href = link;
856
973
  }
857
- });
974
+ }
975
+
976
+ countryElement.addEventListener('click', clickHandler);
977
+ countryElement.addEventListener('touchend', clickHandler);
858
978
  }
859
979
 
860
980
  // Hide tooltip when mouse leaves the country area
@@ -969,7 +1089,7 @@ function svgMapWrapper(svgPanZoom) {
969
1089
  var flagContainer = this.createElement(
970
1090
  'div',
971
1091
  'svgMap-tooltip-flag-container svgMap-tooltip-flag-container-' +
972
- this.options.flagType,
1092
+ this.options.flagType,
973
1093
  tooltipContentWrapper
974
1094
  );
975
1095
 
@@ -1035,6 +1155,10 @@ function svgMapWrapper(svgPanZoom) {
1035
1155
  this.zoomControlIn.setAttribute('aria-disabled', 'false');
1036
1156
  this.zoomControlOut.classList.remove('svgMap-disabled');
1037
1157
  this.zoomControlOut.setAttribute('aria-disabled', 'false');
1158
+ if (this.options.showZoomReset) {
1159
+ this.zoomControlReset.classList.remove('svgMap-disabled');
1160
+ this.zoomControlReset.setAttribute('aria-disabled', 'false');
1161
+ }
1038
1162
 
1039
1163
  if (this.mapPanZoom.getZoom().toFixed(3) <= this.options.minZoom) {
1040
1164
  this.zoomControlOut.classList.add('svgMap-disabled');
@@ -1044,6 +1168,10 @@ function svgMapWrapper(svgPanZoom) {
1044
1168
  this.zoomControlIn.classList.add('svgMap-disabled');
1045
1169
  this.zoomControlIn.setAttribute('aria-disabled', 'true');
1046
1170
  }
1171
+ if (this.options.showZoomReset && this.mapPanZoom.getZoom().toFixed(3) == this.options.initialZoom) {
1172
+ this.zoomControlReset.classList.add('svgMap-disabled');
1173
+ this.zoomControlReset.setAttribute('aria-disabled', 'true');
1174
+ }
1047
1175
  };
1048
1176
 
1049
1177
  // Zoom map
@@ -1056,7 +1184,33 @@ function svgMapWrapper(svgPanZoom) {
1056
1184
  ) {
1057
1185
  return false;
1058
1186
  }
1059
- this.mapPanZoom[direction == 'in' ? 'zoomIn' : 'zoomOut']();
1187
+ if (direction === 'reset') {
1188
+ this.mapPanZoom.reset();
1189
+ if (this.options.initialPan.x != 0 || this.options.initialPan.y != 0) {
1190
+ // Init zoom and pan
1191
+ this.mapPanZoom.zoomAtPointBy(this.options.initialZoom, {
1192
+ x: this.options.initialPan.x,
1193
+ y: this.options.initialPan.y
1194
+ });
1195
+ } else {
1196
+ // Init zoom
1197
+ this.mapPanZoom.zoom(this.options.initialZoom);
1198
+ }
1199
+ } else {
1200
+ this.mapPanZoom[direction == 'in' ? 'zoomIn' : 'zoomOut']();
1201
+ }
1202
+ };
1203
+
1204
+ // Zoom to Contient
1205
+
1206
+ svgMap.prototype.zoomContinent = function (contientIso) {
1207
+
1208
+ const continent = this.continents[contientIso];
1209
+ if (continent.iso == "EA") this.mapPanZoom.reset()
1210
+ else if (continent.pan) {
1211
+ this.mapPanZoom.reset()
1212
+ this.mapPanZoom.zoomAtPoint(continent.zoom, continent.pan);
1213
+ }
1060
1214
  };
1061
1215
 
1062
1216
  // Add elements to show the zoom with keys notice
@@ -1357,7 +1511,7 @@ function svgMapWrapper(svgPanZoom) {
1357
1511
  d: 'M487.2,487l0.6-2.5l-0.7-0.7l-1.1-0.5l-2.5,0.8l-0.1-0.9l-1.6-1l-1.1-1.3l-1.5-0.5l-1.4,0.4l0.2,0.7l-1.1,0.7 l-2.1,1.6l-0.2,1l1.4,1.3l3.1,0.4l2.2,1.3l1.9,0.6l3.3,0.1L487.2,487L487.2,487z'
1358
1512
  },
1359
1513
  'GQ': {
1360
- d: 'M1040.1,557.8l-9.2-0.2l-1.9,7.2l1,0.9l1.9-0.3h8.2V557.8L1040.1,557.8z'
1514
+ d: 'M 1040.1 557.8 l -9.2 -0.2 l -1.9 7.2 l 1 0.9 l 1.9 -0.3 h 8.2 V 557.8 L 1040.1 557.8 z M 1023 551 L 1023.6 550.2 L 1023.6 549.8 L 1024.6 548.25 L 1024.45 547.5 L 1023.04 547.4 L 1022.5 548.2 L 1022.55 548.55 L 1022.25 549.36 L 1021.55 549.5 L 1021.25 550.15 L 1021.5 550.7 L 1023 551 M 1003.8 580.2 L 1003.9 580.44 L 1003.82 580.62 L 1003.65 580.55 L 1003.63 580.232 L 1003.8 580.2'
1361
1515
  },
1362
1516
  'ER': {
1363
1517
  d: 'M1198.1,474l-3.2-3.1l-1.8-5.9l-3.7-7.3l-2.6,3.6l-4,1l-1.6,2l-0.4,4.2l-1.9,9.4l0.7,2.5l6.5,1.3l1.5-4.7l3.5,2.9 l3.2-1.5l1.4,1.3l3.9,0.1l4.9,2.5l1.6,2.2l2.5,2.1l2.5,3.7l2,2.1l2.4,0.5l1.6-1.5l-2.8-1.9l-1.9-2.2l-3.2-3.7l-3.2-3.6L1198.1,474z'
@@ -1971,15 +2125,15 @@ function svgMapWrapper(svgPanZoom) {
1971
2125
  ratio = parseFloat(ratio).toFixed(1);
1972
2126
  var r = Math.ceil(
1973
2127
  parseInt(color1.substring(0, 2), 16) * ratio +
1974
- parseInt(color2.substring(0, 2), 16) * (1 - ratio)
2128
+ parseInt(color2.substring(0, 2), 16) * (1 - ratio)
1975
2129
  );
1976
2130
  var g = Math.ceil(
1977
2131
  parseInt(color1.substring(2, 4), 16) * ratio +
1978
- parseInt(color2.substring(2, 4), 16) * (1 - ratio)
2132
+ parseInt(color2.substring(2, 4), 16) * (1 - ratio)
1979
2133
  );
1980
2134
  var b = Math.ceil(
1981
2135
  parseInt(color1.substring(4, 6), 16) * ratio +
1982
- parseInt(color2.substring(4, 6), 16) * (1 - ratio)
2136
+ parseInt(color2.substring(4, 6), 16) * (1 - ratio)
1983
2137
  );
1984
2138
  return '#' + this.getHex(r) + this.getHex(g) + this.getHex(b);
1985
2139
  };
@@ -1,2 +1,2 @@
1
1
  /*! svgMap | https://github.com/StephanWagner/svgMap | MIT License | Copyright Stephan Wagner | https://stephanwagner.me */
2
- .svgMap-container,.svgMap-wrapper{position:relative}.svgMap-block-zoom-notice{position:absolute;z-index:2;top:100%;left:0;right:0;bottom:0;background:rgba(0,0,0,.8);pointer-events:none;opacity:0;color:#fff;transition:opacity 250ms}.svgMap-block-zoom-notice-active .svgMap-block-zoom-notice{pointer-events:all;top:0;opacity:1}.svgMap-block-zoom-notice>div{position:absolute;top:50%;left:0;right:0;text-align:center;padding:0 32px;transform:translateY(-50%);font-size:28px}@media (max-width:900px){.svgMap-block-zoom-notice>div{font-size:22px}}.svgMap-map-wrapper{position:relative;width:100%;padding-top:50%;overflow:hidden;background:#d9ecff;color:#111}.svgMap-map-wrapper *{box-sizing:border-box}.svgMap-map-wrapper :focus:not(:focus-visible){outline:0}.svgMap-map-wrapper .svgMap-map-image{display:block;position:absolute;top:0;left:0;width:100%;height:100%;margin:0}.svgMap-map-wrapper .svgMap-map-controls-wrapper{position:absolute;bottom:10px;left:10px;z-index:1;display:flex;overflow:hidden;border-radius:2px;box-shadow:0 0 0 2px rgba(0,0,0,.1)}.svgMap-map-wrapper .svgMap-map-controls-move,.svgMap-map-wrapper .svgMap-map-controls-zoom{display:flex;margin-right:5px;overflow:hidden;background:#fff}.svgMap-map-wrapper .svgMap-map-controls-move:last-child,.svgMap-map-wrapper .svgMap-map-controls-zoom:last-child{margin-right:0}.svgMap-map-wrapper .svgMap-control-button{background-color:transparent;border:none;border-radius:0;color:inherit;font:inherit;line-height:inherit;margin:0;padding:0;overflow:visible;text-transform:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;width:30px;height:30px;position:relative}.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button:after,.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);background:#666;transition:background-color 250ms}.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button:before{width:11px;height:3px}@media (hover:hover){.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button:hover:after,.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button:hover:before{background:#111}}.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button:active:after,.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button:active:before{background:#111}.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button.svgMap-disabled:after,.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button.svgMap-disabled:before{background:#ccc}.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-in-button{margin:1px 0 1px 1px}.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-in-button:after{width:3px;height:11px}.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-out-button{margin:1px 1px 1px 0}.svgMap-map-wrapper .svgMap-country{stroke:#fff;stroke-width:1;stroke-linejoin:round;vector-effect:non-scaling-stroke;transition:fill 250ms,stroke 250ms}.svgMap-map-wrapper .svgMap-country[data-link]{cursor:pointer}@media (hover:hover){.svgMap-map-wrapper .svgMap-country:hover{stroke:#333;stroke-width:1.5}}.svgMap-map-wrapper .svgMap-country.svgMap-active{stroke:#333;stroke-width:1.5}.svgMap-tooltip{box-shadow:0 0 3px rgba(0,0,0,.2);position:absolute;z-index:2;border-radius:2px;background:#fff;transform:translate(-50%,-100%);border-bottom:1px solid #000;display:none;pointer-events:none;min-width:60px}.svgMap-tooltip.svgMap-tooltip-flipped{transform:translate(-50%,0);border-bottom:0;border-top:1px solid #000}.svgMap-tooltip.svgMap-active{display:block}.svgMap-tooltip .svgMap-tooltip-content-container{position:relative;padding:10px 20px}.svgMap-tooltip .svgMap-tooltip-content-container .svgMap-tooltip-flag-container{text-align:center;margin:2px 0 5px}.svgMap-tooltip .svgMap-tooltip-content-container .svgMap-tooltip-flag-container.svgMap-tooltip-flag-container-emoji{font-size:50px;line-height:0;padding:25px 0 15px}.svgMap-tooltip .svgMap-tooltip-content-container .svgMap-tooltip-flag-container .svgMap-tooltip-flag{display:block;margin:auto;width:auto;height:32px;padding:2px;background:rgba(0,0,0,.15);border-radius:2px}.svgMap-tooltip .svgMap-tooltip-title{white-space:nowrap;font-size:18px;line-height:28px;padding:0 0 8px;text-align:center}.svgMap-tooltip .svgMap-tooltip-content{white-space:nowrap;text-align:center;font-size:14px;color:#777;margin:-5px 0 0}.svgMap-tooltip .svgMap-tooltip-content table{padding:0;border-spacing:0;margin:auto}.svgMap-tooltip .svgMap-tooltip-content table td{padding:2px 0;text-align:left}.svgMap-tooltip .svgMap-tooltip-content table td span{color:#111}.svgMap-tooltip .svgMap-tooltip-content table td:first-child{padding-right:10px;text-align:right}.svgMap-tooltip .svgMap-tooltip-content table td sup{vertical-align:baseline;position:relative;top:-5px}.svgMap-tooltip .svgMap-tooltip-content .svgMap-tooltip-no-data{padding:2px 0;color:#777;font-style:italic}.svgMap-tooltip .svgMap-tooltip-pointer{position:absolute;top:100%;left:50%;transform:translateX(-50%);overflow:hidden;height:10px;width:30px}.svgMap-tooltip .svgMap-tooltip-pointer:after{content:"";width:20px;height:20px;background:#fff;border:1px solid #000;position:absolute;bottom:6px;left:50%;transform:translateX(-50%) rotate(45deg)}.svgMap-tooltip.svgMap-tooltip-flipped .svgMap-tooltip-pointer{bottom:auto;top:-10px;transform:translateX(-50%) scaleY(-1)}
2
+ .svgMap-container,.svgMap-wrapper{position:relative}.svgMap-block-zoom-notice{position:absolute;z-index:2;top:100%;left:0;right:0;bottom:0;background:rgba(0,0,0,.8);pointer-events:none;opacity:0;color:#fff;transition:opacity 250ms}.svgMap-block-zoom-notice-active .svgMap-block-zoom-notice{pointer-events:all;top:0;opacity:1}.svgMap-block-zoom-notice>div{position:absolute;top:50%;left:0;right:0;text-align:center;padding:0 32px;transform:translateY(-50%);font-size:28px}@media (max-width:900px){.svgMap-block-zoom-notice>div{font-size:22px}}.svgMap-map-wrapper{position:relative;width:100%;padding-top:50%;overflow:hidden;background:#d9ecff;color:#111}.svgMap-map-wrapper *{box-sizing:border-box}.svgMap-map-wrapper :focus:not(:focus-visible){outline:0}.svgMap-map-wrapper .svgMap-map-image{display:block;position:absolute;top:0;left:0;width:100%;height:100%;margin:0}.svgMap-map-wrapper .svgMap-map-controls-wrapper{position:absolute;bottom:10px;left:10px;z-index:1;display:flex;overflow:hidden;border-radius:2px;box-shadow:0 0 0 2px rgba(0,0,0,.1)}.svgMap-map-wrapper .svgMap-map-controls-move,.svgMap-map-wrapper .svgMap-map-controls-zoom{display:flex;margin-right:5px;overflow:hidden;background:#fff}.svgMap-map-wrapper .svgMap-map-controls-move:last-child,.svgMap-map-wrapper .svgMap-map-controls-zoom:last-child{margin-right:0}.svgMap-map-wrapper .svgMap-control-button{background-color:transparent;border:none;border-radius:0;color:inherit;font:inherit;line-height:inherit;margin:0;padding:0;overflow:visible;text-transform:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;width:30px;height:30px;position:relative}.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button:after,.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);background:#666;transition:background-color 250ms}.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button:before{width:11px;height:3px}.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button.svgMap-zoom-reset-button::before{width:11px;height:11px;background:0 0;border:2px solid #666}@media (hover:hover){.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button:hover:after,.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button:hover:before{background:#111}}.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button:active:after,.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button:active:before{background:#111}.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button.svgMap-disabled:after,.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button.svgMap-disabled:before{background:#ccc}.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-button.svgMap-zoom-reset-button.svgMap-disabled:before{border:2px solid #ccc;background:0 0}.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-in-button{margin:1px 0 1px 1px}.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-in-button:after{width:3px;height:11px}.svgMap-map-wrapper .svgMap-control-button.svgMap-zoom-out-button{margin:1px 1px 1px 0}.svgMap-map-wrapper .svgMap-map-continent-controls-wrapper{position:absolute;top:10px;right:10px;z-index:1;display:flex;border-radius:2px;box-shadow:0 0 0 2px rgba(0,0,0,.1)}.svgMap-map-wrapper .svgMap-country{stroke:#fff;stroke-width:1;stroke-linejoin:round;vector-effect:non-scaling-stroke;transition:fill 250ms,stroke 250ms}.svgMap-map-wrapper .svgMap-country[data-link]{cursor:pointer}@media (hover:hover){.svgMap-map-wrapper .svgMap-country:hover{stroke:#333;stroke-width:1.5}}.svgMap-map-wrapper .svgMap-country.svgMap-active{stroke:#333;stroke-width:1.5}.svgMap-tooltip{box-shadow:0 0 3px rgba(0,0,0,.2);position:absolute;z-index:2;border-radius:2px;background:#fff;transform:translate(-50%,-100%);border-bottom:1px solid #000;display:none;pointer-events:none;min-width:60px}.svgMap-tooltip.svgMap-tooltip-flipped{transform:translate(-50%,0);border-bottom:0;border-top:1px solid #000}.svgMap-tooltip.svgMap-active{display:block}.svgMap-tooltip .svgMap-tooltip-content-container{position:relative;padding:10px 20px}.svgMap-tooltip .svgMap-tooltip-content-container .svgMap-tooltip-flag-container{text-align:center;margin:2px 0 5px}.svgMap-tooltip .svgMap-tooltip-content-container .svgMap-tooltip-flag-container.svgMap-tooltip-flag-container-emoji{font-size:50px;line-height:0;padding:25px 0 15px}.svgMap-tooltip .svgMap-tooltip-content-container .svgMap-tooltip-flag-container .svgMap-tooltip-flag{display:block;margin:auto;width:auto;height:32px;padding:2px;background:rgba(0,0,0,.15);border-radius:2px}.svgMap-tooltip .svgMap-tooltip-title{white-space:nowrap;font-size:18px;line-height:28px;padding:0 0 8px;text-align:center}.svgMap-tooltip .svgMap-tooltip-content{white-space:nowrap;text-align:center;font-size:14px;color:#777;margin:-5px 0 0}.svgMap-tooltip .svgMap-tooltip-content table{padding:0;border-spacing:0;margin:auto}.svgMap-tooltip .svgMap-tooltip-content table td{padding:2px 0;text-align:left}.svgMap-tooltip .svgMap-tooltip-content table td span{color:#111}.svgMap-tooltip .svgMap-tooltip-content table td:first-child{padding-right:10px;text-align:right}.svgMap-tooltip .svgMap-tooltip-content table td sup{vertical-align:baseline;position:relative;top:-5px}.svgMap-tooltip .svgMap-tooltip-content .svgMap-tooltip-no-data{padding:2px 0;color:#777;font-style:italic}.svgMap-tooltip .svgMap-tooltip-pointer{position:absolute;top:100%;left:50%;transform:translateX(-50%);overflow:hidden;height:10px;width:30px}.svgMap-tooltip .svgMap-tooltip-pointer:after{content:"";width:20px;height:20px;background:#fff;border:1px solid #000;position:absolute;bottom:6px;left:50%;transform:translateX(-50%) rotate(45deg)}.svgMap-tooltip.svgMap-tooltip-flipped .svgMap-tooltip-pointer{bottom:auto;top:-10px;transform:translateX(-50%) scaleY(-1)}