From acbdfda581c8ce9f4ec09d8f78e9d38322e44c4c Mon Sep 17 00:00:00 2001 From: Florent Triquet Date: Thu, 5 Dec 2024 13:55:49 +0100 Subject: [PATCH] fix: Avoid map-panning on mobile using two fingers navigation If scrollWheelZoom option is false we deactivate leaflet dragging options only on mobile --- umap/static/umap/js/modules/rendering/map.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/umap/static/umap/js/modules/rendering/map.js b/umap/static/umap/js/modules/rendering/map.js index 2e3f445e..00d6a131 100644 --- a/umap/static/umap/js/modules/rendering/map.js +++ b/umap/static/umap/js/modules/rendering/map.js @@ -96,8 +96,12 @@ const ControlsMixin = { this._controls.more = new U.MoreControls() this._controls.scale = L.control.scale() this._controls.permanentCredit = new U.PermanentCreditsControl(this) - if (this.options.scrollWheelZoom) this.scrollWheelZoom.enable() - else this.scrollWheelZoom.disable() + if (this.options.scrollWheelZoom){ + this.scrollWheelZoom.enable() + } else { + this.scrollWheelZoom.disable() + this.options.dragging = !L.Browser.mobile + } this._umap.drop = new U.DropControl(this) this._controls.tilelayers = new U.TileLayerControl(this) },