Initial commit 2.0 beta 0

This commit is contained in:
2022-10-04 10:51:35 +02:00
parent f87b19140b
commit c5c2759ebd
70 changed files with 60593 additions and 62354 deletions
+12 -12
View File
@@ -155,7 +155,7 @@ export class DeepZoomInfo {
this.baseURL = this.urlForTile(this.baseLevel, 0, 0, false)
if (loadBaseImage) {
this.imageForURL(this.baseURL, e => {
this.imageForURL(this.baseURL, (e) => {
this.size = [e.target.naturalWidth, e.target.naturalHeight]
this.baseImage = e.target
})
@@ -332,7 +332,7 @@ export class DeepZoomImage extends PIXI.Container {
useWorker = '',
minimumLevel = 0,
alpha = 1,
app = window.app
app = window.app,
} = {}
) {
super()
@@ -708,7 +708,7 @@ export class DeepZoomImage extends PIXI.Container {
let changed = { added: [], removed: [] }
let newNeeded = new Map()
let { centerCol, centerRow, needed } = this.neededTiles(tiles, level)
needed.forEach(d => {
needed.forEach((d) => {
let [url, col, row] = d
newNeeded.set(url, [col, row])
if (!tiles.requested.has(url)) {
@@ -856,7 +856,7 @@ export class DeepZoomImage extends PIXI.Container {
}
hideTilesAboveLevel(level) {
Object.keys(this.tileLayers).forEach(key => {
Object.keys(this.tileLayers).forEach((key) => {
let tiles = this.tileLayers[key]
if (tiles.level > level) {
tiles.visible = false
@@ -869,7 +869,7 @@ export class DeepZoomImage extends PIXI.Container {
* @param {number} level - The zoom level of the grid
*/
destroyTilesAboveLevel(level) {
Object.keys(this.tileLayers).forEach(key => {
Object.keys(this.tileLayers).forEach((key) => {
let tiles = this.tileLayers[key]
if (tiles.level > level && !tiles.keep) {
for (let url of tiles.available.keys()) {
@@ -882,7 +882,7 @@ export class DeepZoomImage extends PIXI.Container {
}
destroyAllTiles() {
Object.keys(this.tileLayers).forEach(key => {
Object.keys(this.tileLayers).forEach((key) => {
this.destroyTiles(key)
})
}
@@ -893,7 +893,7 @@ export class DeepZoomImage extends PIXI.Container {
* @memberof DeepZoomImage
*/
tintObsoleteTiles() {
Object.keys(this.tileLayers).forEach(key => {
Object.keys(this.tileLayers).forEach((key) => {
let tiles = this.tileLayers[key]
tiles.untintTiles()
if (!tiles.keep) {
@@ -908,7 +908,7 @@ export class DeepZoomImage extends PIXI.Container {
* @memberof DeepZoomImage
*/
destroyUnneededTiles() {
Object.keys(this.tileLayers).forEach(key => {
Object.keys(this.tileLayers).forEach((key) => {
let tiles = this.tileLayers[key]
if (!tiles.keep) {
tiles.destroyUnneededTiles()
@@ -922,7 +922,7 @@ export class DeepZoomImage extends PIXI.Container {
* @memberof DeepZoomImage
*/
destroyObsoleteTiles() {
Object.keys(this.tileLayers).forEach(key => {
Object.keys(this.tileLayers).forEach((key) => {
let tiles = this.tileLayers[key]
if (!tiles.keep) {
tiles.destroyObsoleteTiles()
@@ -937,7 +937,7 @@ export class DeepZoomImage extends PIXI.Container {
* @memberof DeepZoomImage
*/
destroyTiles() {
Object.keys(this.tileLayers).forEach(key => {
Object.keys(this.tileLayers).forEach((key) => {
let tiles = this.tileLayers[key]
if (!tiles.keep) {
tiles.destroyTiles(this.quadTrees)
@@ -949,7 +949,7 @@ export class DeepZoomImage extends PIXI.Container {
* @param {number} level - The zoom level of the grid
*/
tintTilesBelowLevel(level) {
Object.keys(this.tileLayers).forEach(key => {
Object.keys(this.tileLayers).forEach((key) => {
let tiles = this.tileLayers[key]
if (tiles.level < level) {
tiles.tintTiles(this.quadTrees)
@@ -989,7 +989,7 @@ export class DeepZoomImage extends PIXI.Container {
this.fastLoads += 1
this.populateTiles(currentTiles, this.currentLevel, {
onlyone: false,
about: event.about
about: event.about,
})
if (this.fastLoads == 3) {
this.fastLoads = 0
+3 -3
View File
@@ -40,7 +40,7 @@ export class TileLoader {
if (this.loaded.has(url)) this.loaded.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)
}
/** Cancels loading by clearing the load queue **/
@@ -246,7 +246,7 @@ export class RequestTileLoader extends TileLoader {
let xhr = new XMLHttpRequest()
xhr.open('GET', url, false)
xhr.responseType = 'arraybuffer'
xhr.onload = e => {
xhr.onload = (e) => {
let CompressedImage = PIXI.compressedTextures.CompressedImage
let compressed = CompressedImage.loadFromArrayBuffer(xhr.response, url)
let base = new PIXI.BaseTexture(compressed)
@@ -320,7 +320,7 @@ export class WorkerTileLoader extends TileLoader {
let worker = (this.worker = new Worker(workerPath))
worker.onmessage = event => {
worker.onmessage = (event) => {
if (event.data.success) {
let { url, col, row, buffer } = event.data
//console.log("WorkerTileLoader.loaded", url, buffer)
+3 -3
View File
@@ -9,12 +9,12 @@ function load() {
let [col, row, url] = tile
let xhr = new XMLHttpRequest()
xhr.responseType = 'arraybuffer'
xhr.onload = event => {
xhr.onload = (event) => {
pendingRequests.delete(url)
let buffer = xhr.response
postMessage({ success: true, url, col, row, buffer }, [buffer])
}
xhr.onerror = event => {
xhr.onerror = (event) => {
pendingRequests.delete(url)
let buffer = null
postMessage({ success: false, url, col, row, buffer })
@@ -29,7 +29,7 @@ function load() {
}
}
self.onmessage = event => {
self.onmessage = (event) => {
let msg = event.data
switch (msg.command) {
case 'load':
+3 -3
View File
@@ -51,7 +51,7 @@ export class Tiles extends PIXI.Container {
this.infoColor = Colors.random()
this.pprint()
this.destroyed = false
//this.destroyed = false
}
/** Tests whether all tiles are loaded. **/
@@ -169,7 +169,7 @@ export class Tiles extends PIXI.Container {
if (this.showGrid) {
this.highlightTile(refCol, refRow)
}
urlpos.forEach(d => {
urlpos.forEach((d) => {
let [url, col, row] = d
if (this.loader.schedule(url, col, row)) {
if (onlyone) {
@@ -229,7 +229,7 @@ export class Tiles extends PIXI.Container {
* cancelled.
**/
destroy() {
this.destroyed = true
//this.destroyed = true
this.loader.destroy()
super.destroy({ children: true }) // Calls destroyChildren
this.available.clear()