From 07cb95e99b3295de0d67b8337c574c0e282a5ff8 Mon Sep 17 00:00:00 2001 From: Lutz Helm Date: Tue, 17 Dec 2019 17:58:57 +0100 Subject: [PATCH] Improve code readability --- src/iiiftilesource.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/iiiftilesource.js b/src/iiiftilesource.js index 33e26d72..9fd481ae 100644 --- a/src/iiiftilesource.js +++ b/src/iiiftilesource.js @@ -397,10 +397,12 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea iiifQuality = "default." + this.tileFormat; } if ( levelWidth < tileWidth && levelHeight < tileHeight ){ - if ( this.version === 1 || levelWidth !== this.width ) { - iiifSize = levelWidth + "," + ( this.version === 3 ? levelHeight : "" ); - } else { + if ( levelWidth === this.width && this.version !== 1 ) { iiifSize = "max"; + } else if ( this.version === 3 ) { + iiifSize = levelWidth + "," + levelHeight; + } else { + iiifSize = levelWidth + ","; } iiifRegion = 'full'; } else { @@ -417,8 +419,10 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea iiifSizeH = Math.ceil( iiifTileH * scale ); if ( this.version !== 1 && iiifSizeW === this.width && ( this.version !== 3 || iiifSizeH === this.height ) ) { iiifSize = "max"; + } else if (this.version === 3) { + iiifSize = iiifSizeW + "," + iiifSizeH; } else { - iiifSize = iiifSizeW + "," + ( this.version === 3 ? iiifSizeH : "" ); + iiifSize = iiifSizeW + ","; } } uri = [ this['@id'], iiifRegion, iiifSize, IIIF_ROTATION, iiifQuality ].join( '/' );