diff --git a/dist/iwmlib.3rdparty.js b/dist/iwmlib.3rdparty.js index ee85538..6b23a37 100644 --- a/dist/iwmlib.3rdparty.js +++ b/dist/iwmlib.3rdparty.js @@ -92733,86 +92733,86 @@ module.exports = function (_Plugin) { },{}]},{},[13]); -/*jslint plusplus: true, vars: true, indent: 2 */ -/* convertPointFromPageToNode.js from - - - convertPointFromPageToNode(element, event.pageX, event.pageY) -> {x, y} - returns coordinate in element's local coordinate system (works properly - with css transforms without perspective projection) - convertPointFromNodeToPage(element, offsetX, offsetY) -> {x, y} - returns coordinate in window's coordinate system (works properly with - css transforms without perspective projection) -*/ - -(function () { - 'use strict' - - var I = (typeof(WebKitCSSMatrix) == 'undefined') ? new DOMMatrix() : new WebKitCSSMatrix() - - function Point(x, y, z) { - this.x = x - this.y = y - this.z = z - } - - Point.prototype.transformBy = function (matrix) { - var tmp = matrix.multiply(I.translate(this.x, this.y, this.z)) - return new Point(tmp.m41, tmp.m42, tmp.m43) - } - - function createMatrix(transform) { - try { - return (typeof(WebKitCSSMatrix) == 'undefined') ? new DOMMatrix(transform) : new WebKitCSSMatrix(transform) - } catch(e) { - console.warn(transform) - console.warn(e.toString()) - return I - } - } - - function getTransformationMatrix(element) { - var transformationMatrix = I - var x = element - - while (x != undefined && x !== x.ownerDocument.documentElement) { - var computedStyle = window.getComputedStyle(x, undefined) - var transform = computedStyle.transform || 'none' - var c = transform === 'none' ? I : createMatrix(transform) - transformationMatrix = c.multiply(transformationMatrix) - x = x.parentNode - } - - var w = element.offsetWidth - var h = element.offsetHeight - var i = 4 - var left = +Infinity - var top = +Infinity - while (--i >= 0) { - var p = new Point(i === 0 || i === 1 ? 0 : w, i === 0 || i === 3 ? 0 : h, - 0).transformBy(transformationMatrix) - if (p.x < left) { - left = p.x - } - if (p.y < top) { - top = p.y - } - } - var rect = element.getBoundingClientRect() - transformationMatrix = I.translate(window.pageXOffset + rect.left - left, - window.pageYOffset + rect.top - top, 0) - .multiply(transformationMatrix) - return transformationMatrix - } - - window.convertPointFromPageToNode = function (element, pageX, pageY) { - return new Point(pageX, pageY, 0).transformBy( - getTransformationMatrix(element).inverse()) - } - - window.convertPointFromNodeToPage = function (element, offsetX, offsetY) { - return new Point(offsetX, offsetY, 0).transformBy( - getTransformationMatrix(element)) - } - -}()) +/*jslint plusplus: true, vars: true, indent: 2 */ +/* convertPointFromPageToNode.js from + + + convertPointFromPageToNode(element, event.pageX, event.pageY) -> {x, y} + returns coordinate in element's local coordinate system (works properly + with css transforms without perspective projection) + convertPointFromNodeToPage(element, offsetX, offsetY) -> {x, y} + returns coordinate in window's coordinate system (works properly with + css transforms without perspective projection) +*/ + +(function () { + 'use strict' + + var I = (typeof(WebKitCSSMatrix) == 'undefined') ? new DOMMatrix() : new WebKitCSSMatrix() + + function Point(x, y, z) { + this.x = x + this.y = y + this.z = z + } + + Point.prototype.transformBy = function (matrix) { + var tmp = matrix.multiply(I.translate(this.x, this.y, this.z)) + return new Point(tmp.m41, tmp.m42, tmp.m43) + } + + function createMatrix(transform) { + try { + return (typeof(WebKitCSSMatrix) == 'undefined') ? new DOMMatrix(transform) : new WebKitCSSMatrix(transform) + } catch(e) { + console.warn(transform) + console.warn(e.toString()) + return I + } + } + + function getTransformationMatrix(element) { + var transformationMatrix = I + var x = element + + while (x != undefined && x !== x.ownerDocument.documentElement) { + var computedStyle = window.getComputedStyle(x, undefined) + var transform = computedStyle.transform || 'none' + var c = transform === 'none' ? I : createMatrix(transform) + transformationMatrix = c.multiply(transformationMatrix) + x = x.parentNode + } + + var w = element.offsetWidth + var h = element.offsetHeight + var i = 4 + var left = +Infinity + var top = +Infinity + while (--i >= 0) { + var p = new Point(i === 0 || i === 1 ? 0 : w, i === 0 || i === 3 ? 0 : h, + 0).transformBy(transformationMatrix) + if (p.x < left) { + left = p.x + } + if (p.y < top) { + top = p.y + } + } + var rect = element.getBoundingClientRect() + transformationMatrix = I.translate(window.pageXOffset + rect.left - left, + window.pageYOffset + rect.top - top, 0) + .multiply(transformationMatrix) + return transformationMatrix + } + + window.convertPointFromPageToNode = function (element, pageX, pageY) { + return new Point(pageX, pageY, 0).transformBy( + getTransformationMatrix(element).inverse()) + } + + window.convertPointFromNodeToPage = function (element, offsetX, offsetY) { + return new Point(offsetX, offsetY, 0).transformBy( + getTransformationMatrix(element)) + } + +}()) diff --git a/dist/iwmlib.js b/dist/iwmlib.js index 4e0dbb3..968a683 100644 --- a/dist/iwmlib.js +++ b/dist/iwmlib.js @@ -2336,8 +2336,6 @@ onMouseWheel(event) { if (this.capture(event) && this.target.onMouseWheel) { this.target.onMouseWheel(event); - } else { - //console.warn('Target has no onMouseWheel callback') } } @@ -2531,8 +2529,6 @@ } if (this.target.onMouseWheel) { this.target.onMouseWheel(event); - } else { - //console.warn('Target has no onMouseWheel callback', this.target) } } } @@ -4206,10 +4202,7 @@ let event = new ResizeEvent(this, { width: w, height: h }); this.onResize(event); } - if (this.resizeButton != null) { - // this.resizeButton.style.width = 50/this.scale+"px" - // this.resizeButton.style.height = 50/this.scale+"px" - } + if (this.resizeButton != null) ; } startResize(e) { diff --git a/dist/iwmlib.pixi.js b/dist/iwmlib.pixi.js index bf30c2a..968cf84 100644 --- a/dist/iwmlib.pixi.js +++ b/dist/iwmlib.pixi.js @@ -5500,8 +5500,6 @@ onMouseWheel(event) { if (this.capture(event) && this.target.onMouseWheel) { this.target.onMouseWheel(event); - } else { - //console.warn('Target has no onMouseWheel callback') } } @@ -5695,8 +5693,6 @@ } if (this.target.onMouseWheel) { this.target.onMouseWheel(event); - } else { - //console.warn('Target has no onMouseWheel callback', this.target) } } } @@ -7208,10 +7204,7 @@ let event = new ResizeEvent(this, { width: w, height: h }); this.onResize(event); } - if (this.resizeButton != null) { - // this.resizeButton.style.width = 50/this.scale+"px" - // this.resizeButton.style.height = 50/this.scale+"px" - } + if (this.resizeButton != null) ; } startResize(e) { @@ -7806,8 +7799,8 @@ const registeredTiles = new Map(); const pendingTiles = new Map(); /** Implements a baseTexture cache. The last textures are kept for reuse */ - const keepBaseTextures = 0; - const keptBaseTextures = []; + let keepTextures = 0; + const keptTextures = []; /** The current Tile implementation simply uses PIXI.Sprites. * @@ -7828,8 +7821,8 @@ * @param {*} value * @memberof Tile */ - static enableKeepBaseTextures(value = 1000) { - keepBaseTextures = value; + static enableKeepTextures(value = 1000) { + keepTextures = value; } /** @@ -7852,13 +7845,21 @@ * Returns true iff the url is pending * * @static + * @param {*} url * @returns * @memberof Tile */ - static isPending() { + static isPending(url) { return pendingTiles.has(url) && pendingTiles.get(url) > 0 } + static isObsolete(url) { + if (registeredTiles.has(url) && registeredTiles.get(url) > 0) { + return false + } + return true + } + /** * Removes the given url from pending urls. * @@ -7924,6 +7925,7 @@ tiles.delete(this); if (tiles.size == 0) { registeredTiles.delete(this.url); + return 0 } return tiles.size } @@ -7937,25 +7939,24 @@ destroy(options, debug = true) { let count = this.unregister(); - if (keepBaseTextures > 0) { - keptBaseTextures.push({ url: this.url, texture: this.texture.baseTexture}); + if (keepTextures > 0) { + keptTextures.push({ url: this.url, texture: this.texture}); let opts = { children: true, texture: false, baseTexture: false }; if (debug) console.log("Tile.destroy", registeredTiles.size, opts); super.destroy(opts); - while(keptBaseTextures.length > keepBaseTextures) { - let {url, texture} = keptBaseTextures.shift(); - let tiles = registeredTiles.get(url); - if (tiles.size > 0 && !Tile.isPending(url)) { - texture.destroy(); - if (debug) console.log("Destroying baseTexture", url); + while(keptTextures.length > keepTextures) { + let {url, texture} = keptTextures.shift(); + if (Tile.isObsolete(url)) { + texture.destroy(true); // Destroy base as well + if (debug) console.log("Destroying texture and baseTexture", url); } } } else { // No longer registered and not pending - if (count <= 0 && !Tile.isPending(url)) { + if (count <= 0 && !Tile.isPending(this.url)) { let opts = { children: true, texture: true, baseTexture: true }; super.destroy(opts); if (debug) console.log("Tile.destroy", registeredTiles.size, opts); @@ -7971,7 +7972,6 @@ this.visible = false; } } - } /** @@ -7992,6 +7992,16 @@ return null } + /** + * Texture received too late. We do not need it. + * @param {*} url + * @param {*} texture + */ + static lateTexture(url, texture) { + let destroyBase = !registeredTiles.has(url); + texture.destroy(destroyBase); + } + static printInfos() { let references = new Map(); let multiples = 0; @@ -8166,8 +8176,8 @@ _onLoaded(loader, resource) { if (this.destroyed) { let texture = resource.texture; - let destroyBase = !deepZoomTileCache.has(resource.url); - texture.destroy(destroyBase); + let url = resource.url; + Tile.lateTexture(url, texture); console.warn("Received resource after destroy", texture); return } diff --git a/lib/pixi/thumbnail.png b/lib/pixi/thumbnail.png index faf9b2e..3874702 100644 Binary files a/lib/pixi/thumbnail.png and b/lib/pixi/thumbnail.png differ diff --git a/lib/pixi/thumbnails/badge.png b/lib/pixi/thumbnails/badge.png index b1764f8..56c0d6b 100644 Binary files a/lib/pixi/thumbnails/badge.png and b/lib/pixi/thumbnails/badge.png differ diff --git a/lib/pixi/thumbnails/button.png b/lib/pixi/thumbnails/button.png index b557949..f27540e 100644 Binary files a/lib/pixi/thumbnails/button.png and b/lib/pixi/thumbnails/button.png differ diff --git a/lib/pixi/thumbnails/buttongroup.png b/lib/pixi/thumbnails/buttongroup.png index 9f69990..318bd83 100644 Binary files a/lib/pixi/thumbnails/buttongroup.png and b/lib/pixi/thumbnails/buttongroup.png differ diff --git a/lib/pixi/thumbnails/coordinates.png b/lib/pixi/thumbnails/coordinates.png index f37c3d0..de5cfb6 100644 Binary files a/lib/pixi/thumbnails/coordinates.png and b/lib/pixi/thumbnails/coordinates.png differ diff --git a/lib/pixi/thumbnails/flippable.png b/lib/pixi/thumbnails/flippable.png index 940cf9e..d26099d 100644 Binary files a/lib/pixi/thumbnails/flippable.png and b/lib/pixi/thumbnails/flippable.png differ diff --git a/lib/pixi/thumbnails/popup.png b/lib/pixi/thumbnails/popup.png index b23df46..f0aa561 100644 Binary files a/lib/pixi/thumbnails/popup.png and b/lib/pixi/thumbnails/popup.png differ diff --git a/lib/pixi/thumbnails/scatter.png b/lib/pixi/thumbnails/scatter.png index 1a610bf..58f7cee 100644 Binary files a/lib/pixi/thumbnails/scatter.png and b/lib/pixi/thumbnails/scatter.png differ diff --git a/lib/pixi/thumbnails/slider.png b/lib/pixi/thumbnails/slider.png index 74ee176..d24efb3 100644 Binary files a/lib/pixi/thumbnails/slider.png and b/lib/pixi/thumbnails/slider.png differ diff --git a/lib/pixi/thumbnails/volatile.png b/lib/pixi/thumbnails/volatile.png index e2ffaf8..ac1da17 100644 Binary files a/lib/pixi/thumbnails/volatile.png and b/lib/pixi/thumbnails/volatile.png differ diff --git a/lib/thumbnail.png b/lib/thumbnail.png index 02ac0b3..196e6eb 100644 Binary files a/lib/thumbnail.png and b/lib/thumbnail.png differ diff --git a/lib/thumbnails/events.png b/lib/thumbnails/events.png index b2fce42..ceea6d1 100644 Binary files a/lib/thumbnails/events.png and b/lib/thumbnails/events.png differ diff --git a/lib/thumbnails/popup.png b/lib/thumbnails/popup.png index 9ce33f6..8475e99 100644 Binary files a/lib/thumbnails/popup.png and b/lib/thumbnails/popup.png differ