Commit c96b66cae9e398aeaff1711c132c5b4c2e8fb2c4

Authored by Sergey Tarnavskiy
1 parent d35d302a

Added 'Disable scroll zooming' setting for all map types

... ... @@ -5239,14 +5239,12 @@
5239 5239 "balanced-match": {
5240 5240 "version": "1.0.0",
5241 5241 "bundled": true,
5242   - "dev": true,
5243   - "optional": true
  5242 + "dev": true
5244 5243 },
5245 5244 "brace-expansion": {
5246 5245 "version": "1.1.11",
5247 5246 "bundled": true,
5248 5247 "dev": true,
5249   - "optional": true,
5250 5248 "requires": {
5251 5249 "balanced-match": "^1.0.0",
5252 5250 "concat-map": "0.0.1"
... ... @@ -5261,20 +5259,17 @@
5261 5259 "code-point-at": {
5262 5260 "version": "1.1.0",
5263 5261 "bundled": true,
5264   - "dev": true,
5265   - "optional": true
  5262 + "dev": true
5266 5263 },
5267 5264 "concat-map": {
5268 5265 "version": "0.0.1",
5269 5266 "bundled": true,
5270   - "dev": true,
5271   - "optional": true
  5267 + "dev": true
5272 5268 },
5273 5269 "console-control-strings": {
5274 5270 "version": "1.1.0",
5275 5271 "bundled": true,
5276   - "dev": true,
5277   - "optional": true
  5272 + "dev": true
5278 5273 },
5279 5274 "core-util-is": {
5280 5275 "version": "1.0.2",
... ... @@ -5391,8 +5386,7 @@
5391 5386 "inherits": {
5392 5387 "version": "2.0.3",
5393 5388 "bundled": true,
5394   - "dev": true,
5395   - "optional": true
  5389 + "dev": true
5396 5390 },
5397 5391 "ini": {
5398 5392 "version": "1.3.5",
... ... @@ -5404,7 +5398,6 @@
5404 5398 "version": "1.0.0",
5405 5399 "bundled": true,
5406 5400 "dev": true,
5407   - "optional": true,
5408 5401 "requires": {
5409 5402 "number-is-nan": "^1.0.0"
5410 5403 }
... ... @@ -5419,7 +5412,6 @@
5419 5412 "version": "3.0.4",
5420 5413 "bundled": true,
5421 5414 "dev": true,
5422   - "optional": true,
5423 5415 "requires": {
5424 5416 "brace-expansion": "^1.1.7"
5425 5417 }
... ... @@ -5427,14 +5419,12 @@
5427 5419 "minimist": {
5428 5420 "version": "0.0.8",
5429 5421 "bundled": true,
5430   - "dev": true,
5431   - "optional": true
  5422 + "dev": true
5432 5423 },
5433 5424 "minipass": {
5434 5425 "version": "2.2.4",
5435 5426 "bundled": true,
5436 5427 "dev": true,
5437   - "optional": true,
5438 5428 "requires": {
5439 5429 "safe-buffer": "^5.1.1",
5440 5430 "yallist": "^3.0.0"
... ... @@ -5453,7 +5443,6 @@
5453 5443 "version": "0.5.1",
5454 5444 "bundled": true,
5455 5445 "dev": true,
5456   - "optional": true,
5457 5446 "requires": {
5458 5447 "minimist": "0.0.8"
5459 5448 }
... ... @@ -5534,8 +5523,7 @@
5534 5523 "number-is-nan": {
5535 5524 "version": "1.0.1",
5536 5525 "bundled": true,
5537   - "dev": true,
5538   - "optional": true
  5526 + "dev": true
5539 5527 },
5540 5528 "object-assign": {
5541 5529 "version": "4.1.1",
... ... @@ -5547,7 +5535,6 @@
5547 5535 "version": "1.4.0",
5548 5536 "bundled": true,
5549 5537 "dev": true,
5550   - "optional": true,
5551 5538 "requires": {
5552 5539 "wrappy": "1"
5553 5540 }
... ... @@ -5669,7 +5656,6 @@
5669 5656 "version": "1.0.2",
5670 5657 "bundled": true,
5671 5658 "dev": true,
5672   - "optional": true,
5673 5659 "requires": {
5674 5660 "code-point-at": "^1.0.0",
5675 5661 "is-fullwidth-code-point": "^1.0.0",
... ...
... ... @@ -19,7 +19,7 @@ var gmGlobals = {
19 19 }
20 20
21 21 export default class TbGoogleMap {
22   - constructor($containerElement, utils, initCallback, defaultZoomLevel, dontFitMapBounds, minZoomLevel, gmApiKey, gmDefaultMapType) {
  22 + constructor($containerElement, utils, initCallback, defaultZoomLevel, dontFitMapBounds, disableScrollZooming, minZoomLevel, gmApiKey, gmDefaultMapType) {
23 23
24 24 var tbMap = this;
25 25 this.utils = utils;
... ... @@ -44,7 +44,7 @@ export default class TbGoogleMap {
44 44 function initGoogleMap() {
45 45
46 46 tbMap.map = new google.maps.Map($containerElement[0], { // eslint-disable-line no-undef
47   - scrollwheel: true,
  47 + scrollwheel: !disableScrollZooming,
48 48 mapTypeId: getGoogleMapTypeId(tbMap.defaultMapType),
49 49 zoom: tbMap.defaultZoomLevel || 8
50 50 });
... ...
... ... @@ -20,7 +20,7 @@ const maxZoom = 4;
20 20
21 21 export default class TbImageMap {
22 22
23   - constructor(ctx, $containerElement, utils, initCallback, imageUrl, posFunction, imageEntityAlias, imageUrlAttribute) {
  23 + constructor(ctx, $containerElement, utils, initCallback, imageUrl, disableScrollZooming, posFunction, imageEntityAlias, imageUrlAttribute) {
24 24
25 25 this.ctx = ctx;
26 26 this.utils = utils;
... ... @@ -34,6 +34,7 @@ export default class TbImageMap {
34 34 this.height = 0;
35 35 this.markers = [];
36 36 this.initCallback = initCallback;
  37 + this.disableScrollZooming = disableScrollZooming;
37 38
38 39 if (angular.isDefined(posFunction) && posFunction.length > 0) {
39 40 try {
... ... @@ -165,6 +166,7 @@ export default class TbImageMap {
165 166 this.map = L.map(this.$containerElement[0], {
166 167 minZoom: 1,
167 168 maxZoom: maxZoom,
  169 + scrollWheelZoom: !this.disableScrollZooming,
168 170 center: center,
169 171 zoom: 1,
170 172 crs: L.CRS.Simple,
... ...
... ... @@ -79,17 +79,18 @@ export default class TbMapWidgetV2 {
79 79 });
80 80
81 81 if (mapProvider === 'google-map') {
82   - this.map = new TbGoogleMap($element, this.utils, initCallback, this.defaultZoomLevel, this.dontFitMapBounds, minZoomLevel, settings.gmApiKey, settings.gmDefaultMapType);
  82 + this.map = new TbGoogleMap($element, this.utils, initCallback, this.defaultZoomLevel, this.dontFitMapBounds, settings.disableScrollZooming, minZoomLevel, settings.gmApiKey, settings.gmDefaultMapType);
83 83 } else if (mapProvider === 'openstreet-map') {
84   - this.map = new TbOpenStreetMap($element, this.utils, initCallback, this.defaultZoomLevel, this.dontFitMapBounds, minZoomLevel, settings.mapProvider);
  84 + this.map = new TbOpenStreetMap($element, this.utils, initCallback, this.defaultZoomLevel, this.dontFitMapBounds, settings.disableScrollZooming, minZoomLevel, settings.mapProvider);
85 85 } else if (mapProvider === 'image-map') {
86 86 this.map = new TbImageMap(this.ctx, $element, this.utils, initCallback,
87 87 settings.mapImageUrl,
  88 + settings.disableScrollZooming,
88 89 settings.posFunction,
89 90 settings.imageEntityAlias,
90 91 settings.imageUrlAttribute);
91 92 } else if (mapProvider === 'tencent-map') {
92   - this.map = new TbTencentMap($element, this.utils, initCallback, this.defaultZoomLevel, this.dontFitMapBounds, minZoomLevel, settings.tmApiKey, settings.tmDefaultMapType);
  93 + this.map = new TbTencentMap($element, this.utils, initCallback, this.defaultZoomLevel, this.dontFitMapBounds, settings.disableScrollZooming, minZoomLevel, settings.tmApiKey, settings.tmDefaultMapType);
93 94 }
94 95
95 96
... ... @@ -858,6 +859,11 @@ const commonMapSettingsSchema =
858 859 "type": "boolean",
859 860 "default": true
860 861 },
  862 + "disableScrollZooming": {
  863 + "title": "Disable scroll zooming",
  864 + "type": "boolean",
  865 + "default": false
  866 + },
861 867 "latKeyName": {
862 868 "title": "Latitude key name",
863 869 "type": "string",
... ... @@ -998,6 +1004,7 @@ const commonMapSettingsSchema =
998 1004 "form": [
999 1005 "defaultZoomLevel",
1000 1006 "fitMapBounds",
  1007 + "disableScrollZooming",
1001 1008 "latKeyName",
1002 1009 "lngKeyName",
1003 1010 "showLabel",
... ... @@ -1109,6 +1116,11 @@ const imageMapSettingsSchema =
1109 1116 "type": "string",
1110 1117 "default": ""
1111 1118 },
  1119 + "disableScrollZooming": {
  1120 + "title": "Disable scroll zooming",
  1121 + "type": "boolean",
  1122 + "default": false
  1123 + },
1112 1124 "xPosKeyName": {
1113 1125 "title": "X position key name",
1114 1126 "type": "string",
... ... @@ -1226,6 +1238,7 @@ const imageMapSettingsSchema =
1226 1238 },
1227 1239 "imageEntityAlias",
1228 1240 "imageUrlAttribute",
  1241 + "disableScrollZooming",
1229 1242 "xPosKeyName",
1230 1243 "yPosKeyName",
1231 1244 "showLabel",
... ...
... ... @@ -19,7 +19,7 @@ import 'leaflet-providers';
19 19
20 20 export default class TbOpenStreetMap {
21 21
22   - constructor($containerElement, utils, initCallback, defaultZoomLevel, dontFitMapBounds, minZoomLevel, mapProvider) {
  22 + constructor($containerElement, utils, initCallback, defaultZoomLevel, dontFitMapBounds, disableScrollZooming, minZoomLevel, mapProvider) {
23 23
24 24 this.utils = utils;
25 25 this.defaultZoomLevel = defaultZoomLevel;
... ... @@ -33,6 +33,10 @@ export default class TbOpenStreetMap {
33 33
34 34 this.map = L.map($containerElement[0]).setView([0, 0], this.defaultZoomLevel || 8);
35 35
  36 + if (disableScrollZooming) {
  37 + this.map.scrollWheelZoom.disable();
  38 + }
  39 +
36 40 var tileLayer = L.tileLayer.provider(mapProvider);
37 41
38 42 tileLayer.addTo(this.map);
... ...
... ... @@ -19,7 +19,7 @@ var tmGlobals = {
19 19 }
20 20
21 21 export default class TbTencentMap {
22   - constructor($containerElement, utils, initCallback, defaultZoomLevel, dontFitMapBounds, minZoomLevel, tmApiKey, tmDefaultMapType) {
  22 + constructor($containerElement, utils, initCallback, defaultZoomLevel, dontFitMapBounds, disableScrollZooming, minZoomLevel, tmApiKey, tmDefaultMapType) {
23 23 var tbMap = this;
24 24 this.utils = utils;
25 25 this.defaultZoomLevel = defaultZoomLevel;
... ... @@ -42,7 +42,7 @@ export default class TbTencentMap {
42 42
43 43 function initTencentMap() {
44 44 tbMap.map = new qq.maps.Map($containerElement[0], { // eslint-disable-line no-undef
45   - scrollwheel: true,
  45 + scrollwheel: !disableScrollZooming,
46 46 mapTypeId: getTencentMapTypeId(tbMap.defaultMapType),
47 47 zoom: tbMap.defaultZoomLevel || 8
48 48 });
... ...