Removed pending state since it seems no longer necessary.
This commit is contained in:
parent
fa25d13469
commit
3b6402a682
90
dist/iwmlib.pixi.js
vendored
90
dist/iwmlib.pixi.js
vendored
@ -7260,7 +7260,7 @@
|
||||
let resizeW = r * Math.cos(Angle.degree2radian(phiCorrected));
|
||||
let resizeH = -r * Math.sin(Angle.degree2radian(phiCorrected));
|
||||
|
||||
if (this.element.offsetWidth + resizeW / this.scale > this.width * 0.3 && this.element.offsetHeight + resizeH / this.scale > this.height * 0.3) TweenLite.to(this.element, 0, { width: this.element.offsetWidth + resizeW / this.scale, height: this.element.offsetHeight + resizeH / this.scale });
|
||||
if ((this.element.offsetWidth + resizeW) / this.scale > this.width * 0.5 / this.scale && (this.element.offsetHeight + resizeH) / this.scale > this.height * 0.3 / this.scale) TweenLite.to(this.element, 0, { width: this.element.offsetWidth + resizeW / this.scale, height: this.element.offsetHeight + resizeH / this.scale });
|
||||
|
||||
this.oldX = e.clientX;
|
||||
this.oldY = e.clientY;
|
||||
@ -7805,7 +7805,7 @@
|
||||
/* globals PIXI, console*/
|
||||
|
||||
const registeredTiles = new Map();
|
||||
const pendingTiles = new Map();
|
||||
// const pendingTiles = new Map()
|
||||
/** Implements a baseTexture cache. The last textures are kept for reuse */
|
||||
let keepTextures = 0;
|
||||
const keptTextures = [];
|
||||
@ -7840,14 +7840,35 @@
|
||||
* @param {*} url
|
||||
* @memberof Tile
|
||||
*/
|
||||
static schedule(url) {
|
||||
let count = 0;
|
||||
/* static schedule(url) {
|
||||
let count = 0
|
||||
if (pendingTiles.has(url)) {
|
||||
count = pendingTiles.get(url);
|
||||
count = pendingTiles.get(url)
|
||||
}
|
||||
pendingTiles.set(url, count + 1);
|
||||
pendingTiles.set(url, count + 1)
|
||||
// console.log("Tile.scheduled", url, pendingTiles.size)
|
||||
}
|
||||
} */
|
||||
|
||||
/**
|
||||
* 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)
|
||||
} */
|
||||
|
||||
|
||||
/**
|
||||
* Returns true iff the url is pending
|
||||
@ -7857,9 +7878,9 @@
|
||||
* @returns
|
||||
* @memberof Tile
|
||||
*/
|
||||
static isPending(url) {
|
||||
/*static isPending(url) {
|
||||
return pendingTiles.has(url) && pendingTiles.get(url) > 0
|
||||
}
|
||||
} */
|
||||
|
||||
static isObsolete(url) {
|
||||
if (registeredTiles.has(url) && registeredTiles.get(url) > 0) {
|
||||
@ -7868,26 +7889,6 @@
|
||||
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.
|
||||
*
|
||||
@ -7910,7 +7911,7 @@
|
||||
* @memberof Tile
|
||||
*/
|
||||
register(url, debug = false) {
|
||||
Tile.unschedule(url);
|
||||
//Tile.unschedule(url)
|
||||
if (registeredTiles.has(url)) {
|
||||
let tiles = registeredTiles.get(url);
|
||||
tiles.add(this);
|
||||
@ -7964,7 +7965,7 @@
|
||||
}
|
||||
else {
|
||||
// No longer registered and not pending
|
||||
if (count <= 0 && !Tile.isPending(this.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);
|
||||
@ -8053,7 +8054,7 @@
|
||||
if (this.loaded.has(url)) return false
|
||||
if (this.loading.has(url)) return false
|
||||
|
||||
Tile.schedule(url);
|
||||
//Tile.schedule(url)
|
||||
this.map.set(url, [col, row]);
|
||||
this.loading.add(url);
|
||||
this.loadQueue.push(url);
|
||||
@ -8063,7 +8064,7 @@
|
||||
unschedule(url) {
|
||||
if (this.loaded.has(url)) this.loaded.delete(url);
|
||||
if (this.loading.has(url)) this.loading.delete(url);
|
||||
Tile.unschedule(url);
|
||||
//Tile.unschedule(url)
|
||||
this.loadQueue = this.loadQueue.filter(item => item != url);
|
||||
}
|
||||
|
||||
@ -8123,7 +8124,7 @@
|
||||
if (this.loaded.has(url)) return false
|
||||
if (this.loading.has(url)) return false
|
||||
|
||||
Tile.schedule(url);
|
||||
//Tile.schedule(url)
|
||||
let reusableTexture = Tile.textureAvailable(url);
|
||||
if (reusableTexture) {
|
||||
if (this.debug) console.log('Texture reusable', reusableTexture);
|
||||
@ -8646,9 +8647,6 @@
|
||||
return n % 2 == 0
|
||||
}
|
||||
|
||||
function printTileCacheInfos() {
|
||||
Tile.printInfos();
|
||||
}
|
||||
/**
|
||||
* A utility class that holds information typically provided by DZI files, i.e.
|
||||
* height and width of the overall image, overlap, and image type.
|
||||
@ -9275,9 +9273,9 @@
|
||||
}
|
||||
|
||||
worldBounds() {
|
||||
let viewBounds = this.app.scene.bounds; // UO: Never use getBounds()
|
||||
let viewBounds = this.app.scene.bounds || this.app.scene.getBounds();
|
||||
// Using getBounds extends visible scope after loading tiles and leads
|
||||
// to excessive loading
|
||||
// to excessive loading. So we prefer bounds over getBounds()
|
||||
if (this.world != null) {
|
||||
let bounds = this.world.bounds;
|
||||
let x = Math.max(-bounds.width, bounds.x);
|
||||
@ -9722,7 +9720,6 @@
|
||||
this.active = false;
|
||||
this.destroyAllTiles();
|
||||
this.tileContainer.destroy({ children: true });
|
||||
printTileCacheInfos();
|
||||
}
|
||||
|
||||
throwFinished() {
|
||||
@ -9732,20 +9729,7 @@
|
||||
if (typeof currentTiles == 'undefined') {
|
||||
return
|
||||
}
|
||||
|
||||
this.ensureTiles(this.currentLevel);
|
||||
// let all = new Set()
|
||||
// for (let tile of currentTiles.children) {
|
||||
// all.add(tile.url)
|
||||
// }
|
||||
// let { centerCol, centerRow, needed } = this.neededTiles(currentTiles, this.currentLevel)
|
||||
// for (let [url, col, row] of needed) {
|
||||
// all.delete(url)
|
||||
// }
|
||||
// for (let url of all) {
|
||||
// currentTiles.destroyTileByUrl(url)
|
||||
// }
|
||||
// currentTiles.loader.loader.reset()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,9 +7,6 @@ function isEven(n) {
|
||||
return n % 2 == 0
|
||||
}
|
||||
|
||||
function printTileCacheInfos() {
|
||||
Tile.printInfos()
|
||||
}
|
||||
/**
|
||||
* A utility class that holds information typically provided by DZI files, i.e.
|
||||
* height and width of the overall image, overlap, and image type.
|
||||
@ -636,9 +633,9 @@ export class DeepZoomImage extends PIXI.Container {
|
||||
}
|
||||
|
||||
worldBounds() {
|
||||
let viewBounds = this.app.scene.bounds // UO: Never use getBounds()
|
||||
let viewBounds = this.app.scene.bounds || this.app.scene.getBounds()
|
||||
// Using getBounds extends visible scope after loading tiles and leads
|
||||
// to excessive loading
|
||||
// to excessive loading. So we prefer bounds over getBounds()
|
||||
if (this.world != null) {
|
||||
let bounds = this.world.bounds
|
||||
let x = Math.max(-bounds.width, bounds.x)
|
||||
@ -1083,7 +1080,6 @@ export class DeepZoomImage extends PIXI.Container {
|
||||
this.active = false
|
||||
this.destroyAllTiles()
|
||||
this.tileContainer.destroy({ children: true })
|
||||
printTileCacheInfos()
|
||||
}
|
||||
|
||||
throwFinished() {
|
||||
@ -1093,19 +1089,6 @@ export class DeepZoomImage extends PIXI.Container {
|
||||
if (typeof currentTiles == 'undefined') {
|
||||
return
|
||||
}
|
||||
|
||||
this.ensureTiles(this.currentLevel)
|
||||
// let all = new Set()
|
||||
// for (let tile of currentTiles.children) {
|
||||
// all.add(tile.url)
|
||||
// }
|
||||
// let { centerCol, centerRow, needed } = this.neededTiles(currentTiles, this.currentLevel)
|
||||
// for (let [url, col, row] of needed) {
|
||||
// all.delete(url)
|
||||
// }
|
||||
// for (let url of all) {
|
||||
// currentTiles.destroyTileByUrl(url)
|
||||
// }
|
||||
// currentTiles.loader.loader.reset()
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ export class TileLoader {
|
||||
if (this.loaded.has(url)) return false
|
||||
if (this.loading.has(url)) return false
|
||||
|
||||
Tile.schedule(url)
|
||||
//Tile.schedule(url)
|
||||
this.map.set(url, [col, row])
|
||||
this.loading.add(url)
|
||||
this.loadQueue.push(url)
|
||||
@ -39,7 +39,7 @@ export class TileLoader {
|
||||
unschedule(url) {
|
||||
if (this.loaded.has(url)) this.loaded.delete(url)
|
||||
if (this.loading.has(url)) this.loading.delete(url)
|
||||
Tile.unschedule(url)
|
||||
//Tile.unschedule(url)
|
||||
this.loadQueue = this.loadQueue.filter(item => item != url)
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ export class PIXITileLoader extends TileLoader {
|
||||
if (this.loaded.has(url)) return false
|
||||
if (this.loading.has(url)) return false
|
||||
|
||||
Tile.schedule(url)
|
||||
//Tile.schedule(url)
|
||||
let reusableTexture = Tile.textureAvailable(url)
|
||||
if (reusableTexture) {
|
||||
if (this.debug) console.log('Texture reusable', reusableTexture)
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* globals PIXI, console*/
|
||||
|
||||
const registeredTiles = new Map()
|
||||
const pendingTiles = new Map()
|
||||
// const pendingTiles = new Map()
|
||||
/** Implements a baseTexture cache. The last textures are kept for reuse */
|
||||
let keepTextures = 0
|
||||
const keptTextures = []
|
||||
@ -37,33 +37,14 @@ export default class Tile extends PIXI.Sprite {
|
||||
* @param {*} url
|
||||
* @memberof Tile
|
||||
*/
|
||||
static schedule(url) {
|
||||
/* 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.
|
||||
@ -72,7 +53,7 @@ export default class Tile extends PIXI.Sprite {
|
||||
* @param {*} url
|
||||
* @memberof Tile
|
||||
*/
|
||||
static unschedule(url) {
|
||||
/* static unschedule(url) {
|
||||
if (pendingTiles.has(url)) {
|
||||
let count = pendingTiles.get(url)
|
||||
if (count > 1) {
|
||||
@ -83,6 +64,26 @@ export default class Tile extends PIXI.Sprite {
|
||||
}
|
||||
}
|
||||
// console.log("Tile.unscheduled", 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
|
||||
}
|
||||
|
||||
/**
|
||||
@ -107,7 +108,7 @@ export default class Tile extends PIXI.Sprite {
|
||||
* @memberof Tile
|
||||
*/
|
||||
register(url, debug = false) {
|
||||
Tile.unschedule(url)
|
||||
//Tile.unschedule(url)
|
||||
if (registeredTiles.has(url)) {
|
||||
let tiles = registeredTiles.get(url)
|
||||
tiles.add(this)
|
||||
@ -161,7 +162,7 @@ export default class Tile extends PIXI.Sprite {
|
||||
}
|
||||
else {
|
||||
// No longer registered and not pending
|
||||
if (count <= 0 && !Tile.isPending(this.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)
|
||||
|
Loading…
Reference in New Issue
Block a user