From 20eca2216507061217035429077f5faa82673c46 Mon Sep 17 00:00:00 2001 From: Christoph-Majcen Date: Fri, 25 Jan 2019 10:33:46 +0100 Subject: [PATCH] Capture _map._container for callback to enable usage in shadow DOM --- src/js/leaflet-gesture-handling.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/js/leaflet-gesture-handling.js b/src/js/leaflet-gesture-handling.js index 9b18a4f..84d8e26 100644 --- a/src/js/leaflet-gesture-handling.js +++ b/src/js/leaflet-gesture-handling.js @@ -251,18 +251,15 @@ export var GestureHandling = L.Handler.extend({ this._map.scrollWheelZoom.disable(); clearTimeout(this._isScrolling); + + var container = this._map._container; // Set a timeout to run after scrolling ends this._isScrolling = setTimeout(function() { // Run the callback - var warnings = document.getElementsByClassName( - "leaflet-gesture-handling-scroll-warning" - ); - for (var i = 0; i < warnings.length; i++) { - L.DomUtil.removeClass(warnings[i], - "leaflet-gesture-handling-scroll-warning" - ); - } + L.DomUtil.removeClass(container, + "leaflet-gesture-handling-scroll-warning" + ); }, this._map.options.gestureHandlingOptions.duration); } },