Merge pull request #154 from radix-pro/patch-1

Update iiiftilesource.js
This commit is contained in:
iangilman 2013-07-03 09:31:25 -07:00
commit db2b4bcd2a

View File

@ -65,9 +65,18 @@ $.IIIFTileSource = function( options ){
// to preserve backward compatibility.
options.tileSize = this.tile_width;
options.maxLevel = options.maxLevel ? options.maxLevel : Number(
Math.ceil( Math.log( Math.max( this.width, this.height ), 2 ) )
);
if (! options.maxLevel ) {
var mf = -1;
var scfs = this.scale_factors || this.scale_factor;
if ( scfs instanceof Array ) {
for ( var i = 0; i < scfs.length; i++ ) {
var cf = Number( scfs[i] );
if ( !isNaN( cf ) && cf > mf ) { mf = cf; }
}
}
if ( mf < 0 ) { options.maxLevel = Number(Math.ceil(Math.log(Math.max(this.width, this.height), 2))); }
else { options.maxLevel = mf; }
}
$.TileSource.apply( this, [ options ] );
};
@ -176,7 +185,7 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, {
iiif_tile_h;
if ( level_width < this.tile_width || level_height < this.tile_height ){
if ( level_width < this.tile_width && level_height < this.tile_height ){
iiif_region = 'full';
} else {
iiif_tile_x = x * iiif_tile_size_width;