Center restore after zoom
parent
f870f78e1d
commit
4d66d025fa
|
@ -359,6 +359,10 @@ L.GridLayer = L.Layer.extend({
|
|||
var topLeft = this._map.unproject([0, 0], this._tileZoom);
|
||||
var bottomRight = this._map.unproject(docPixelLimits, this._tileZoom);
|
||||
var maxBounds = new L.LatLngBounds(topLeft, bottomRight);
|
||||
// previous scroll position (relative)
|
||||
var prevX = this._map._outerContainer.scrollLeft / this._map._container.clientWidth;
|
||||
var prevY = this._map._outerContainer.scrollTop / this._map._container.clientHeight;
|
||||
|
||||
L.DomUtil.setStyle(this._map._outerContainer, 'overflow', '');
|
||||
L.DomUtil.setStyle(this._map._container, 'width', docPixelLimits.x + 'px');
|
||||
L.DomUtil.setStyle(this._map._container, 'height', docPixelLimits.y + 'px');
|
||||
|
@ -368,6 +372,9 @@ L.GridLayer = L.Layer.extend({
|
|||
// crashes on Chrome
|
||||
setTimeout(L.bind(this._map.invalidateSize, this._map), 100);
|
||||
L.DomUtil.setStyle(this._map._outerContainer, 'overflow', 'auto');
|
||||
// restore the relative scroll position
|
||||
this._map._outerContainer.scrollLeft = prevX * this._map._container.clientWidth;
|
||||
this._map._outerContainer.scrollTop = prevY * this._map._container.clientHeight;
|
||||
},
|
||||
|
||||
_setZoomTransforms: function (center, zoom) {
|
||||
|
|
Loading…
Reference in New Issue