Only set LOADED state when all source tiles loaded successfully
This commit is contained in:
@@ -263,17 +263,23 @@ ol.VectorImageTile.prototype.load = function() {
|
||||
*/
|
||||
ol.VectorImageTile.prototype.finishLoading_ = function() {
|
||||
var loaded = this.tileKeys.length;
|
||||
var empty = 0;
|
||||
for (var i = loaded - 1; i >= 0; --i) {
|
||||
var state = this.getTile(this.tileKeys[i]).getState();
|
||||
if (state != ol.TileState.LOADED) {
|
||||
--loaded;
|
||||
}
|
||||
if (state == ol.TileState.EMPTY) {
|
||||
++empty;
|
||||
}
|
||||
}
|
||||
if (loaded == this.tileKeys.length) {
|
||||
this.loadListenerKeys_.forEach(ol.events.unlistenByKey);
|
||||
this.loadListenerKeys_.length = 0;
|
||||
this.setState(ol.TileState.LOADED);
|
||||
} else {
|
||||
this.setState(empty == this.tileKeys.length ? ol.TileState.EMPTY : ol.TileState.ERROR);
|
||||
}
|
||||
this.setState(loaded > 0 ? ol.TileState.LOADED : ol.TileState.ERROR);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@ describe('ol.rendering.layer.VectorTile', function() {
|
||||
source = new ol.source.VectorTile({
|
||||
format: new ol.format.MVT(),
|
||||
tileGrid: ol.tilegrid.createXYZ(),
|
||||
tilePixelRatio: 16,
|
||||
url: 'rendering/ol/data/tiles/mvt/{z}-{x}-{y}.vector.pbf'
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user