Port fix for Leaflet issue #1919

This commit is contained in:
John Firebaugh 2013-08-05 14:30:50 -07:00
parent a89d75d3d8
commit 406e93de95

View file

@ -1752,6 +1752,7 @@ L.Map = L.Class.extend({
var oldSize = this.getSize(); var oldSize = this.getSize();
this._sizeChanged = true; this._sizeChanged = true;
this._initialCenter = null;
if (this.options.maxBounds) { if (this.options.maxBounds) {
this.setMaxBounds(this.options.maxBounds); this.setMaxBounds(this.options.maxBounds);
@ -1825,7 +1826,7 @@ L.Map = L.Class.extend({
getCenter: function () { // (Boolean) -> LatLng getCenter: function () { // (Boolean) -> LatLng
this._checkIfLoaded(); this._checkIfLoaded();
if (!this._moved()) { if (this._initialCenter && !this._moved()) {
return this._initialCenter; return this._initialCenter;
} }
return this.layerPointToLatLng(this._getCenterLayerPoint()); return this.layerPointToLatLng(this._getCenterLayerPoint());