Merge pull request #237 from giscloud/master

Fixed not clearing old tiles
This commit is contained in:
Vladimir Agafonkin 2011-08-10 05:10:28 -07:00
commit 0c887fe7ef
2 changed files with 9 additions and 3 deletions

View File

@ -42,7 +42,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);
@ -108,8 +112,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'); }