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