2 Commits

Author SHA1 Message Date
Uwe Oestermeier 67c6a6c95c Correct version number 2019-05-31 16:21:50 +02:00
Uwe Oestermeier 107529f844 Added warning to Tile.destroy 2019-05-31 16:10:46 +02:00
5 changed files with 33 additions and 13 deletions
+3 -1
View File
@@ -3232,7 +3232,9 @@
keepOnStage(velocity, collision = 0.5) { keepOnStage(velocity, collision = 0.5) {
let stagePolygon = this.containerPolygon; 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 polygon = this.polygon;
let bounced = this.bouncing(); let bounced = this.bouncing();
if (bounced) { if (bounced) {
+13 -2
View File
@@ -6396,7 +6396,9 @@
keepOnStage(velocity, collision = 0.5) { keepOnStage(velocity, collision = 0.5) {
let stagePolygon = this.containerPolygon; 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 polygon = this.polygon;
let bounced = this.bouncing(); let bounced = this.bouncing();
if (bounced) { if (bounced) {
@@ -7854,7 +7856,6 @@
* @memberof Tile * @memberof Tile
*/ */
destroy(options, debug = false) { destroy(options, debug = false) {
if (this.parent != null) ;
let count = this.unregister(); let count = this.unregister();
if (count <= 0) { if (count <= 0) {
let opts = { children: true, texture: true, baseTexture: true }; let opts = { children: true, texture: true, baseTexture: true };
@@ -7866,6 +7867,11 @@
if (debug) console.log("Tile.destroy", deepZoomTileCache.size, opts); if (debug) console.log("Tile.destroy", deepZoomTileCache.size, opts);
super.destroy(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"); console.warn("Tile already loaded");
tile.unregister(); tile.unregister();
} }
try {
tile = new Tile(texture, url); tile = new Tile(texture, url);
this.loaded.set(url, tile); this.loaded.set(url, tile);
this.tiles.tileAvailable(tile, col, row, url); this.tiles.tileAvailable(tile, col, row, url);
} catch (error) {
console.warn("Tile loading error", error);
}
} }
} }
+5
View File
@@ -62,9 +62,14 @@ export class TileLoader {
console.warn("Tile already loaded") console.warn("Tile already loaded")
tile.unregister() tile.unregister()
} }
try {
tile = new Tile(texture, url) tile = new Tile(texture, url)
this.loaded.set(url, tile) this.loaded.set(url, tile)
this.tiles.tileAvailable(tile, col, row, url) this.tiles.tileAvailable(tile, col, row, url)
} catch (error) {
console.warn("Tile loading error", error)
}
} }
} }
+5 -3
View File
@@ -59,9 +59,6 @@ export class Tile extends PIXI.Sprite {
* @memberof Tile * @memberof Tile
*/ */
destroy(options, debug = false) { destroy(options, debug = false) {
if (this.parent != null) {
}
let count = this.unregister() let count = this.unregister()
if (count <= 0) { if (count <= 0) {
let opts = { children: true, texture: true, baseTexture: true } 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) if (debug) console.log("Tile.destroy", deepZoomTileCache.size, opts)
super.destroy(opts) super.destroy(opts)
} }
if (this.parent != null) {
// UO: Emit warning and remove
console.warn("Destroying tile with parent. Hiding instead")
this.visible = false
}
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "iwmlib", "name": "iwmlib",
"version": "1.0.8", "version": "1.0.9",
"description": "An Open Source library for multi-touch, WebGL powered applications.", "description": "An Open Source library for multi-touch, WebGL powered applications.",
"main": "index.js", "main": "index.js",
"directories": { "directories": {