mirror of
https://github.com/BlueMap-Minecraft/BlueMapWeb.git
synced 2024-11-24 19:05:10 +01:00
Improve tile-loading
This commit is contained in:
parent
211127e76b
commit
a3de6f9122
@ -192,21 +192,11 @@ export class TileManager {
|
|||||||
this.tiles.set(tileHash, tile);
|
this.tiles.set(tileHash, tile);
|
||||||
tile.load(this.tileLoader)
|
tile.load(this.tileLoader)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (!tile.unloaded)
|
|
||||||
this.tileMap.setTile(tile.x - this.centerTile.x + TileManager.tileMapHalfSize, tile.z - this.centerTile.y + TileManager.tileMapHalfSize, TileMap.LOADED);
|
|
||||||
|
|
||||||
if (this.loadTimeout) clearTimeout(this.loadTimeout);
|
if (this.loadTimeout) clearTimeout(this.loadTimeout);
|
||||||
this.loadTimeout = setTimeout(this.loadCloseTiles, 0);
|
this.loadTimeout = setTimeout(this.loadCloseTiles, 0);
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {})
|
||||||
if (error.status && error.status === "empty") return;
|
|
||||||
if (error.target && error.target.status === 404) return;
|
|
||||||
if (error.type && error.type === "abort") return;
|
|
||||||
|
|
||||||
//alert(this.events, "Failed to load tile: " + error.type, "warning");
|
|
||||||
})
|
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
//this.tileMap.setTile(tile.x - this.centerTile.x + TileManager.tileMapHalfSize, tile.z - this.centerTile.y + TileManager.tileMapHalfSize, TileMap.LOADED);
|
|
||||||
this.currentlyLoading--;
|
this.currentlyLoading--;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -214,7 +204,7 @@ export class TileManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleLoadedTile = tile => {
|
handleLoadedTile = tile => {
|
||||||
//this.tileMap.setTile(tile.x - this.centerTile.x + TileManager.tileMapHalfSize, tile.z - this.centerTile.y + TileManager.tileMapHalfSize, TileMap.LOADED);
|
this.tileMap.setTile(tile.x - this.centerTile.x + TileManager.tileMapHalfSize, tile.z - this.centerTile.y + TileManager.tileMapHalfSize, TileMap.LOADED);
|
||||||
|
|
||||||
this.scene.add(tile.model);
|
this.scene.add(tile.model);
|
||||||
this.onTileLoad(tile);
|
this.onTileLoad(tile);
|
||||||
|
Loading…
Reference in New Issue
Block a user