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": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -5261,20 +5259,17 @@
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -5391,8 +5386,7 @@
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@ -5404,7 +5398,6 @@
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@ -5419,7 +5412,6 @@
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
@ -5427,14 +5419,12 @@
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.2.4", "version": "2.2.4",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.1", "safe-buffer": "^5.1.1",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@ -5453,7 +5443,6 @@
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -5534,8 +5523,7 @@
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@ -5547,7 +5535,6 @@
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@ -5669,7 +5656,6 @@
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^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 { 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; var tbMap = this;
this.utils = utils; this.utils = utils;
@ -44,7 +44,7 @@ export default class TbGoogleMap {
function initGoogleMap() { function initGoogleMap() {
tbMap.map = new google.maps.Map($containerElement[0], { // eslint-disable-line no-undef tbMap.map = new google.maps.Map($containerElement[0], { // eslint-disable-line no-undef
scrollwheel: true, scrollwheel: !disableScrollZooming,
mapTypeId: getGoogleMapTypeId(tbMap.defaultMapType), mapTypeId: getGoogleMapTypeId(tbMap.defaultMapType),
zoom: tbMap.defaultZoomLevel || 8 zoom: tbMap.defaultZoomLevel || 8
}); });

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

@ -20,7 +20,7 @@ const maxZoom = 4;
export default class TbImageMap { 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.ctx = ctx;
this.utils = utils; this.utils = utils;
@ -34,6 +34,7 @@ export default class TbImageMap {
this.height = 0; this.height = 0;
this.markers = []; this.markers = [];
this.initCallback = initCallback; this.initCallback = initCallback;
this.disableScrollZooming = disableScrollZooming;
if (angular.isDefined(posFunction) && posFunction.length > 0) { if (angular.isDefined(posFunction) && posFunction.length > 0) {
try { try {
@ -165,6 +166,7 @@ export default class TbImageMap {
this.map = L.map(this.$containerElement[0], { this.map = L.map(this.$containerElement[0], {
minZoom: 1, minZoom: 1,
maxZoom: maxZoom, maxZoom: maxZoom,
scrollWheelZoom: !this.disableScrollZooming,
center: center, center: center,
zoom: 1, zoom: 1,
crs: L.CRS.Simple, 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') { 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') { } 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') { } else if (mapProvider === 'image-map') {
this.map = new TbImageMap(this.ctx, $element, this.utils, initCallback, this.map = new TbImageMap(this.ctx, $element, this.utils, initCallback,
settings.mapImageUrl, settings.mapImageUrl,
settings.disableScrollZooming,
settings.posFunction, settings.posFunction,
settings.imageEntityAlias, settings.imageEntityAlias,
settings.imageUrlAttribute); settings.imageUrlAttribute);
} else if (mapProvider === 'tencent-map') { } 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", "type": "boolean",
"default": true "default": true
}, },
"disableScrollZooming": {
"title": "Disable scroll zooming",
"type": "boolean",
"default": false
},
"latKeyName": { "latKeyName": {
"title": "Latitude key name", "title": "Latitude key name",
"type": "string", "type": "string",
@ -998,6 +1004,7 @@ const commonMapSettingsSchema =
"form": [ "form": [
"defaultZoomLevel", "defaultZoomLevel",
"fitMapBounds", "fitMapBounds",
"disableScrollZooming",
"latKeyName", "latKeyName",
"lngKeyName", "lngKeyName",
"showLabel", "showLabel",
@ -1109,6 +1116,11 @@ const imageMapSettingsSchema =
"type": "string", "type": "string",
"default": "" "default": ""
}, },
"disableScrollZooming": {
"title": "Disable scroll zooming",
"type": "boolean",
"default": false
},
"xPosKeyName": { "xPosKeyName": {
"title": "X position key name", "title": "X position key name",
"type": "string", "type": "string",
@ -1226,6 +1238,7 @@ const imageMapSettingsSchema =
}, },
"imageEntityAlias", "imageEntityAlias",
"imageUrlAttribute", "imageUrlAttribute",
"disableScrollZooming",
"xPosKeyName", "xPosKeyName",
"yPosKeyName", "yPosKeyName",
"showLabel", "showLabel",

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

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

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

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

Loading…
Cancel
Save