concluded merge

This commit is contained in:
Manfred Knobloch 2019-06-03 09:46:24 +02:00
commit e3d167bd7f
17 changed files with 375 additions and 102 deletions

13
dist/iwmlib.js vendored
View File

@ -2336,6 +2336,8 @@
onMouseWheel(event) { onMouseWheel(event) {
if (this.capture(event) && this.target.onMouseWheel) { if (this.capture(event) && this.target.onMouseWheel) {
this.target.onMouseWheel(event); this.target.onMouseWheel(event);
} else {
//console.warn('Target has no onMouseWheel callback')
} }
} }
@ -2529,6 +2531,8 @@
} }
if (this.target.onMouseWheel) { if (this.target.onMouseWheel) {
this.target.onMouseWheel(event); this.target.onMouseWheel(event);
} else {
//console.warn('Target has no onMouseWheel callback', this.target)
} }
} }
} }
@ -3232,7 +3236,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) {
@ -4200,7 +4206,10 @@
let event = new ResizeEvent(this, { width: w, height: h }); let event = new ResizeEvent(this, { width: w, height: h });
this.onResize(event); this.onResize(event);
} }
if (this.resizeButton != null) ; if (this.resizeButton != null) {
// this.resizeButton.style.width = 50/this.scale+"px"
// this.resizeButton.style.height = 50/this.scale+"px"
}
} }
startResize(e) { startResize(e) {

214
dist/iwmlib.pixi.js vendored
View File

@ -5500,6 +5500,8 @@
onMouseWheel(event) { onMouseWheel(event) {
if (this.capture(event) && this.target.onMouseWheel) { if (this.capture(event) && this.target.onMouseWheel) {
this.target.onMouseWheel(event); this.target.onMouseWheel(event);
} else {
//console.warn('Target has no onMouseWheel callback')
} }
} }
@ -5693,6 +5695,8 @@
} }
if (this.target.onMouseWheel) { if (this.target.onMouseWheel) {
this.target.onMouseWheel(event); this.target.onMouseWheel(event);
} else {
//console.warn('Target has no onMouseWheel callback', this.target)
} }
} }
} }
@ -6396,7 +6400,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) {
@ -7202,7 +7208,10 @@
let event = new ResizeEvent(this, { width: w, height: h }); let event = new ResizeEvent(this, { width: w, height: h });
this.onResize(event); this.onResize(event);
} }
if (this.resizeButton != null) ; if (this.resizeButton != null) {
// this.resizeButton.style.width = 50/this.scale+"px"
// this.resizeButton.style.height = 50/this.scale+"px"
}
} }
startResize(e) { startResize(e) {
@ -7794,8 +7803,11 @@
} }
} }
const deepZoomTileCache = new Map(); const registeredTiles = new Map();
const pendingTiles = new Map();
/** Implements a baseTexture cache. The last textures are kept for reuse */
const keepBaseTextures = 0;
const keptBaseTextures = [];
/** The current Tile implementation simply uses PIXI.Sprites. /** The current Tile implementation simply uses PIXI.Sprites.
* *
@ -7809,6 +7821,74 @@
this.register(url); this.register(url);
} }
/**
* Static method to enable keeping of base textures
*
* @static
* @param {*} value
* @memberof Tile
*/
static enableKeepBaseTextures(value = 1000) {
keepBaseTextures = value;
}
/**
* Marks the given url as pending. Pending tiles should not be destroyed
*
* @static
* @param {*} url
* @memberof Tile
*/
static schedule(url) {
let count = 0;
if (pendingTiles.has(url)) {
count = pendingTiles.get(url);
}
pendingTiles.set(url, count + 1);
// console.log("Tile.scheduled", url, pendingTiles.size)
}
/**
* Returns true iff the url is pending
*
* @static
* @returns
* @memberof Tile
*/
static isPending() {
return pendingTiles.has(url) && pendingTiles.get(url) > 0
}
/**
* Removes the given url from pending urls.
*
* @static
* @param {*} url
* @memberof Tile
*/
static unschedule(url) {
if (pendingTiles.has(url)) {
let count = pendingTiles.get(url);
if (count > 1) {
pendingTiles.set(url, count - 1);
}
else {
pendingTiles.clear(url);
}
}
// console.log("Tile.unscheduled", url, pendingTiles.size)
}
/**
* Loads a tile from image using the PIXI.Texture.fromImage method.
*
* @static
* @param {*} imageId
* @param {*} crossorigin
* @param {*} scaleMode
* @returns
* @memberof Tile
*/
static fromImage(imageId, crossorigin, scaleMode) { static fromImage(imageId, crossorigin, scaleMode) {
return new Tile(PIXI.Texture.fromImage(imageId, crossorigin, scaleMode), imageId) return new Tile(PIXI.Texture.fromImage(imageId, crossorigin, scaleMode), imageId)
} }
@ -7821,13 +7901,14 @@
* @memberof Tile * @memberof Tile
*/ */
register(url, debug = false) { register(url, debug = false) {
if (deepZoomTileCache.has(url)) { Tile.unschedule(url);
let tiles = deepZoomTileCache.get(url); if (registeredTiles.has(url)) {
let tiles = registeredTiles.get(url);
tiles.add(this); tiles.add(this);
if (debug) console.log("Tile.register", url, tiles.size); if (debug) console.log("Tile.register", url, tiles.size);
} }
else { else {
deepZoomTileCache.set(url, new Set([this])); registeredTiles.set(url, new Set([this]));
if (debug) console.log("Tile.register", url, 1); if (debug) console.log("Tile.register", url, 1);
} }
} }
@ -7839,10 +7920,10 @@
* @memberof Tile * @memberof Tile
*/ */
unregister() { unregister() {
let tiles = deepZoomTileCache.get(this.url); let tiles = registeredTiles.get(this.url);
tiles.delete(this); tiles.delete(this);
if (tiles.size == 0) { if (tiles.size == 0) {
deepZoomTileCache.delete(this.url); registeredTiles.delete(this.url);
} }
return tiles.size return tiles.size
} }
@ -7853,19 +7934,75 @@
* @param {*} options Part of the PIXI API, but ignored in the implementation * @param {*} options Part of the PIXI API, but ignored in the implementation
* @memberof Tile * @memberof Tile
*/ */
destroy(options, debug = false) { destroy(options, debug = true) {
if (this.parent != null) ;
let count = this.unregister(); let count = this.unregister();
if (count <= 0) {
let opts = { children: true, texture: true, baseTexture: true }; if (keepBaseTextures > 0) {
keptBaseTextures.push({ url: this.url, texture: this.texture.baseTexture});
let opts = { children: true, texture: false, baseTexture: false };
if (debug) console.log("Tile.destroy", registeredTiles.size, opts);
super.destroy(opts); super.destroy(opts);
if (debug) console.log("Tile.destroy", deepZoomTileCache.size, 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);
}
}
} }
else { else {
let opts = { children: true, texture: false, baseTexture: false }; // No longer registered and not pending
if (debug) console.log("Tile.destroy", deepZoomTileCache.size, opts); if (count <= 0 && !Tile.isPending(url)) {
super.destroy(opts); let opts = { children: true, texture: true, baseTexture: true };
super.destroy(opts);
if (debug) console.log("Tile.destroy", registeredTiles.size, opts);
}
else {
let opts = { children: true, texture: false, baseTexture: false };
if (debug) console.log("Tile.destroy", registeredTiles.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;
}
} }
}
/**
* Returns an available texture that can be reused
*
* @param {*} url
* @returns
* @memberof Tile
*/
static textureAvailable(url) {
if (registeredTiles.has(url)) {
let tiles = registeredTiles.get(url);
for (let tile of tiles.values()) {
//console.log("Reusing cached texture", tile.parent)
return tile.texture
}
}
return null
}
static printInfos() {
let references = new Map();
let multiples = 0;
for (let [url, tiles] of registeredTiles.entries()) {
let count = tiles.size;
references.set(url, count);
if (count > 1) {
multiples += 1;
}
}
console.log({ multiples, references });
} }
} }
@ -7897,6 +8034,8 @@
schedule(url, col, row) { schedule(url, col, row) {
if (this.loaded.has(url)) return false if (this.loaded.has(url)) return false
if (this.loading.has(url)) return false if (this.loading.has(url)) return false
Tile.schedule(url);
this.map.set(url, [col, row]); this.map.set(url, [col, row]);
this.loading.add(url); this.loading.add(url);
this.loadQueue.push(url); this.loadQueue.push(url);
@ -7906,6 +8045,7 @@
unschedule(url) { unschedule(url) {
if (this.loaded.has(url)) this.loaded.delete(url); if (this.loaded.has(url)) this.loaded.delete(url);
if (this.loading.has(url)) this.loading.delete(url); if (this.loading.has(url)) this.loading.delete(url);
Tile.unschedule(url);
this.loadQueue = this.loadQueue.filter(item => item != url); this.loadQueue = this.loadQueue.filter(item => item != url);
} }
@ -7931,9 +8071,14 @@
console.warn("Tile already loaded"); console.warn("Tile already loaded");
tile.unregister(); tile.unregister();
} }
tile = new Tile(texture, url); try {
this.loaded.set(url, tile); tile = new Tile(texture, url);
this.tiles.tileAvailable(tile, col, row, url); this.loaded.set(url, tile);
this.tiles.tileAvailable(tile, col, row, url);
} catch (error) {
console.warn("Tile loading error", error);
}
} }
} }
@ -7960,16 +8105,13 @@
if (this.loaded.has(url)) return false if (this.loaded.has(url)) return false
if (this.loading.has(url)) return false if (this.loading.has(url)) return false
if (deepZoomTileCache.has(url)) { Tile.schedule(url);
let tiles = deepZoomTileCache.get(url); let reusableTexture = Tile.textureAvailable(url);
for (let tile of tiles.values()) { if (reusableTexture) {
//console.log("Reusing cached texture", tile.parent) if (this.debug) console.log('Texture reusable', reusableTexture);
let texture = tile.texture; this._textureAvailable(url, col, row, reusableTexture);
this._textureAvailable(url, col, row, texture); return false
return false
}
} }
let texture = PIXI.utils.TextureCache[url]; let texture = PIXI.utils.TextureCache[url];
if (texture) { if (texture) {
if (this.debug) console.log('Texture already loaded', texture); if (this.debug) console.log('Texture already loaded', texture);
@ -8486,18 +8628,8 @@
return n % 2 == 0 return n % 2 == 0
} }
function printTileCacheInfos() { function printTileCacheInfos() {
let references = new Map(); Tile.printInfos();
let multiples = 0;
for (let [url, tiles] of deepZoomTileCache.entries()) {
let count = tiles.size;
references.set(url, count);
if (count > 1) {
multiples += 1;
}
}
console.log({ multiples, references });
} }
/** /**
* A utility class that holds information typically provided by DZI files, i.e. * A utility class that holds information typically provided by DZI files, i.e.
@ -8903,7 +9035,7 @@
this.minimumLevel = deepZoomInfo.baseLevel; this.minimumLevel = deepZoomInfo.baseLevel;
} }
this.currentLevel = Math.max(this.minimumLevel, deepZoomInfo.baseLevel); this.currentLevel = Math.max(this.minimumLevel, deepZoomInfo.baseLevel);
console.log("autoLoadTiles", this.autoLoadTiles); //console.log("autoLoadTiles", this.autoLoadTiles)
if (this.autoLoadTiles) { if (this.autoLoadTiles) {
this.setupTiles(center); this.setupTiles(center);
} }

View File

@ -1864,7 +1864,7 @@ export class DeepZoomImage extends PIXI.Container {
this.minimumLevel = deepZoomInfo.baseLevel this.minimumLevel = deepZoomInfo.baseLevel
} }
this.currentLevel = Math.max(this.minimumLevel, deepZoomInfo.baseLevel) this.currentLevel = Math.max(this.minimumLevel, deepZoomInfo.baseLevel)
console.log("autoLoadTiles", this.autoLoadTiles) //console.log("autoLoadTiles", this.autoLoadTiles)
if (this.autoLoadTiles) { if (this.autoLoadTiles) {
this.setupTiles(center) this.setupTiles(center)
} }

View File

@ -101,7 +101,7 @@
minScale: 0, minScale: 0,
maxScale: 50, maxScale: 50,
onTransform: event => { onTransform: event => {
console.log('currentLevel', deepZoomImage1.currentLevel) //console.log('currentLevel', deepZoomImage1.currentLevel)
deepZoomImage1.transformed(event) deepZoomImage1.transformed(event)
} }
}) })

View File

@ -1,24 +1,14 @@
import { Capabilities } from '../../capabilities.js' import { Capabilities } from '../../capabilities.js'
import { Points } from '../../utils.js' import { Points } from '../../utils.js'
import { deepZoomTileCache } from './tile.js' import Tile from './tile.js'
import { Tiles } from './tiles.js' import { Tiles } from './tiles.js'
function isEven(n) { function isEven(n) {
return n % 2 == 0 return n % 2 == 0
} }
function printTileCacheInfos() { function printTileCacheInfos() {
let references = new Map() Tile.printInfos()
let multiples = 0
for (let [url, tiles] of deepZoomTileCache.entries()) {
let count = tiles.size
references.set(url, count)
if (count > 1) {
multiples += 1
}
}
console.log({ multiples, references })
} }
/** /**
* A utility class that holds information typically provided by DZI files, i.e. * A utility class that holds information typically provided by DZI files, i.e.
@ -424,7 +414,7 @@ export class DeepZoomImage extends PIXI.Container {
this.minimumLevel = deepZoomInfo.baseLevel this.minimumLevel = deepZoomInfo.baseLevel
} }
this.currentLevel = Math.max(this.minimumLevel, deepZoomInfo.baseLevel) this.currentLevel = Math.max(this.minimumLevel, deepZoomInfo.baseLevel)
console.log("autoLoadTiles", this.autoLoadTiles) //console.log("autoLoadTiles", this.autoLoadTiles)
if (this.autoLoadTiles) { if (this.autoLoadTiles) {
this.setupTiles(center) this.setupTiles(center)
} }

View File

@ -1,4 +1,4 @@
import { deepZoomTileCache, Tile } from './tile.js' import Tile from './tile.js'
/** /**
* A Tile Loader component that can be plugged into a Tiles Layer. * A Tile Loader component that can be plugged into a Tiles Layer.
@ -28,6 +28,8 @@ export class TileLoader {
schedule(url, col, row) { schedule(url, col, row) {
if (this.loaded.has(url)) return false if (this.loaded.has(url)) return false
if (this.loading.has(url)) return false if (this.loading.has(url)) return false
Tile.schedule(url)
this.map.set(url, [col, row]) this.map.set(url, [col, row])
this.loading.add(url) this.loading.add(url)
this.loadQueue.push(url) this.loadQueue.push(url)
@ -37,6 +39,7 @@ export class TileLoader {
unschedule(url) { unschedule(url) {
if (this.loaded.has(url)) this.loaded.delete(url) if (this.loaded.has(url)) this.loaded.delete(url)
if (this.loading.has(url)) this.loading.delete(url) if (this.loading.has(url)) this.loading.delete(url)
Tile.unschedule(url)
this.loadQueue = this.loadQueue.filter(item => item != url) this.loadQueue = this.loadQueue.filter(item => item != url)
} }
@ -62,9 +65,14 @@ export class TileLoader {
console.warn("Tile already loaded") console.warn("Tile already loaded")
tile.unregister() tile.unregister()
} }
tile = new Tile(texture, url) try {
this.loaded.set(url, tile) tile = new Tile(texture, url)
this.tiles.tileAvailable(tile, col, row, url) this.loaded.set(url, tile)
this.tiles.tileAvailable(tile, col, row, url)
} catch (error) {
console.warn("Tile loading error", error)
}
} }
} }
@ -91,16 +99,13 @@ export class PIXITileLoader extends TileLoader {
if (this.loaded.has(url)) return false if (this.loaded.has(url)) return false
if (this.loading.has(url)) return false if (this.loading.has(url)) return false
if (deepZoomTileCache.has(url)) { Tile.schedule(url)
let tiles = deepZoomTileCache.get(url) let reusableTexture = Tile.textureAvailable(url)
for (let tile of tiles.values()) { if (reusableTexture) {
//console.log("Reusing cached texture", tile.parent) if (this.debug) console.log('Texture reusable', reusableTexture)
let texture = tile.texture this._textureAvailable(url, col, row, reusableTexture)
this._textureAvailable(url, col, row, texture) return false
return false
}
} }
let texture = PIXI.utils.TextureCache[url] let texture = PIXI.utils.TextureCache[url]
if (texture) { if (texture) {
if (this.debug) console.log('Texture already loaded', texture) if (this.debug) console.log('Texture already loaded', texture)
@ -155,8 +160,8 @@ export class PIXITileLoader extends TileLoader {
_onLoaded(loader, resource) { _onLoaded(loader, resource) {
if (this.destroyed) { if (this.destroyed) {
let texture = resource.texture let texture = resource.texture
let destroyBase = !deepZoomTileCache.has(resource.url) let url = resource.url
texture.destroy(destroyBase) Tile.lateTexture(url, texture)
console.warn("Received resource after destroy", texture) console.warn("Received resource after destroy", texture)
return return
} }

View File

@ -1,19 +1,98 @@
export const deepZoomTileCache = new Map() const registeredTiles = new Map()
const pendingTiles = new Map()
/** Implements a baseTexture cache. The last textures are kept for reuse */
let keepTextures = 0
const keptTextures = []
/** The current Tile implementation simply uses PIXI.Sprites. /** The current Tile implementation simply uses PIXI.Sprites.
* *
* BTW: PIXI.extras.TilingSprite is not appropriate. It should be used for * BTW: PIXI.extras.TilingSprite is not appropriate. It should be used for
* repeating patterns. * repeating patterns.
**/ **/
export class Tile extends PIXI.Sprite { export default class Tile extends PIXI.Sprite {
constructor(texture, url) { constructor(texture, url) {
super(texture) super(texture)
this.url = url this.url = url
this.register(url) this.register(url)
} }
/**
* Static method to enable keeping of base textures
*
* @static
* @param {*} value
* @memberof Tile
*/
static enableKeepTextures(value = 1000) {
keepTextures = value
}
/**
* Marks the given url as pending. Pending tiles should not be destroyed
*
* @static
* @param {*} url
* @memberof Tile
*/
static schedule(url) {
let count = 0
if (pendingTiles.has(url)) {
count = pendingTiles.get(url)
}
pendingTiles.set(url, count + 1)
// console.log("Tile.scheduled", url, pendingTiles.size)
}
/**
* Returns true iff the url is pending
*
* @static
* @param {*} url
* @returns
* @memberof Tile
*/
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.
*
* @static
* @param {*} url
* @memberof Tile
*/
static unschedule(url) {
if (pendingTiles.has(url)) {
let count = pendingTiles.get(url)
if (count > 1) {
pendingTiles.set(url, count - 1)
}
else {
pendingTiles.clear(url)
}
}
// console.log("Tile.unscheduled", url, pendingTiles.size)
}
/**
* Loads a tile from image using the PIXI.Texture.fromImage method.
*
* @static
* @param {*} imageId
* @param {*} crossorigin
* @param {*} scaleMode
* @returns
* @memberof Tile
*/
static fromImage(imageId, crossorigin, scaleMode) { static fromImage(imageId, crossorigin, scaleMode) {
return new Tile(PIXI.Texture.fromImage(imageId, crossorigin, scaleMode), imageId) return new Tile(PIXI.Texture.fromImage(imageId, crossorigin, scaleMode), imageId)
} }
@ -26,13 +105,14 @@ export class Tile extends PIXI.Sprite {
* @memberof Tile * @memberof Tile
*/ */
register(url, debug = false) { register(url, debug = false) {
if (deepZoomTileCache.has(url)) { Tile.unschedule(url)
let tiles = deepZoomTileCache.get(url) if (registeredTiles.has(url)) {
let tiles = registeredTiles.get(url)
tiles.add(this) tiles.add(this)
if (debug) console.log("Tile.register", url, tiles.size) if (debug) console.log("Tile.register", url, tiles.size)
} }
else { else {
deepZoomTileCache.set(url, new Set([this])) registeredTiles.set(url, new Set([this]))
if (debug) console.log("Tile.register", url, 1) if (debug) console.log("Tile.register", url, 1)
} }
} }
@ -44,10 +124,11 @@ export class Tile extends PIXI.Sprite {
* @memberof Tile * @memberof Tile
*/ */
unregister() { unregister() {
let tiles = deepZoomTileCache.get(this.url) let tiles = registeredTiles.get(this.url)
tiles.delete(this) tiles.delete(this)
if (tiles.size == 0) { if (tiles.size == 0) {
deepZoomTileCache.delete(this.url) registeredTiles.delete(this.url)
return 0
} }
return tiles.size return tiles.size
} }
@ -58,20 +139,82 @@ export class Tile extends PIXI.Sprite {
* @param {*} options Part of the PIXI API, but ignored in the implementation * @param {*} options Part of the PIXI API, but ignored in the implementation
* @memberof Tile * @memberof Tile
*/ */
destroy(options, debug = false) { destroy(options, debug = true) {
if (this.parent != null) {
}
let count = this.unregister() let count = this.unregister()
if (count <= 0) {
let opts = { children: true, texture: true, baseTexture: true } 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) super.destroy(opts)
if (debug) console.log("Tile.destroy", deepZoomTileCache.size, opts)
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 { else {
let opts = { children: true, texture: false, baseTexture: false } // No longer registered and not pending
if (debug) console.log("Tile.destroy", deepZoomTileCache.size, opts) if (count <= 0 && !Tile.isPending(this.url)) {
super.destroy(opts) let opts = { children: true, texture: true, baseTexture: true }
super.destroy(opts)
if (debug) console.log("Tile.destroy", registeredTiles.size, opts)
}
else {
let opts = { children: true, texture: false, baseTexture: false }
if (debug) console.log("Tile.destroy", registeredTiles.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
}
} }
} }
/**
* Returns an available texture that can be reused
*
* @param {*} url
* @returns
* @memberof Tile
*/
static textureAvailable(url) {
if (registeredTiles.has(url)) {
let tiles = registeredTiles.get(url)
for (let tile of tiles.values()) {
//console.log("Reusing cached texture", tile.parent)
return tile.texture
}
}
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
for (let [url, tiles] of registeredTiles.entries()) {
let count = tiles.size
references.set(url, count)
if (count > 1) {
multiples += 1
}
}
console.log({ multiples, references })
}
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -410,7 +410,9 @@ export class AbstractScatter extends Throwable {
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) {

10
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "iwmlib", "name": "iwmlib",
"version": "1.0.8", "version": "1.0.10",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -2770,14 +2770,6 @@
"integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=",
"dev": true "dev": true
}, },
"jsonfile": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
"integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
"requires": {
"graceful-fs": "^4.1.6"
}
},
"just-debounce": { "just-debounce": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/just-debounce/-/just-debounce-1.0.0.tgz", "resolved": "https://registry.npmjs.org/just-debounce/-/just-debounce-1.0.0.tgz",

View File

@ -1,6 +1,6 @@
{ {
"name": "iwmlib", "name": "iwmlib",
"version": "1.0.8", "version": "1.0.10",
"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": {