fix GridLayer tile loading edge case

This commit is contained in:
Vladimir Agafonkin 2014-10-23 13:23:37 +03:00
parent 2ff2c42847
commit eacc499199
2 changed files with 11 additions and 1 deletions

View File

@ -36,6 +36,9 @@
return tile; return tile;
}; };
grid.on('loading', function() { console.log('loading'); });
grid.on('load', function() { console.log('load'); });
var map = L.map('map') var map = L.map('map')
.setView([50.5, 30.51], 10) .setView([50.5, 30.51], 10)
.addLayer(grid); .addLayer(grid);

View File

@ -230,9 +230,14 @@ L.GridLayer = L.Layer.extend({
for (key in this._tiles) { for (key in this._tiles) {
if (!this._retain[key]) { if (!this._retain[key]) {
if (!this._loaded[key]) {
this._removeTile(key);
this._tilesToLoad--;
} else {
setTimeout(L.bind(this._deferRemove, this, key), 250); setTimeout(L.bind(this._deferRemove, this, key), 250);
} }
} }
}
}, },
_deferRemove: function (key) { _deferRemove: function (key) {
@ -403,6 +408,8 @@ L.GridLayer = L.Layer.extend({
} }
this._level.el.appendChild(fragment); this._level.el.appendChild(fragment);
this._pruneTiles();
}, },
_isValidTile: function (coords) { _isValidTile: function (coords) {