From 6b4c0f873ae87dda7fc0e548050e5f819b85cfd4 Mon Sep 17 00:00:00 2001 From: Aiosa <469130@mail.muni.cz> Date: Fri, 22 Nov 2024 13:03:16 +0100 Subject: [PATCH] Add maxTilesPerFrame degradation, fix tests. --- src/tilecache.js | 5 +++-- src/tiledimage.js | 7 +++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tilecache.js b/src/tilecache.js index e7f10b2b..6839e15a 100644 --- a/src/tilecache.js +++ b/src/tilecache.js @@ -217,10 +217,11 @@ } if (!supportedTypes.includes(internalCache.type)) { + let logReference = this[DRAWER_INTERNAL_CACHE]; + logReference = logReference ? Object.entries(logReference) : this; $.console.warn("Attempt to render cache that is not prepared for current drawer " + "supported format: the preparation should've happened after tile processing has finished.", - Object.entries(this[DRAWER_INTERNAL_CACHE]), - this, tileToDraw); + logReference, tileToDraw); internalCache.transformTo(supportedTypes.length > 1 ? supportedTypes : supportedTypes[0]) .then(() => this._triggerNeedsDraw()); diff --git a/src/tiledimage.js b/src/tiledimage.js index 5155d42e..12bd5f60 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -1821,10 +1821,9 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag } else if (!loadingCoverage) { // add tile to best tiles to load only when not loaded already best = this._compareTiles( best, tile, this._currentMaxTilesPerFrame ); - // TODO: test 'Viewer headers can be updated' fail if we start decreasing the number since not enough tiles get invoked - // if (this._currentMaxTilesPerFrame > this.maxTilesPerFrame) { - // this._currentMaxTilesPerFrame = Math.max(Math.ceil(this.maxTilesPerFrame / 2), this.maxTilesPerFrame); - // } + if (this._currentMaxTilesPerFrame > this.maxTilesPerFrame) { + this._currentMaxTilesPerFrame = Math.max(Math.ceil(this.maxTilesPerFrame / 2), this.maxTilesPerFrame); + } } return {