Added active flag to avoid transform of inactive deepzoom images.
This commit is contained in:
@@ -364,6 +364,7 @@ export class DeepZoomImage extends PIXI.Container {
|
||||
: 1
|
||||
this.alpha = alpha
|
||||
this.fastLoads = 0
|
||||
this.active = true
|
||||
this.autoLoadTiles = autoLoadTiles
|
||||
this.minimumLevel = minimumLevel
|
||||
this.quadTrees = new Map() // url as keys, TileQuadNodes as values
|
||||
@@ -1017,6 +1018,9 @@ export class DeepZoomImage extends PIXI.Container {
|
||||
* @param {boolean} debug - log debug infos
|
||||
*/
|
||||
transformed(event) {
|
||||
if (!this.active) {
|
||||
return
|
||||
}
|
||||
let key = this.currentLevel.toString()
|
||||
let currentTiles = this.tileLayers[key]
|
||||
if (typeof currentTiles == 'undefined') {
|
||||
@@ -1064,6 +1068,7 @@ export class DeepZoomImage extends PIXI.Container {
|
||||
* @memberof DeepZoomImage
|
||||
*/
|
||||
activate() {
|
||||
this.active = true
|
||||
this.destroyTilesAboveLevel(this.currentLevel)
|
||||
this.ensureTiles(this.currentLevel, null)
|
||||
//console.log("Activate Textures!", this.currentLevel)
|
||||
@@ -1075,6 +1080,7 @@ export class DeepZoomImage extends PIXI.Container {
|
||||
* @memberof DeepZoomImage
|
||||
*/
|
||||
deactivate() {
|
||||
this.active = false
|
||||
this.destroyAllTiles()
|
||||
this.tileContainer.destroy({ children: true })
|
||||
printTileCacheInfos()
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* ES Lint */
|
||||
/* globals PIXI, console*/
|
||||
|
||||
const registeredTiles = new Map()
|
||||
const pendingTiles = new Map()
|
||||
|
||||
+8
-3
@@ -173,11 +173,16 @@ class Throwable {
|
||||
}
|
||||
}
|
||||
|
||||
_throwDeltaTime() {
|
||||
let t = performance.now()
|
||||
let dt = t - this.lastframe
|
||||
this.lastframe = t
|
||||
return dt
|
||||
}
|
||||
|
||||
animateThrow(time) {
|
||||
if (this.velocity != null) {
|
||||
let t = performance.now()
|
||||
let dt = t - this.lastframe
|
||||
this.lastframe = t
|
||||
let dt = this._throwDeltaTime()
|
||||
// console.log("animateThrow", dt)
|
||||
let next = this.nextVelocity(this.velocity)
|
||||
let prevLength = Points.length(this.velocity)
|
||||
|
||||
Reference in New Issue
Block a user