Streamline tile preparation and remove unused code

This commit is contained in:
ahocevar
2018-11-21 23:59:48 +01:00
parent 2ce8fa6f10
commit fbf98a44ea
9 changed files with 104 additions and 95 deletions
+10 -3
View File
@@ -143,8 +143,7 @@ class VectorImageTile extends Tile {
* @inheritDoc
*/
disposeInternal() {
this.state = TileState.ABORT;
this.changed();
this.setState(TileState.ABORT);
for (let i = 0, ii = this.tileKeys.length; i < ii; ++i) {
const sourceTileKey = this.tileKeys[i];
@@ -176,6 +175,14 @@ class VectorImageTile extends Tile {
return this.context_[key];
}
/**
* @param {import("./layer/Layer.js").default} layer Layer.
* @return {boolean} Tile has a rendering context for the given layer.
*/
hasContext(layer) {
return getUid(layer) in this.context_;
}
/**
* Get the Canvas for this tile.
* @param {import("./layer/Layer.js").default} layer Layer.
@@ -262,7 +269,7 @@ class VectorImageTile extends Tile {
}.bind(this));
}
if (leftToLoad - Object.keys(errorSourceTiles).length == 0) {
setTimeout(this.finishLoading_.bind(this), 0);
setTimeout(this.finishLoading_.bind(this), 16);
}
}