Browse Source

Added 'Disable scroll zooming' setting for all map types

pull/1633/head
Sergey Tarnavskiy 8 years ago
parent
commit
c96b66cae9
  1. 28
      ui/package-lock.json
  2. 4
      ui/src/app/widget/lib/google-map.js
  3. 4
      ui/src/app/widget/lib/image-map.js
  4. 19
      ui/src/app/widget/lib/map-widget2.js
  5. 6
      ui/src/app/widget/lib/openstreet-map.js
  6. 4
      ui/src/app/widget/lib/tencent-map.js

28
ui/package-lock.json

@ -5239,14 +5239,12 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -5261,20 +5259,17 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"core-util-is": {
"version": "1.0.2",
@ -5391,8 +5386,7 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"ini": {
"version": "1.3.5",
@ -5404,7 +5398,6 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -5419,7 +5412,6 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -5427,14 +5419,12 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"minipass": {
"version": "2.2.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.1",
"yallist": "^3.0.0"
@ -5453,7 +5443,6 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -5534,8 +5523,7 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"object-assign": {
"version": "4.1.1",
@ -5547,7 +5535,6 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -5669,7 +5656,6 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",

4
ui/src/app/widget/lib/google-map.js

@ -19,7 +19,7 @@ var gmGlobals = {
}
export default class TbGoogleMap {
constructor($containerElement, utils, initCallback, defaultZoomLevel, dontFitMapBounds, minZoomLevel, gmApiKey, gmDefaultMapType) {
constructor($containerElement, utils, initCallback, defaultZoomLevel, dontFitMapBounds, disableScrollZooming, minZoomLevel, gmApiKey, gmDefaultMapType) {
var tbMap = this;
this.utils = utils;
@ -44,7 +44,7 @@ export default class TbGoogleMap {
function initGoogleMap() {
tbMap.map = new google.maps.Map($containerElement[0], { // eslint-disable-line no-undef
scrollwheel: true,
scrollwheel: !disableScrollZooming,
mapTypeId: getGoogleMapTypeId(tbMap.defaultMapType),
zoom: tbMap.defaultZoomLevel || 8
});

4
ui/src/app/widget/lib/image-map.js

@ -20,7 +20,7 @@ const maxZoom = 4;
export default class TbImageMap {
constructor(ctx, $containerElement, utils, initCallback, imageUrl, posFunction, imageEntityAlias, imageUrlAttribute) {
constructor(ctx, $containerElement, utils, initCallback, imageUrl, disableScrollZooming, posFunction, imageEntityAlias, imageUrlAttribute) {
this.ctx = ctx;
this.utils = utils;
@ -34,6 +34,7 @@ export default class TbImageMap {
this.height = 0;
this.markers = [];
this.initCallback = initCallback;
this.disableScrollZooming = disableScrollZooming;
if (angular.isDefined(posFunction) && posFunction.length > 0) {
try {
@ -165,6 +166,7 @@ export default class TbImageMap {
this.map = L.map(this.$containerElement[0], {
minZoom: 1,
maxZoom: maxZoom,
scrollWheelZoom: !this.disableScrollZooming,
center: center,
zoom: 1,
crs: L.CRS.Simple,

19
ui/src/app/widget/lib/map-widget2.js

@ -79,17 +79,18 @@ export default class TbMapWidgetV2 {
});
if (mapProvider === 'google-map') {
this.map = new TbGoogleMap($element, this.utils, initCallback, this.defaultZoomLevel, this.dontFitMapBounds, minZoomLevel, settings.gmApiKey, settings.gmDefaultMapType);
this.map = new TbGoogleMap($element, this.utils, initCallback, this.defaultZoomLevel, this.dontFitMapBounds, settings.disableScrollZooming, minZoomLevel, settings.gmApiKey, settings.gmDefaultMapType);
} else if (mapProvider === 'openstreet-map') {
this.map = new TbOpenStreetMap($element, this.utils, initCallback, this.defaultZoomLevel, this.dontFitMapBounds, minZoomLevel, settings.mapProvider);
this.map = new TbOpenStreetMap($element, this.utils, initCallback, this.defaultZoomLevel, this.dontFitMapBounds, settings.disableScrollZooming, minZoomLevel, settings.mapProvider);
} else if (mapProvider === 'image-map') {
this.map = new TbImageMap(this.ctx, $element, this.utils, initCallback,
settings.mapImageUrl,
settings.disableScrollZooming,
settings.posFunction,
settings.imageEntityAlias,
settings.imageUrlAttribute);
} else if (mapProvider === 'tencent-map') {
this.map = new TbTencentMap($element, this.utils, initCallback, this.defaultZoomLevel, this.dontFitMapBounds, minZoomLevel, settings.tmApiKey, settings.tmDefaultMapType);
this.map = new TbTencentMap($element, this.utils, initCallback, this.defaultZoomLevel, this.dontFitMapBounds, settings.disableScrollZooming, minZoomLevel, settings.tmApiKey, settings.tmDefaultMapType);
}
@ -858,6 +859,11 @@ const commonMapSettingsSchema =
"type": "boolean",
"default": true
},
"disableScrollZooming": {
"title": "Disable scroll zooming",
"type": "boolean",
"default": false
},
"latKeyName": {
"title": "Latitude key name",
"type": "string",
@ -998,6 +1004,7 @@ const commonMapSettingsSchema =
"form": [
"defaultZoomLevel",
"fitMapBounds",
"disableScrollZooming",
"latKeyName",
"lngKeyName",
"showLabel",
@ -1109,6 +1116,11 @@ const imageMapSettingsSchema =
"type": "string",
"default": ""
},
"disableScrollZooming": {
"title": "Disable scroll zooming",
"type": "boolean",
"default": false
},
"xPosKeyName": {
"title": "X position key name",
"type": "string",
@ -1226,6 +1238,7 @@ const imageMapSettingsSchema =
},
"imageEntityAlias",
"imageUrlAttribute",
"disableScrollZooming",
"xPosKeyName",
"yPosKeyName",
"showLabel",

6
ui/src/app/widget/lib/openstreet-map.js

@ -19,7 +19,7 @@ import 'leaflet-providers';
export default class TbOpenStreetMap {
constructor($containerElement, utils, initCallback, defaultZoomLevel, dontFitMapBounds, minZoomLevel, mapProvider) {
constructor($containerElement, utils, initCallback, defaultZoomLevel, dontFitMapBounds, disableScrollZooming, minZoomLevel, mapProvider) {
this.utils = utils;
this.defaultZoomLevel = defaultZoomLevel;
@ -33,6 +33,10 @@ export default class TbOpenStreetMap {
this.map = L.map($containerElement[0]).setView([0, 0], this.defaultZoomLevel || 8);
if (disableScrollZooming) {
this.map.scrollWheelZoom.disable();
}
var tileLayer = L.tileLayer.provider(mapProvider);
tileLayer.addTo(this.map);

4
ui/src/app/widget/lib/tencent-map.js

@ -19,7 +19,7 @@ var tmGlobals = {
}
export default class TbTencentMap {
constructor($containerElement, utils, initCallback, defaultZoomLevel, dontFitMapBounds, minZoomLevel, tmApiKey, tmDefaultMapType) {
constructor($containerElement, utils, initCallback, defaultZoomLevel, dontFitMapBounds, disableScrollZooming, minZoomLevel, tmApiKey, tmDefaultMapType) {
var tbMap = this;
this.utils = utils;
this.defaultZoomLevel = defaultZoomLevel;
@ -42,7 +42,7 @@ export default class TbTencentMap {
function initTencentMap() {
tbMap.map = new qq.maps.Map($containerElement[0], { // eslint-disable-line no-undef
scrollwheel: true,
scrollwheel: !disableScrollZooming,
mapTypeId: getTencentMapTypeId(tbMap.defaultMapType),
zoom: tbMap.defaultZoomLevel || 8
});

Loading…
Cancel
Save