From c3ccf01a2980aec7584b049e31447f4d32212f9a Mon Sep 17 00:00:00 2001 From: oslek Date: Wed, 13 Feb 2013 13:35:40 -0800 Subject: [PATCH] prevent extra movestart on inertia drag --- src/map/anim/Map.PanAnimation.js | 6 ++++-- src/map/handler/Map.Drag.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/map/anim/Map.PanAnimation.js b/src/map/anim/Map.PanAnimation.js index c1bd3077..0b140eeb 100644 --- a/src/map/anim/Map.PanAnimation.js +++ b/src/map/anim/Map.PanAnimation.js @@ -32,7 +32,7 @@ L.Map.include({ return this; }, - panBy: function (offset, duration, easeLinearity) { + panBy: function (offset, duration, easeLinearity, moving) { offset = L.point(offset); if (!(offset.x || offset.y)) { @@ -48,7 +48,9 @@ L.Map.include({ }, this); } - this.fire('movestart'); + if (moving !== true) { + this.fire('movestart'); + } L.DomUtil.addClass(this._mapPane, 'leaflet-pan-anim'); diff --git a/src/map/handler/Map.Drag.js b/src/map/handler/Map.Drag.js index 65cf0041..323ee927 100644 --- a/src/map/handler/Map.Drag.js +++ b/src/map/handler/Map.Drag.js @@ -132,7 +132,7 @@ L.Map.Drag = L.Handler.extend({ offset = limitedSpeedVector.multiplyBy(-decelerationDuration / 2).round(); L.Util.requestAnimFrame(function () { - map.panBy(offset, decelerationDuration, ease); + map.panBy(offset, decelerationDuration, ease, true); }); }