From 2c11fdfa6d3552012b6175287fdca26d45d335a1 Mon Sep 17 00:00:00 2001 From: oslek Date: Wed, 13 Feb 2013 12:38:33 -0800 Subject: [PATCH] prevent false move events in invalidateSize --- src/map/Map.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/map/Map.js b/src/map/Map.js index 5367ba33e..4817dc1e9 100644 --- a/src/map/Map.js +++ b/src/map/Map.js @@ -211,15 +211,17 @@ L.Map = L.Class.extend({ var offset = oldSize._subtract(this.getSize())._divideBy(2)._round(); - if (animate === true) { - this.panBy(offset); - } else { - this._rawPanBy(offset); + if ((offset.x !== 0) || (offset.y !== 0)) { + if (animate === true) { + this.panBy(offset); + } else { + this._rawPanBy(offset); - this.fire('move'); + this.fire('move'); - clearTimeout(this._sizeTimer); - this._sizeTimer = setTimeout(L.bind(this.fire, this, 'moveend'), 200); + clearTimeout(this._sizeTimer); + this._sizeTimer = setTimeout(L.bind(this.fire, this, 'moveend'), 200); + } } return this; },