From 9dc6db4ee32a05e007928a4ab0ca7fcb85994bbf Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Fri, 1 Aug 2014 10:47:19 +0300 Subject: [PATCH] stop panning/fly animations when necessary --- src/map/anim/Map.PanAnimation.js | 4 +--- src/map/handler/Map.ScrollWheelZoom.js | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/map/anim/Map.PanAnimation.js b/src/map/anim/Map.PanAnimation.js index 8de67e3c0ce..9b20aef6d67 100644 --- a/src/map/anim/Map.PanAnimation.js +++ b/src/map/anim/Map.PanAnimation.js @@ -10,9 +10,7 @@ L.Map.include({ center = this._limitCenter(L.latLng(center), zoom, this.options.maxBounds); options = options || {}; - if (this._panAnim) { - this._panAnim.stop(); - } + this.stop(); if (this._loaded && !options.reset && options !== true) { diff --git a/src/map/handler/Map.ScrollWheelZoom.js b/src/map/handler/Map.ScrollWheelZoom.js index df2e614bee2..f0eb5943e95 100644 --- a/src/map/handler/Map.ScrollWheelZoom.js +++ b/src/map/handler/Map.ScrollWheelZoom.js @@ -46,6 +46,8 @@ L.Map.ScrollWheelZoom = L.Handler.extend({ delta = this._delta, zoom = map.getZoom(); + map.stop(); // stop panning and fly animations if any + delta = delta > 0 ? Math.ceil(delta) : Math.floor(delta); delta = Math.max(Math.min(delta, 4), -4); delta = map._limitZoom(zoom + delta) - zoom;