mirror of
https://github.com/BlueMap-Minecraft/BlueMapWeb.git
synced 2024-11-28 04:45:13 +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);
|
||||
tile.load(this.tileLoader)
|
||||
.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);
|
||||
this.loadTimeout = setTimeout(this.loadCloseTiles, 0);
|
||||
})
|
||||
.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");
|
||||
})
|
||||
.catch(error => {})
|
||||
.finally(() => {
|
||||
//this.tileMap.setTile(tile.x - this.centerTile.x + TileManager.tileMapHalfSize, tile.z - this.centerTile.y + TileManager.tileMapHalfSize, TileMap.LOADED);
|
||||
this.currentlyLoading--;
|
||||
});
|
||||
|
||||
@ -214,7 +204,7 @@ export class TileManager {
|
||||
}
|
||||
|
||||
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.onTileLoad(tile);
|
||||
|
Loading…
Reference in New Issue
Block a user