removeLayer: function (layer) {
var id = L.stamp(layer);
- if (!this._layers[id]) { return; }
+ if (!this._layers[id]) { return this; }
if (this._loaded) {
layer.onRemove(this);
var oldSize = this.getSize();
this._sizeChanged = true;
+ this._initialCenter = null;
if (this.options.maxBounds) {
this.setMaxBounds(this.options.maxBounds);
this._rawPanBy(offset);
}
- this.fire('move');
-
- // make sure moveend is not fired too often on resize
- clearTimeout(this._sizeTimer);
- this._sizeTimer = setTimeout(L.bind(this.fire, this, 'moveend'), 200);
+ this.fire('move').fire('moveend');
}
return this.fire('resize', {
getCenter: function () { // (Boolean) -> LatLng
this._checkIfLoaded();
- if (!this._moved()) {
+ if (this._initialCenter && !this._moved()) {
return this._initialCenter;
}
return this.layerPointToLatLng(this._getCenterLayerPoint());