Use all four corners when projecting ImageOverlay during animation (#4993)
Close #4886.
This commit is contained in:
parent
7f350e4442
commit
350919b2ff
@ -172,7 +172,7 @@ L.ImageOverlay = L.Layer.extend({
|
||||
|
||||
_animateZoom: function (e) {
|
||||
var scale = this._map.getZoomScale(e.zoom),
|
||||
offset = this._map._latLngToNewLayerPoint(this._bounds.getNorthWest(), e.zoom, e.center);
|
||||
offset = this._map._latLngBoundsToNewLayerBounds(this._bounds, e.zoom, e.center).min;
|
||||
|
||||
L.DomUtil.setTransform(this._image, offset, scale);
|
||||
},
|
||||
|
@ -1378,6 +1378,16 @@ L.Map = L.Evented.extend({
|
||||
return this.project(latlng, zoom)._subtract(topLeft);
|
||||
},
|
||||
|
||||
_latLngBoundsToNewLayerBounds: function (latLngBounds, zoom, center) {
|
||||
var topLeft = this._getNewPixelOrigin(center, zoom);
|
||||
return L.bounds([
|
||||
this.project(latLngBounds.getSouthWest(), zoom)._subtract(topLeft),
|
||||
this.project(latLngBounds.getNorthWest(), zoom)._subtract(topLeft),
|
||||
this.project(latLngBounds.getSouthEast(), zoom)._subtract(topLeft),
|
||||
this.project(latLngBounds.getNorthEast(), zoom)._subtract(topLeft)
|
||||
]);
|
||||
},
|
||||
|
||||
// layer point of the current center
|
||||
_getCenterLayerPoint: function () {
|
||||
return this.containerPointToLayerPoint(this.getSize()._divideBy(2));
|
||||
|
Loading…
Reference in New Issue
Block a user