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;
};
grid.on('loading', function() { console.log('loading'); });
grid.on('load', function() { console.log('load'); });
var map = L.map('map')
.setView([50.5, 30.51], 10)
.addLayer(grid);

View File

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