fix GridLayer to not reset if tile zoom didn't change

This commit is contained in:
Vladimir Agafonkin 2014-01-20 20:29:44 +02:00
parent dc04b9dbe2
commit e093979297

View File

@ -187,27 +187,27 @@ L.GridLayer = L.Layer.extend({
_reset: function (e) {
var map = this._map,
zoom = map.getZoom(),
roundZoom = Math.round(zoom);
tileZoom = Math.round(zoom),
tileZoomChanged = this._tileZoom !== tileZoom;
if (this._abortLoading) {
this._abortLoading();
}
this._clearTiles();
if (tileZoomChanged || e && e.hard) {
this._clearTiles();
if (this._tileZoom !== roundZoom) {
this._tileZoom = roundZoom;
this._tileZoom = tileZoom;
this._pxOrigin = map.project(map.unproject(map.getPixelOrigin()), tileZoom).round();
this._resetGrid();
}
if (this._zoomAnimated) {
this._origScale = map.getZoomScale(zoom) / map.getZoomScale(this._tileZoom);
this._origTranslate = map.containerPointToLayerPoint(map.getSize().divideBy(2))
.multiplyBy((1 - this._origScale));
this._origScale = map.getZoomScale(zoom, tileZoom);
this._origTranslate = this._pxOrigin.multiplyBy(this._origScale).subtract(map.getPixelOrigin()).round();
L.DomUtil.setTransform(this._tileContainer, this._origTranslate, this._origScale);
}
this._pxOrigin = map._getNewPixelOrigin(map.getCenter(), roundZoom);
if (this._zoomAnimated && e && e.hard) {
this._clearBgBuffer();