When limiting center to bounds, ignore offsets less than a pixel.

This commit is contained in:
Per Liedman 2015-12-08 22:34:46 +01:00
parent 92c575f2ca
commit 7c3d7cb139

View File

@ -790,6 +790,13 @@ L.Map = L.Evented.extend({
viewBounds = new L.Bounds(centerPoint.subtract(viewHalf), centerPoint.add(viewHalf)),
offset = this._getBoundsOffset(viewBounds, bounds, zoom);
// If offset is less than a pixel, ignore.
// This prevents unstable projections from getting into
// an infinite loop of tiny offsets.
if (offset.round().equals([0, 0])) {
return center;
}
return this.unproject(centerPoint.add(offset), zoom);
},