mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-02-17 23:33:14 +03:00
style changes, per @iangilman on openseadragon/openseadragon#315
This commit is contained in:
parent
24298dcbba
commit
ddde07b614
@ -64,24 +64,24 @@ $.IIIF1_1TileSource = function( options ){
|
|||||||
} else if ( this.tile_height ) {
|
} else if ( this.tile_height ) {
|
||||||
options.tileSize = this.tile_height;
|
options.tileSize = this.tile_height;
|
||||||
} else {
|
} else {
|
||||||
// use the largest of tile_options that is smaller than the short
|
// use the largest of tileOptions that is smaller than the short
|
||||||
// dimension
|
// dimension
|
||||||
|
|
||||||
var short_dim = Math.min(this.height, this.width),
|
var shortDim = Math.min( this.height, this.width ),
|
||||||
tile_options = [256,512,1024],
|
tileOptions = [256,512,1024],
|
||||||
smaller_tiles = [];
|
smallerTiles = [];
|
||||||
|
|
||||||
for ( var c = 0; c < tile_options.length; c++ ) {
|
for ( var c = 0; c < tileOptions.length; c++ ) {
|
||||||
if ( tile_options[c] <= short_dim ) {
|
if ( tileOptions[c] <= shortDim ) {
|
||||||
smaller_tiles.push(tile_options[c]);
|
smallerTiles.push( tileOptions[c] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( smaller_tiles.length > 0 ) {
|
if ( smallerTiles.length > 0 ) {
|
||||||
options.tileSize = Math.max.apply(null, smaller_tiles);
|
options.tileSize = Math.max.apply( null, smallerTiles );
|
||||||
} else {
|
} else {
|
||||||
// If we're smaller than 256, just use the short side.
|
// If we're smaller than 256, just use the short side.
|
||||||
options.tileSize = short_dim;
|
options.tileSize = shortDim;
|
||||||
}
|
}
|
||||||
this.tile_width = options.tileSize; // So that 'full' gets used for
|
this.tile_width = options.tileSize; // So that 'full' gets used for
|
||||||
this.tile_height = options.tileSize; // the region below
|
this.tile_height = options.tileSize; // the region below
|
||||||
@ -157,34 +157,34 @@ $.extend( $.IIIF1_1TileSource.prototype, $.TileSource.prototype, /** @lends Open
|
|||||||
scale = Math.pow( 0.5, this.maxLevel - level ),
|
scale = Math.pow( 0.5, this.maxLevel - level ),
|
||||||
|
|
||||||
//# image dimensions at this level
|
//# image dimensions at this level
|
||||||
level_width = Math.ceil( this.width * scale ),
|
levelWidth = Math.ceil( this.width * scale ),
|
||||||
level_height = Math.ceil( this.height * scale ),
|
levelHeight = Math.ceil( this.height * scale ),
|
||||||
|
|
||||||
//## iiif region
|
//## iiif region
|
||||||
iiif_tile_size_width = Math.ceil( this.tileSize / scale ),
|
iiifTileSizeWidth = Math.ceil( this.tileSize / scale ),
|
||||||
iiif_tile_size_height = Math.ceil( this.tileSize / scale ),
|
iiifTileSizeHeight = Math.ceil( this.tileSize / scale ),
|
||||||
iiif_region,
|
iiifRegion,
|
||||||
iiif_tile_x,
|
iiifTileX,
|
||||||
iiif_tile_y,
|
iiifTileY,
|
||||||
iiif_tile_w,
|
iiifTileW,
|
||||||
iiif_tile_h,
|
iiifTileH,
|
||||||
iiif_size,
|
iiifSize,
|
||||||
uri;
|
uri;
|
||||||
|
|
||||||
if ( level_width < this.tile_width && level_height < this.tile_height ){
|
if ( levelWidth < this.tile_width && levelHeight < this.tile_height ){
|
||||||
iiif_size = level_width + ",";
|
iiifSize = levelWidth + ",";
|
||||||
iiif_region = 'full';
|
iiifRegion = 'full';
|
||||||
} else {
|
} else {
|
||||||
iiif_tile_x = x * iiif_tile_size_width;
|
iiifTileX = x * iiifTileSizeWidth;
|
||||||
iiif_tile_y = y * iiif_tile_size_height;
|
iiifTileY = y * iiifTileSizeHeight;
|
||||||
iiif_tile_w = Math.min( iiif_tile_size_width, this.width - iiif_tile_x );
|
iiifTileW = Math.min( iiifTileSizeWidth, this.width - iiifTileX );
|
||||||
iiif_tile_h = Math.min( iiif_tile_size_height, this.height - iiif_tile_y );
|
iiifTileH = Math.min( iiifTileSizeHeight, this.height - iiifTileY );
|
||||||
|
|
||||||
iiif_size = Math.ceil(iiif_tile_w * scale) + ",";
|
iiifSize = Math.ceil( iiifTileW * scale ) + ",";
|
||||||
|
|
||||||
iiif_region = [ iiif_tile_x, iiif_tile_y, iiif_tile_w, iiif_tile_h ].join(',');
|
iiifRegion = [ iiifTileX, iiifTileY, iiifTileW, iiifTileH ].join( ',' );
|
||||||
}
|
}
|
||||||
uri = [ this['@id'], iiif_region, iiif_size, IIIF_ROTATION, IIIF_QUALITY ].join('/');
|
uri = [ this['@id'], iiifRegion, iiifSize, IIIF_ROTATION, IIIF_QUALITY ].join( '/' );
|
||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user