You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue:
Interactions are not working after scroll page + touch the map, on mobile.
How to reproduce:
Scroll the page by touching the map with one finger. The "Use 2 fingers to move the map" appear.
Touch the map before the message disappear.
The interactions are disabled and are never re-enabled. This causes issues such as clickable map elements such as polygons are no longer clickable, the zoom out button zoom the map in when double click, etc.
NOTE: The bug is also reproducible with Google Chrome desktop, when mobile device is turned on in the developer tools.
Solution:
Add the following line:
this._enableInteractions();
in method _handleTouch
_handleTouch: function (e) {
//Disregard touch events on the minimap if present
var ignoreList = ["leaflet-control-minimap", "leaflet-interactive", "leaflet-popup-content", "leaflet-popup-content-wrapper", "leaflet-popup-close-button", "leaflet-control-zoom-in", "leaflet-control-zoom-out"];
var ignoreElement = false;
for (var i = 0; i < ignoreList.length; i++) {
if (L.DomUtil.hasClass(e.target, ignoreList[i])) {
ignoreElement = true;
}
}
if (ignoreElement) {
if (L.DomUtil.hasClass(e.target, "leaflet-interactive") && e.type === "touchmove" && e.touches.length === 1) {
L.DomUtil.addClass(this._map._container, "leaflet-gesture-handling-touch-warning");
this._disableInteractions();
} else {
// ###### HERE ######
this._enableInteractions();
L.DomUtil.removeClass(this._map._container, "leaflet-gesture-handling-touch-warning");
}
return;
}
...
The text was updated successfully, but these errors were encountered:
gaellafond
changed the title
Interactions stay disabled after touch an ignored element
Interactions stay disabled after touching an ignored element
Jan 2, 2020
I had a similar problem: on desktop when users mouse over a Polygon and then mouse back over the underlying tile layer, they can't click + hold to drag the map. This solution fixed that too.
Issue:
Interactions are not working after scroll page + touch the map, on mobile.
How to reproduce:
NOTE: The bug is also reproducible with Google Chrome desktop, when mobile device is turned on in the developer tools.
Solution:
Add the following line:
in method _handleTouch
The text was updated successfully, but these errors were encountered: