Added warning to Tile.destroy
This commit is contained in:
@@ -62,9 +62,14 @@ export class TileLoader {
|
||||
console.warn("Tile already loaded")
|
||||
tile.unregister()
|
||||
}
|
||||
tile = new Tile(texture, url)
|
||||
this.loaded.set(url, tile)
|
||||
this.tiles.tileAvailable(tile, col, row, url)
|
||||
try {
|
||||
tile = new Tile(texture, url)
|
||||
this.loaded.set(url, tile)
|
||||
this.tiles.tileAvailable(tile, col, row, url)
|
||||
} catch (error) {
|
||||
console.warn("Tile loading error", error)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,9 +59,6 @@ export class Tile extends PIXI.Sprite {
|
||||
* @memberof Tile
|
||||
*/
|
||||
destroy(options, debug = false) {
|
||||
if (this.parent != null) {
|
||||
|
||||
}
|
||||
let count = this.unregister()
|
||||
if (count <= 0) {
|
||||
let opts = { children: true, texture: true, baseTexture: true }
|
||||
@@ -73,5 +70,10 @@ export class Tile extends PIXI.Sprite {
|
||||
if (debug) console.log("Tile.destroy", deepZoomTileCache.size, opts)
|
||||
super.destroy(opts)
|
||||
}
|
||||
if (this.parent != null) {
|
||||
// UO: Emit warning and remove
|
||||
console.warn("Destroying tile with parent. Hiding instead")
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user