diff --git a/dist/iwmlib.js b/dist/iwmlib.js index ebbf69a..968a683 100644 --- a/dist/iwmlib.js +++ b/dist/iwmlib.js @@ -3232,7 +3232,9 @@ keepOnStage(velocity, collision = 0.5) { let stagePolygon = this.containerPolygon; - if (!stagePolygon) return + // UO: since keepOnStage is called in nextVelocity we need to + // ensure a return value + if (!stagePolygon) return { x: 0, y: 0} let polygon = this.polygon; let bounced = this.bouncing(); if (bounced) { diff --git a/dist/iwmlib.pixi.js b/dist/iwmlib.pixi.js index 6840a1b..f674929 100644 --- a/dist/iwmlib.pixi.js +++ b/dist/iwmlib.pixi.js @@ -6396,7 +6396,9 @@ keepOnStage(velocity, collision = 0.5) { let stagePolygon = this.containerPolygon; - if (!stagePolygon) return + // UO: since keepOnStage is called in nextVelocity we need to + // ensure a return value + if (!stagePolygon) return { x: 0, y: 0} let polygon = this.polygon; let bounced = this.bouncing(); if (bounced) { @@ -7854,7 +7856,6 @@ * @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 }; @@ -7866,6 +7867,11 @@ 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; + } } } @@ -7931,9 +7937,14 @@ 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); + } + } } diff --git a/lib/pixi/deepzoom/loader.js b/lib/pixi/deepzoom/loader.js index 86aed38..b3dfe84 100644 --- a/lib/pixi/deepzoom/loader.js +++ b/lib/pixi/deepzoom/loader.js @@ -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) + } + } } diff --git a/lib/pixi/deepzoom/tile.js b/lib/pixi/deepzoom/tile.js index 7599b96..d9ccdb5 100644 --- a/lib/pixi/deepzoom/tile.js +++ b/lib/pixi/deepzoom/tile.js @@ -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 + } } }