From 5be44521b514184a1b170da95fc8c319448b78cd Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 21 May 2024 04:30:17 -0400 Subject: [PATCH] Fix sorting logic for best tiles to load --- src/tiledimage.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tiledimage.js b/src/tiledimage.js index 20fa2ebf..cf7075a7 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -1651,8 +1651,8 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag } var result = this._updateTile( - drawLevel, haveDrawn, + drawLevel, flippedX, y, level, levelVisibility, @@ -2183,9 +2183,11 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag return -1; } if (a.visibility === b.visibility) { + // sort by smallest squared distance return (a.squaredDistance - b.squaredDistance); } else { - return (a.visibility - b.visibility); + // sort by largest visibility value + return (b.visibility - a.visibility); } }); },