From d231a44d9a2ababbb3bb68aa387e44c5ec827cb9 Mon Sep 17 00:00:00 2001 From: Michael Gibson Date: Mon, 10 Feb 2025 08:51:51 -0700 Subject: [PATCH] top down --- src/tiledimage.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/tiledimage.js b/src/tiledimage.js index 5b7ea362..18987863 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -1362,7 +1362,8 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag // lower-resolution levels are skipped let useLevel = false; let unloaded = []; - let extraUnloaded = []; + // let extraUnloaded = []; + let baseLevel = null; for (let i = 0; i < levelList.length; i++) { let level = levelList[i]; @@ -1379,6 +1380,10 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag continue; } + if (baseLevel === null) { + baseLevel = level; + } + var targetRenderPixelRatio = this.viewport.deltaPixelsFromPointsNoRotate( this.source.getPixelRatio(level), false @@ -1411,11 +1416,9 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag ); bestTiles = result.bestTiles; - if (unloaded.length === 0) { - unloaded = result.unloadedTiles; - } - if (extraUnloaded.length === 0) { - extraUnloaded = result.extraTiles; + unloaded = result.unloadedTiles.concat(unloaded); + if (baseLevel === level + 1) { + // extraUnloaded = result.extraTiles; } var tiles = result.updatedTiles.filter(tile => tile.loaded); var makeTileInfoObject = (function(level, levelOpacity, currentTime){ @@ -1438,15 +1441,15 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag } } - unloaded.slice(0, 20).forEach(tile => { + unloaded.slice(0, 50).forEach(tile => { this._loadTile(tile, currentTime); }); - if (extraUnloaded.length && this._tilesLoading === 0 && !unloaded.length) { - extraUnloaded.slice(0, 10).forEach(tile => { - this._loadTile(tile, currentTime); - }); - } + // if (extraUnloaded.length && this._tilesLoading === 0 && !unloaded.length) { + // extraUnloaded.slice(0, 20).forEach(tile => { + // this._loadTile(tile, currentTime); + // }); + // } // Load the new 'best' n tiles