fixed not clearing old layer content in case of non animated pan or zoom

This commit is contained in:
Dino Ravnić 2011-08-10 12:22:35 +01:00
parent 3e61594205
commit 061f3d6832
2 changed files with 9 additions and 3 deletions

View File

@ -41,7 +41,11 @@ L.TileLayer = L.Class.extend({
this._createTileProto();
// set up events
map.on('viewreset', this._reset, this);
map.on('viewreset',
function(e) {
this._reset(e.hard);
},
this);
if (this.options.updateWhenIdle) {
map.on('moveend', this._update, this);
@ -107,8 +111,10 @@ L.TileLayer = L.Class.extend({
}
},
_reset: function() {
_reset: function(clearOldContainer) {
this._tiles = {};
if (clearOldContainer)
this._container.innerHTML = "";
this._initContainer();
this._container.innerHTML = '';
},

View File

@ -356,7 +356,7 @@ L.Map = L.Class.extend({
}
this._tileLayersToLoad = this._tileLayersNum;
this.fire('viewreset');
this.fire('viewreset', {hard: !preserveMapOffset});
this.fire('move');
if (zoomChanged) { this.fire('zoomend'); }