From c97c48325afee8973311f9a7d54f4392da43d922 Mon Sep 17 00:00:00 2001 From: kdeloach Date: Fri, 21 Nov 2014 14:36:17 -0500 Subject: [PATCH] Remove global variable that disables dragging for all maps during zoom Starting a zoom animation will disable dragging for all maps on the page. Only the map that is being zoomed should have dragging disabled. This fix removes a global static variable which is redundant since the map pane already has a css class assigned to it for the duration of the zoom animation. Fixes #2539 --- src/dom/Draggable.js | 2 +- src/map/anim/Map.ZoomAnimation.js | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/dom/Draggable.js b/src/dom/Draggable.js index c743c11c..2a6e9ff7 100644 --- a/src/dom/Draggable.js +++ b/src/dom/Draggable.js @@ -49,7 +49,7 @@ L.Draggable = L.Evented.extend({ L.DomEvent.stopPropagation(e); - if (L.Draggable._disabled) { return; } + if (L.DomUtil.hasClass(this._element, 'leaflet-zoom-anim')) { return; } L.DomUtil.disableImageDrag(); L.DomUtil.disableTextSelection(); diff --git a/src/map/anim/Map.ZoomAnimation.js b/src/map/anim/Map.ZoomAnimation.js index eeaeeaad..085b2663 100644 --- a/src/map/anim/Map.ZoomAnimation.js +++ b/src/map/anim/Map.ZoomAnimation.js @@ -89,11 +89,6 @@ L.Map.include(!zoomAnimated ? {} : { this._animateToCenter = center; this._animateToZoom = zoom; - // disable any dragging during animation - if (L.Draggable) { - L.Draggable._disabled = true; - } - L.DomUtil.addClass(this._mapPane, 'leaflet-zoom-anim'); } @@ -113,9 +108,5 @@ L.Map.include(!zoomAnimated ? {} : { L.DomUtil.removeClass(this._mapPane, 'leaflet-zoom-anim'); this._resetView(this._animateToCenter, this._animateToZoom, true, true); - - if (L.Draggable) { - L.Draggable._disabled = false; - } } });