From 2aa68155ae64b888098d5815280ead538cf73c42 Mon Sep 17 00:00:00 2001 From: fe-dev Date: Wed, 6 Jul 2022 15:03:25 +0300 Subject: [PATCH] UI: Fix double click zooming on map widgets --- .../app/modules/home/components/widget/lib/maps/map-models.ts | 2 ++ .../home/components/widget/lib/maps/providers/google-map.ts | 1 + .../home/components/widget/lib/maps/providers/here-map.ts | 1 + .../home/components/widget/lib/maps/providers/image-map.ts | 2 +- .../components/widget/lib/maps/providers/openstreet-map.ts | 1 + .../home/components/widget/lib/maps/providers/tencent-map.ts | 1 + .../widget/lib/settings/map/common-map-settings.component.html | 3 +++ .../widget/lib/settings/map/common-map-settings.component.ts | 1 + ui-ngx/src/assets/locale/locale.constant-en_US.json | 1 + 9 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-models.ts index 7df76f670d..a7def01b1a 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-models.ts @@ -219,6 +219,7 @@ export interface CommonMapSettings { defaultZoomLevel: number; defaultCenterPosition?: string; disableScrollZooming: boolean; + disableDoubleClickZooming: boolean; disableZoomControl: boolean; fitMapBounds: boolean; useDefaultCenterPosition: boolean; @@ -242,6 +243,7 @@ export const defaultCommonMapSettings: CommonMapSettings = { defaultZoomLevel: null, defaultCenterPosition: '0,0', disableScrollZooming: false, + disableDoubleClickZooming: false, disableZoomControl: false, fitMapBounds: true, useDefaultCenterPosition: false, diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/google-map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/google-map.ts index 90ce4e78d8..c508d86216 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/google-map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/google-map.ts @@ -37,6 +37,7 @@ export class GoogleMap extends LeafletMap { this.loadGoogle(() => { const map = L.map($container, { attributionControl: false, + doubleClickZoom: !this.options.disableDoubleClickZooming, zoomControl: !this.options.disableZoomControl, tap: L.Browser.safari && L.Browser.mobile }).setView(options?.parsedDefaultCenterPosition, options?.defaultZoomLevel || DEFAULT_ZOOM_LEVEL); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/here-map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/here-map.ts index 584c4ea255..e388707d0c 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/here-map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/here-map.ts @@ -24,6 +24,7 @@ export class HEREMap extends LeafletMap { super(ctx, $container, options); const map = L.map($container, { tap: L.Browser.safari && L.Browser.mobile, + doubleClickZoom: !this.options.disableDoubleClickZooming, zoomControl: !this.options.disableZoomControl }).setView(options?.parsedDefaultCenterPosition, options?.defaultZoomLevel || DEFAULT_ZOOM_LEVEL); const tileLayer = (L.tileLayer as any).provider(options.mapProviderHere || 'HERE.normalDay', options.credentials); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts index dd03604a9a..18605a7142 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts @@ -224,7 +224,7 @@ export class ImageMap extends LeafletMap { maxZoom, scrollWheelZoom: !this.options.disableScrollZooming, center, - doubleClickZoom: !this.options.disableZoomControl, + doubleClickZoom: !this.options.disableDoubleClickZooming, zoomControl: !this.options.disableZoomControl, zoom: 1, crs: L.CRS.Simple, diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/openstreet-map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/openstreet-map.ts index 96988e40c5..2922a56c6f 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/openstreet-map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/openstreet-map.ts @@ -23,6 +23,7 @@ export class OpenStreetMap extends LeafletMap { constructor(ctx: WidgetContext, $container, options: WidgetUnitedMapSettings) { super(ctx, $container, options); const map = L.map($container, { + doubleClickZoom: !this.options.disableDoubleClickZooming, zoomControl: !this.options.disableZoomControl, tap: L.Browser.safari && L.Browser.mobile }).setView(options?.parsedDefaultCenterPosition, options?.defaultZoomLevel || DEFAULT_ZOOM_LEVEL); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/tencent-map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/tencent-map.ts index 9cf1801056..2439db261e 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/tencent-map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/tencent-map.ts @@ -25,6 +25,7 @@ export class TencentMap extends LeafletMap { super(ctx, $container, options); const txUrl = 'http://rt{s}.map.gtimg.com/realtimerender?z={z}&x={x}&y={y}&type=vector&style=0'; const map = L.map($container, { + doubleClickZoom: !this.options.disableDoubleClickZooming, zoomControl: !this.options.disableZoomControl, tap: L.Browser.safari && L.Browser.mobile }).setView(options?.parsedDefaultCenterPosition, options?.defaultZoomLevel || DEFAULT_ZOOM_LEVEL); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/common-map-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/common-map-settings.component.html index 8f199654e0..d2b207588e 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/common-map-settings.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/common-map-settings.component.html @@ -70,6 +70,9 @@ {{ 'widgets.maps.disable-scroll-zooming' | translate }} + + {{ 'widgets.maps.disable-double-click-zooming' | translate }} + {{ 'widgets.maps.disable-zoom-control-buttons' | translate }} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/common-map-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/common-map-settings.component.ts index 12a2e8cef7..8fcfb063fd 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/common-map-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/common-map-settings.component.ts @@ -83,6 +83,7 @@ export class CommonMapSettingsComponent extends PageComponent implements OnInit, defaultZoomLevel: [null, [Validators.min(0), Validators.max(20)]], defaultCenterPosition: [null, []], disableScrollZooming: [null, []], + disableDoubleClickZooming: [null, []], disableZoomControl: [null, []], fitMapBounds: [null, []], useDefaultCenterPosition: [null, []], diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 0286b5f9d2..5f445c37e6 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -4371,6 +4371,7 @@ "default-map-zoom-level": "Default map zoom level (0 - 20)", "default-map-center-position": "Default map center position (0,0)", "disable-scroll-zooming": "Disable scroll zooming", + "disable-double-click-zooming": "Disable double click zooming", "disable-zoom-control-buttons": "Disable zoom control buttons", "fit-map-bounds": "Fit map bounds to cover all markers", "use-default-map-center-position": "Use default map center position",