fix: disable for real dragging the map on mobile when scrollWheelZoom is false (#2344)
Some checks failed
Test & Docs / tests (postgresql, 3.10) (push) Has been cancelled
Test & Docs / tests (postgresql, 3.12) (push) Has been cancelled
Test & Docs / lint (push) Has been cancelled
Test & Docs / docs (push) Has been cancelled

Changing map options at this stage is too late.

cf #2340
This commit is contained in:
Yohan Boniface 2024-12-07 15:46:45 +01:00 committed by GitHub
commit a7b714c887
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -285,9 +285,14 @@ export const LeafletMap = BaseMap.extend({
setOptions(this, this._umap.properties)
if (this.options.scrollWheelZoom) {
this.scrollWheelZoom.enable()
this.dragging.enable()
} else {
this.scrollWheelZoom.disable()
this.options.dragging = !L.Browser.mobile
// In mobile, do not let the user move the map
// when scrolling the main page and touching the
// map in an iframe. May be a bit dumb, but let's
// try like this for now.
if (L.Browser.mobile) this.dragging.disable()
}
// Needs tilelayer to exist for minimap
this.renderControls()