Skip to content

Commit

Permalink
add resize event, close #1564
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed Apr 18, 2013
1 parent b1a31fa commit 0b1bc7a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/map/Map.js
Expand Up @@ -229,7 +229,8 @@ L.Map = L.Class.extend({

if (!this._loaded) { return this; }

var offset = oldSize._subtract(this.getSize())._divideBy(2)._round();
var newSize = this.getSize(),
offset = oldSize.subtract(newSize).divideBy(2).round();

if ((offset.x !== 0) || (offset.y !== 0)) {
if (animate === true) {
Expand All @@ -242,6 +243,10 @@ L.Map = L.Class.extend({
clearTimeout(this._sizeTimer);
this._sizeTimer = setTimeout(L.bind(this.fire, this, 'moveend'), 200);
}
this.fire('resize', {
oldSize: oldSize,
newSize: newSize
});
}
return this;
},
Expand Down

0 comments on commit 0b1bc7a

Please sign in to comment.