From b92a428e88730546058bf9890aa44061ca370eb5 Mon Sep 17 00:00:00 2001 From: Lutz Helm Date: Tue, 10 Oct 2023 14:02:44 +0200 Subject: [PATCH] Sort levelSizes instead of sizes --- src/iiiftilesource.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/iiiftilesource.js b/src/iiiftilesource.js index 1105ea51..54ec073f 100644 --- a/src/iiiftilesource.js +++ b/src/iiiftilesource.js @@ -145,7 +145,7 @@ $.IIIFTileSource = function( options ){ if( this.sizes ) { var sizeLength = this.sizes.length; if ( (sizeLength === options.maxLevel) || (sizeLength === options.maxLevel + 1) ) { - this.levelSizes = this.sizes; + this.levelSizes = this.sizes.slice().sort(( size1, size2 ) => size1.width - size2.width); // Need to take into account that the list may or may not include the full resolution size if( sizeLength === options.maxLevel ) { this.levelSizes.push( {width: this.width, height: this.height} ); @@ -269,9 +269,6 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea } } } - data.sizes = data.sizes && data.sizes.sort( - ( size1, size2 ) => size1.width - size2.width - ); return data; } },