Update iiiftilesource.js

Fix Issue #55 "Tiles rendering issue..."
This commit is contained in:
radix-pro 2013-07-01 22:38:37 -07:00
parent d68999bc87
commit dde42b641d

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;
if ( this.scale_factor instanceof Array )
for ( var i = 0; i < this.scale_factor.length; i++ )
{
var cf = Number( this.scale_factor[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;