svgmap 2.6.0 → 2.7.2

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "svgmap",
3
3
  "description": "svgMap is a JavaScript library that lets you easily create an interactable world map comparing customizable data for each country.",
4
- "version": "2.6.0",
4
+ "version": "2.7.2",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "main": "dist/svgMap.min.js",
@@ -23,8 +23,8 @@
23
23
  "gulp-sass": "^5.0.0",
24
24
  "gulp-sourcemaps": "^3.0.0",
25
25
  "gulp-uglify": "^3.0.2",
26
- "jest": "^27.0.6",
27
- "sass": "^1.36.0"
26
+ "jest": "^27.1.0",
27
+ "sass": "^1.38.1"
28
28
  },
29
29
  "dependencies": {
30
30
  "svg-pan-zoom": "^3.6.1"
package/src/js/svgMap.js CHANGED
@@ -30,6 +30,15 @@ function svgMapWrapper(svgPanZoom) {
30
30
  // Zoom with mousewheel
31
31
  mouseWheelZoomEnabled: true,
32
32
 
33
+ // Allow zooming only when one of the following keys is pressed: 'shift', 'control', 'alt' (Windows), 'command' (MacOS), 'option' (MacOS)
34
+ mouseWheelZoomWithKey: false,
35
+
36
+ // The message to show for non MacOS systems
37
+ mouseWheelKeyMessage: 'Press the [ALT] key to zoom',
38
+
39
+ // The message to show for MacOS
40
+ mouseWheelKeyMessageMac: 'Press the [COMMAND] key to zoom',
41
+
33
42
  // Data colors
34
43
  colorMax: '#CC0033',
35
44
  colorMin: '#FFE5D9',
@@ -62,7 +71,10 @@ function svgMapWrapper(svgPanZoom) {
62
71
  // Country specific options
63
72
  countries: {
64
73
  // Western Sahara: Set to false to combine Morocco (MA) and Western Sahara (EH)
65
- EH: true
74
+ EH: true,
75
+
76
+ // Crimea: Set to 'RU' to make the Crimea part of Russia, by default it is part of the Ukraine
77
+ Crimea: 'UA'
66
78
  }
67
79
  };
68
80
 
@@ -84,8 +96,28 @@ function svgMapWrapper(svgPanZoom) {
84
96
  // Global id
85
97
  this.id = this.options.targetElementID;
86
98
 
87
- // Cache wrapper element
99
+ // Wrapper element
88
100
  this.wrapper = document.getElementById(this.options.targetElementID);
101
+ this.wrapper.classList.add('svgMap-wrapper');
102
+
103
+ // Container element
104
+ this.container = document.createElement('div');
105
+ this.container.classList.add('svgMap-container');
106
+ this.wrapper.appendChild(this.container);
107
+
108
+ // Block scrolling when option is enabled
109
+ if (
110
+ this.options.mouseWheelZoomEnabled &&
111
+ this.options.mouseWheelZoomWithKey
112
+ ) {
113
+ this.addMouseWheelZoomNotice();
114
+ this.addMouseWheelZoomWithKeyEvents();
115
+ }
116
+
117
+ // Map container element
118
+ this.mapContainer = document.createElement('div');
119
+ this.mapContainer.classList.add('svgMap-map-container');
120
+ this.container.appendChild(this.mapContainer);
89
121
 
90
122
  // Create the map
91
123
  this.createMap();
@@ -377,8 +409,8 @@ function svgMapWrapper(svgPanZoom) {
377
409
  element.setAttribute('fill', this.options.colorNoData);
378
410
  return;
379
411
  }
380
- if (typeof(data.values[countryID][this.options.manualColorAttribute]) != "undefined") {
381
- element.setAttribute('fill', data.values[countryID][this.options.manualColorAttribute]);
412
+ if (typeof data.values[countryID].color != 'undefined') {
413
+ element.setAttribute('fill', data.values[countryID].color);
382
414
  return;
383
415
  }
384
416
  var value = Math.max(
@@ -656,7 +688,7 @@ function svgMapWrapper(svgPanZoom) {
656
688
  this.mapWrapper = this.createElement(
657
689
  'div',
658
690
  'svgMap-map-wrapper',
659
- this.wrapper
691
+ this.mapContainer
660
692
  );
661
693
  this.mapImage = document.createElementNS(
662
694
  'http://www.w3.org/2000/svg',
@@ -712,6 +744,19 @@ function svgMapWrapper(svgPanZoom) {
712
744
  }
713
745
  delete mapPaths['MA-EH'];
714
746
 
747
+ if (this.options.countries.Crimea === 'RU') {
748
+ mapPaths.RU.d = mapPaths['RU-WITH-CRIMEA'].d;
749
+ mapPaths.UA.d = mapPaths['UA-WITHOUT-CRIMEA'].d;
750
+ }
751
+ delete mapPaths['RU-WITH-CRIMEA'];
752
+ delete mapPaths['UA-WITHOUT-CRIMEA'];
753
+
754
+ // Expose tooltipMove function
755
+
756
+ this.tooltipMoveEvent = function (e) {
757
+ this.moveTooltip(e);
758
+ }.bind(this);
759
+
715
760
  // Add map elements
716
761
  Object.keys(mapPaths).forEach(
717
762
  function (countryID) {
@@ -735,23 +780,14 @@ function svgMapWrapper(svgPanZoom) {
735
780
 
736
781
  this.mapImage.appendChild(countryElement);
737
782
 
738
- ['mouseenter', 'touchdown'].forEach(
739
- function (event) {
740
- countryElement.addEventListener(
741
- event,
742
- function () {
743
- countryElement.closest('g').appendChild(countryElement);
744
- }.bind(this),
745
- { passive: true }
746
- );
747
- }.bind(this)
748
- );
749
-
750
783
  // Tooltip events
751
784
  // Add tooltip when touch is used
752
785
  countryElement.addEventListener(
753
786
  'touchstart',
754
787
  function (e) {
788
+ countryElement.parentNode.appendChild(countryElement);
789
+ countryElement.classList.add('svgMap-active');
790
+
755
791
  var countryID = countryElement.getAttribute('data-id');
756
792
  var countryLink = countryElement.getAttribute('data-link');
757
793
  if (this.options.touchLink) {
@@ -763,6 +799,14 @@ function svgMapWrapper(svgPanZoom) {
763
799
  this.setTooltipContent(this.getTooltipContent(countryID));
764
800
  this.showTooltip(e);
765
801
  this.moveTooltip(e);
802
+
803
+ countryElement.addEventListener(
804
+ 'touchmove',
805
+ this.tooltipMoveEvent,
806
+ {
807
+ passive: true
808
+ }
809
+ );
766
810
  }.bind(this),
767
811
  { passive: true }
768
812
  );
@@ -770,17 +814,17 @@ function svgMapWrapper(svgPanZoom) {
770
814
  countryElement.addEventListener(
771
815
  'mouseenter',
772
816
  function (e) {
817
+ countryElement.parentNode.appendChild(countryElement);
773
818
  var countryID = countryElement.getAttribute('data-id');
774
819
  this.setTooltipContent(this.getTooltipContent(countryID));
775
820
  this.showTooltip(e);
776
- }.bind(this),
777
- { passive: true }
778
- );
779
-
780
- countryElement.addEventListener(
781
- 'mousemove',
782
- function (e) {
783
- this.moveTooltip(e);
821
+ countryElement.addEventListener(
822
+ 'mousemove',
823
+ this.tooltipMoveEvent,
824
+ {
825
+ passive: true
826
+ }
827
+ );
784
828
  }.bind(this),
785
829
  { passive: true }
786
830
  );
@@ -800,7 +844,17 @@ function svgMapWrapper(svgPanZoom) {
800
844
  this.options.data.values[countryID]['linkTarget']
801
845
  );
802
846
  }
803
- countryElement.addEventListener('click', function (e) {
847
+
848
+ let dragged = false;
849
+ countryElement.addEventListener('mousedown', function(){dragged = false});
850
+ countryElement.addEventListener('touchstart', function(){dragged = false});
851
+ countryElement.addEventListener('mousemove', function(){dragged = true});
852
+ countryElement.addEventListener('touchmove', function(){dragged = true});
853
+ const clickHandler = function (e) {
854
+ if (dragged) {
855
+ return;
856
+ }
857
+
804
858
  const link = countryElement.getAttribute('data-link');
805
859
  const target = countryElement.getAttribute('data-link-target');
806
860
 
@@ -809,20 +863,41 @@ function svgMapWrapper(svgPanZoom) {
809
863
  } else {
810
864
  window.location.href = link;
811
865
  }
812
- });
866
+ }
867
+
868
+ countryElement.addEventListener('click', clickHandler);
869
+ countryElement.addEventListener('touchend', clickHandler);
813
870
  }
814
871
 
815
- // Hide tooltip when event is mouseleave or touchend
816
- ['mouseleave', 'touchend'].forEach(
817
- function (event) {
818
- countryElement.addEventListener(
819
- event,
820
- function () {
821
- this.hideTooltip();
822
- }.bind(this),
872
+ // Hide tooltip when mouse leaves the country area
873
+ countryElement.addEventListener(
874
+ 'mouseleave',
875
+ function () {
876
+ this.hideTooltip();
877
+ countryElement.removeEventListener(
878
+ 'mousemove',
879
+ this.tooltipMoveEvent,
880
+ {
881
+ passive: true
882
+ }
883
+ );
884
+ }.bind(this),
885
+ { passive: true }
886
+ );
887
+
888
+ // Hide tooltip when touch ends
889
+ countryElement.addEventListener(
890
+ 'touchend',
891
+ function () {
892
+ this.hideTooltip();
893
+ countryElement.classList.remove('svgMap-active');
894
+ countryElement.removeEventListener(
895
+ 'touchmove',
896
+ this.tooltipMoveEvent,
823
897
  { passive: true }
824
898
  );
825
- }.bind(this)
899
+ }.bind(this),
900
+ { passive: true }
826
901
  );
827
902
  }.bind(this)
828
903
  );
@@ -839,7 +914,8 @@ function svgMapWrapper(svgPanZoom) {
839
914
  maxZoom: this.options.maxZoom,
840
915
  zoomScaleSensitivity: this.options.zoomScaleSensitivity,
841
916
  controlIconsEnabled: false,
842
- mouseWheelZoomEnabled: this.options.mouseWheelZoomEnabled, // TODO Only with key pressed
917
+ mouseWheelZoomEnabled: this.options.mouseWheelZoomEnabled,
918
+ preventMouseEventsDefault: true,
843
919
  onZoom: function () {
844
920
  me.setControlStatuses();
845
921
  },
@@ -995,6 +1071,126 @@ function svgMapWrapper(svgPanZoom) {
995
1071
  this.mapPanZoom[direction == 'in' ? 'zoomIn' : 'zoomOut']();
996
1072
  };
997
1073
 
1074
+ // Add elements to show the zoom with keys notice
1075
+
1076
+ svgMap.prototype.addMouseWheelZoomNotice = function () {
1077
+ var noticeWrapper = document.createElement('div');
1078
+ noticeWrapper.classList.add('svgMap-block-zoom-notice');
1079
+
1080
+ var noticeContainer = document.createElement('div');
1081
+ noticeContainer.innerHTML =
1082
+ navigator.appVersion.indexOf('Mac') != -1
1083
+ ? this.options.mouseWheelKeyMessageMac
1084
+ : this.options.mouseWheelKeyMessage;
1085
+
1086
+ noticeWrapper.append(noticeContainer);
1087
+ this.wrapper.append(noticeWrapper);
1088
+ };
1089
+
1090
+ // Show the zoom with keys notice
1091
+
1092
+ svgMap.prototype.showMouseWheelZoomNotice = function (duration) {
1093
+ if (this.mouseWheelNoticeJustHidden) {
1094
+ return;
1095
+ }
1096
+
1097
+ this.autoHideMouseWheelNoticeTimeout &&
1098
+ clearTimeout(this.autoHideMouseWheelNoticeTimeout);
1099
+ this.autoHideMouseWheelNoticeTimeout = setTimeout(
1100
+ function () {
1101
+ this.hideMouseWheelZoomNotice();
1102
+ }.bind(this),
1103
+ duration || 2400
1104
+ );
1105
+
1106
+ this.wrapper.classList.add('svgMap-block-zoom-notice-active');
1107
+ };
1108
+
1109
+ // Hide the zoom with keys notice
1110
+
1111
+ svgMap.prototype.hideMouseWheelZoomNotice = function () {
1112
+ this.wrapper.classList.remove('svgMap-block-zoom-notice-active');
1113
+ this.autoHideMouseWheelNoticeTimeout &&
1114
+ clearTimeout(this.autoHideMouseWheelNoticeTimeout);
1115
+ };
1116
+
1117
+ // Block shing the zoom wheel notice for some time
1118
+
1119
+ svgMap.prototype.blockMouseWheelZoomNotice = function (duration) {
1120
+ this.mouseWheelNoticeJustHidden = true;
1121
+ this.mouseWheelNoticeJustHiddenTimeout &&
1122
+ clearTimeout(this.mouseWheelNoticeJustHiddenTimeout);
1123
+ this.mouseWheelNoticeJustHiddenTimeout = setTimeout(
1124
+ function () {
1125
+ this.mouseWheelNoticeJustHidden = false;
1126
+ }.bind(this),
1127
+ duration || 600
1128
+ );
1129
+ };
1130
+
1131
+ // Add the events when you are only allowed to scrool with a key pressed
1132
+
1133
+ svgMap.prototype.addMouseWheelZoomWithKeyEvents = function () {
1134
+ // Add events to wrapper
1135
+ this.wrapper.addEventListener(
1136
+ 'wheel',
1137
+ function (ev) {
1138
+ if (!document.body.classList.contains('svgMap-zoom-key-pressed')) {
1139
+ this.showMouseWheelZoomNotice();
1140
+ } else {
1141
+ this.hideMouseWheelZoomNotice();
1142
+ this.blockMouseWheelZoomNotice();
1143
+ }
1144
+ }.bind(this),
1145
+ {
1146
+ passive: true
1147
+ }
1148
+ );
1149
+
1150
+ // Add with keydown
1151
+ document.addEventListener(
1152
+ 'keydown',
1153
+ function (ev) {
1154
+ if (
1155
+ ev.key == 'Alt' ||
1156
+ ev.key == 'Control' ||
1157
+ ev.key == 'Meta' ||
1158
+ ev.key == 'Shift'
1159
+ ) {
1160
+ document.body.classList.add('svgMap-zoom-key-pressed');
1161
+ this.hideMouseWheelZoomNotice();
1162
+ this.blockMouseWheelZoomNotice();
1163
+ }
1164
+ }.bind(this)
1165
+ );
1166
+
1167
+ // Fallback with wheel as sometimes it wont trigger when window is out of focus
1168
+ this.wrapper.addEventListener('wheel', function (ev) {
1169
+ if (ev.altKey || ev.ctrlKey || ev.metaKey || ev.shiftKey) {
1170
+ document.body.classList.add('svgMap-zoom-key-pressed');
1171
+ // TODO wont be removed when window out of focus
1172
+ }
1173
+ });
1174
+
1175
+ // Only add following events to the document once
1176
+ if (document.body.classList.contains('svgMap-key-events-added')) {
1177
+ return false;
1178
+ }
1179
+ document.body.classList.add('svgMap-key-events-added');
1180
+
1181
+ // Remove with keyup
1182
+ document.addEventListener('keyup', function (ev) {
1183
+ if (
1184
+ ev.key == 'Alt' ||
1185
+ ev.key == 'Control' ||
1186
+ ev.key == 'Meta' ||
1187
+ ev.key == 'Shift'
1188
+ ) {
1189
+ document.body.classList.remove('svgMap-zoom-key-pressed');
1190
+ }
1191
+ });
1192
+ };
1193
+
998
1194
  // Map paths
999
1195
 
1000
1196
  svgMap.prototype.mapPaths = {
@@ -1188,7 +1384,7 @@ function svgMapWrapper(svgPanZoom) {
1188
1384
  d: 'M690.3,902.7l-0.1-0.3l-0.4-0.2l-0.2-0.1l0.1,0.2l0.1,0.3l0.1,0.2l0.2,0.1L690.3,902.7L690.3,902.7z M695.8,901.4 L695.8,901.4l-0.3-0.1l-0.1,0.2l0.2,0.3l0.4,0.1L695.8,901.4L695.8,901.4z M682.9,900l-0.1,0.2l-0.4,0.1l0.2,0.3l0.6,0.4h0.4 l0.1-0.3l-0.1-0.6h-0.3L682.9,900L682.9,900z M685.7,898l-0.9-0.3l-0.4-0.3h-0.3l0.4,0.4l0.1,0.2l0.1,0.2l0.6,0.3l0.6,0.3l0.4,0.3 l-0.1,0.1l-0.8,0.3h-0.3l-0.2,0.1l0.4,0.2l0.6-0.1l0.2-0.1h0.2l0.3,0.1v0.2l-0.1,0.2l-0.2,0.2l-0.4,0.3l-0.6,0.4h-0.8l-0.7,0.7 l0.9,0.5l0.7,0.3h0.9v-0.1l0.2-0.1h0.3l0.1-0.1l0.2-0.4v-0.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.1-0.2L945.1,182.9L945.1,182.9z M947.6,182.4l-0.8-0.2 l-0.6-0.3l-1,0.1l0.7,1.1l0.8,0.7l0.4,0.2v-0.1v-0.2l-0.4-0.5l-0.1-0.1V183l0.1-0.1h0.2l0.3,0.2h0.2L947.6,182.4L947.6,182.4z M948.6,182.2l-0.3-0.2l-0.4-0.4v0.5v0.3v0.1h0.1l0.3,0.1L948.6,182.2L948.6,182.2z'
1387
+ d: 'M947,186.9v-0.3l-0.1-0.3v-0.2h-0.1l-0.5-0.1l-0.1-0.2h-0.1v0.2l0.1,0.4l0.5,0.4L947,186.9L947,186.9L947,186.9zM947.5,184.8v-0.1l-0.2-0.2l-0.5-0.2l-0.2-0.1l-0.2,0.1v0.2l0.1,0.1l0.4,0.1l0.4,0.3h0.1L947.5,184.8L947.5,184.8z M945.1,182.9l-0.2-0.1l-0.5,0.1h-0.3l0.1,0.3l0.6,0.2h0.3h0.3l0.2-0.1l-0.1-0.2L945.1,182.9L945.1,182.9z M947.6,182.4l-0.8-0.2l-0.6-0.3l-1,0.1l0.7,1.1l0.8,0.7l0.4,0.2v-0.1v-0.2l-0.4-0.5l-0.1-0.1V183l0.1-0.1h0.2l0.3,0.2h0.2L947.6,182.4L947.6,182.4z M948.6,182.2l-0.3-0.2l-0.4-0.4v0.5v0.3v0.1h0.1l0.3,0.1L948.6,182.2L948.6,182.2z'
1192
1388
  },
1193
1389
  'FJ': {
1194
1390
  d: 'M1976.7,674.4l-3.7,2l-1.9,0.3l-3.1,1.3l0.2,2.4l3.9-1.3l3.9-1.6L1976.7,674.4L1976.7,674.4z M1965.7,682.5l-1.6,1 l-2.3-0.8l-2.7,2.2l-0.2,2.8l2.9,0.8l3.6-0.9l1.8-3.3L1965.7,682.5L1965.7,682.5z'
@@ -1640,8 +1836,17 @@ function svgMapWrapper(svgPanZoom) {
1640
1836
  'ZW': {
1641
1837
  d: 'M1148.2,713.7l6.2-7.2l1.6-4.6l0.9-0.6l0.8-3.7l-0.8-1.9l0.5-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2.4l11.3-2.4l1.3-1.5l-4.2-1.9l-6.6,0.6l-4.9,1.8l-11.7,0.9l-10.1,3.1l-6.8,2.7l2.5,2.2l-6.6,4.4l3.9,0.7l-5.4,4.3l1.6,2.8l-3.4,1.1l1.9,2.8l7.9,1.4l2.2,2.3l13.4,0.7L1207.1,135.6L1207.1,135.6z M1521.1,110.9l-17.9-2.6l-10.2-0.2l-3.4,0.9l3.4,3.4l12.4,3.2l4.5-1.2l14.2,0.2C1524.1,114.6,1521.1,110.9,1521.1,110.9z M1546.3,113.2l-11.7-1.3l-8.2-0.7l1.7,1.6l10.3,2l6.8,0.4L1546.3,113.2L1546.3,113.2z M1533.8,122.7l-2.5-1.4l-8.3-1.9l-4.1,0.5l-0.8,2l1.1,0.2l8.8,0.6C1528,122.7,1533.8,122.7,1533.8,122.7z M1696.4,135l-6-3.6l-1.4,2.2l3.5,1.6L1696.4,135z M1084,228.9l-0.6-1.5l0.2-1.7l-2.2-0.9l-5-1.1l-6.3,2l-0.7,2.6l5.9,0.7L1084,228.9z M1673.7,250.7l-7.2-6.2l-5.1-6l-6.8-5.8l-4.9-4l-1.3,0.8l4.4,2.8l-1.9,2.8l6.8,8.3l7.8,6l6.4,8.3l2.4,4.6l5.5,6.8l3.8,6l4.6,5.2l-0.1-4.8l6.5,3.8l-3-4.4l-9.5-6.3l-3.7-9l8.9,2L1673.7,250.7L1673.7,250.7z'
1847
+ },
1848
+ 'UA-WITHOUT-CRIMEA': {
1849
+ d: 'M1138.5,241l-4.8,0.5l-1.5-0.3l-1,1.4l-1.8-0.2l0,0l-4.1,0.3l-1.2,1.4l0.2,3.1l-2-0.6l-4.3,0.3l-1.5-1.5l-1.6,1.1l-2-0.9l-3.8-0.1l-5.6-1.5l-5-0.5l-3.7,0.2l-2.4,1.6l-2.2,0.3l3.1,5.3l-0.3,1.8l-2.3,0.7l-3.8,5.1l1.6,2.8l-1.1-0.4l-1.1,1.7l-0.7,2.5l2.9,1.7l0.6,1.6l1.9-1.3l3.2,0.7h3.2l2.4,1.5l1.6-0.9l3.6-0.6l1-1.5h2.1l1.1-0.9l3.2-0.6l3.9,1.9l2,0.3l2.5,1.6v2.1l1.9,1.1l1.1,2.6l2,1.5l-0.2,1l1,0.6l-1.2,0.5l-3-0.2l-0.6-0.9l-1,0.5l0.5,1.1l-1.1,2l-0.5,2.1l-1.2,0.7l2.4,1.1l2.2-1l2.4,1.1l3.3-4.6l1.3-3.4l4.5-0.8l0.7,2.4l8,1.5l1.7,1.4l7.4,1.3l-1-3.9l3.9-2.3l4.6-0.3l3-2l3.9-0.5l-0.4-2.8l2.2-1.7l4.7-0.5l0.3-2.1l-1.8-3.4l1.3-3.2l-0.4-1.9l-7.6-2l-2.9,0.1l-3.6-2.9l-3.5,1l-6.6-2.2l-0.2-1.2l-2.2-2.7l-4.7-2.1l0.9-1.3L1138.5,241L1138.5,241z'
1645
1850
  }
1646
1851
  };
1647
1852
 
package/src/scss/map.scss CHANGED
@@ -1,3 +1,43 @@
1
+ .svgMap-wrapper,
2
+ .svgMap-container {
3
+ position: relative;
4
+ }
5
+
6
+ .svgMap-block-zoom-notice {
7
+ position: absolute;
8
+ z-index: 2;
9
+ top: 100%;
10
+ left: 0;
11
+ right: 0;
12
+ bottom: 0;
13
+ background: rgba(0, 0, 0, 0.8);
14
+ pointer-events: none;
15
+ opacity: 0;
16
+ color: #fff;
17
+ transition: opacity 250ms;
18
+
19
+ .svgMap-block-zoom-notice-active & {
20
+ pointer-events: all;
21
+ top: 0;
22
+ opacity: 1;
23
+ }
24
+
25
+ > div {
26
+ position: absolute;
27
+ top: 50%;
28
+ left: 0;
29
+ right: 0;
30
+ text-align: center;
31
+ padding: 0 32px;
32
+ transform: translateY(-50%);
33
+ font-size: 28px;
34
+
35
+ @media (max-width: 900px) {
36
+ font-size: 22px;
37
+ }
38
+ }
39
+ }
40
+
1
41
  .svgMap-map-wrapper {
2
42
  position: relative;
3
43
  width: 100%;
@@ -77,7 +117,7 @@
77
117
  left: 50%;
78
118
  transform: translate(-50%, -50%);
79
119
  background: #666;
80
- transition: background-color 0.2s;
120
+ transition: background-color 250ms;
81
121
  }
82
122
 
83
123
  &:before {
@@ -85,7 +125,16 @@
85
125
  height: 3px;
86
126
  }
87
127
 
88
- &:hover {
128
+ @media (hover: hover) {
129
+ &:hover {
130
+ &:before,
131
+ &:after {
132
+ background: $textColor;
133
+ }
134
+ }
135
+ }
136
+
137
+ &:active {
89
138
  &:before,
90
139
  &:after {
91
140
  background: $textColor;
@@ -121,18 +170,21 @@
121
170
  stroke-width: 1;
122
171
  stroke-linejoin: round;
123
172
  vector-effect: non-scaling-stroke;
124
- transition: fill 0.2s, stroke 0.2s;
173
+ transition: fill 250ms, stroke 250ms;
125
174
 
126
175
  &[data-link] {
127
176
  cursor: pointer;
128
177
  }
129
178
 
130
- &:hover,
131
- &.svgMap-active {
132
- stroke: $mapActiveStrokeColor;
179
+ @media (hover: hover) {
180
+ &:hover {
181
+ stroke: $mapActiveStrokeColor;
182
+ stroke-width: $mapActiveStrokeWidth;
183
+ }
133
184
  }
134
185
 
135
186
  &.svgMap-active {
187
+ stroke: $mapActiveStrokeColor;
136
188
  stroke-width: $mapActiveStrokeWidth;
137
189
  }
138
190
  }