Fix sorting logic for best tiles to load

This commit is contained in:
Tom 2024-05-21 04:30:17 -04:00
parent 49e2d7a987
commit 5be44521b5

View File

@ -1651,8 +1651,8 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
} }
var result = this._updateTile( var result = this._updateTile(
drawLevel,
haveDrawn, haveDrawn,
drawLevel,
flippedX, y, flippedX, y,
level, level,
levelVisibility, levelVisibility,
@ -2183,9 +2183,11 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
return -1; return -1;
} }
if (a.visibility === b.visibility) { if (a.visibility === b.visibility) {
// sort by smallest squared distance
return (a.squaredDistance - b.squaredDistance); return (a.squaredDistance - b.squaredDistance);
} else { } else {
return (a.visibility - b.visibility); // sort by largest visibility value
return (b.visibility - a.visibility);
} }
}); });
}, },