Merge pull request #2206 from filak/master

Update iiiftilesource.js
This commit is contained in:
Ian Gilman 2022-12-07 14:21:47 -08:00 committed by GitHub
commit de4eac5a06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -134,7 +134,7 @@ $.IIIFTileSource = function( options ){
if (!options.maxLevel && !this.emulateLegacyImagePyramid) {
if (!this.scale_factors) {
options.maxLevel = Number(Math.ceil(Math.log(Math.max(this.width, this.height), 2)));
options.maxLevel = Number(Math.round(Math.log(Math.max(this.width, this.height), 2)));
} else {
var maxScaleFactor = Math.max.apply(null, this.scale_factors);
options.maxLevel = Math.round(Math.log(maxScaleFactor) * Math.LOG2E);
@ -377,8 +377,8 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
scale = Math.pow( 0.5, this.maxLevel - level ),
//# image dimensions at this level
levelWidth = Math.ceil( this.width * scale ),
levelHeight = Math.ceil( this.height * scale ),
levelWidth = Math.round( this.width * scale ),
levelHeight = Math.round( this.height * scale ),
//## iiif region
tileWidth,
@ -398,8 +398,8 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
tileWidth = this.getTileWidth(level);
tileHeight = this.getTileHeight(level);
iiifTileSizeWidth = Math.ceil( tileWidth / scale );
iiifTileSizeHeight = Math.ceil( tileHeight / scale );
iiifTileSizeWidth = Math.round( tileWidth / scale );
iiifTileSizeHeight = Math.round( tileHeight / scale );
if (this.version === 1) {
iiifQuality = "native." + this.tileFormat;
} else {
@ -426,8 +426,8 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
} else {
iiifRegion = [ iiifTileX, iiifTileY, iiifTileW, iiifTileH ].join( ',' );
}
iiifSizeW = Math.ceil( iiifTileW * scale );
iiifSizeH = Math.ceil( iiifTileH * scale );
iiifSizeW = Math.round( iiifTileW * scale );
iiifSizeH = Math.round( iiifTileH * scale );
if ( this.version === 2 && iiifSizeW === this.width ) {
iiifSize = "full";
} else if ( this.version === 3 && iiifSizeW === this.width && iiifSizeH === this.height ) {