Skip to content

Commit

Permalink
Handle empty source tiles and queue them properly
Browse files Browse the repository at this point in the history
  • Loading branch information
ahocevar committed Sep 24, 2019
1 parent 3992aed commit 818bdc4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/ol/TileQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,12 @@ class TileQueue extends PriorityQueue {
if (state === TileState.ABORT) {
abortedTiles = true;
} else if (state === TileState.IDLE && !(tileKey in this.tilesLoadingKeys_)) {
this.tilesLoadingKeys_[tileKey] = true;
++this.tilesLoading_;
++newLoads;
tile.load();
if (tile.getState() === TileState.LOADING) {
this.tilesLoadingKeys_[tileKey] = true;
++this.tilesLoading_;
++newLoads;
}
}
}
if (newLoads === 0 && abortedTiles) {
Expand Down
6 changes: 4 additions & 2 deletions src/ol/source/VectorTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,17 @@ class VectorTile extends UrlTile {
empty = false;
sourceTile.addEventListener(EventType.CHANGE, this.handleTileChange.bind(this));
sourceTile.load();
} else {
sourceTile = null;
}
} else {
empty = false;
}
covered = false;
if (!sourceTile) {
if (sourceTile === undefined) {
return;
}
if (sourceTile.getState() !== TileState.EMPTY && tile.getState() === TileState.IDLE) {
if (sourceTile !== null && tile.getState() === TileState.IDLE) {
tile.loadingSourceTiles++;
const key = listen(sourceTile, EventType.CHANGE, function() {
const state = sourceTile.getState();
Expand Down

0 comments on commit 818bdc4

Please sign in to comment.