Merge pull request #4077 from Leaflet/fix-2427
When limiting center to bounds, ignore offsets less than a pixel.
This commit is contained in:
commit
0cf95c5f5d
@ -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);
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user