use pixels for size instead of pct

This commit is contained in:
Jon Stroop 2013-09-11 13:19:30 -04:00
parent 1c98e6ba5e
commit 6182c3911e

View File

@ -86,7 +86,7 @@ $.extend( $.IIIF11TileSource.prototype, $.TileSource.prototype, {
* Determine if the data and/or url imply the image service is supported by * Determine if the data and/or url imply the image service is supported by
* this tile source. * this tile source.
* @function * @function
* @name OpenSeadragon.IIIFTileSource.prototype.supports * @name OpenSeadragon.IIIF11TileSource.prototype.supports
* @param {Object|Array} data * @param {Object|Array} data
* @param {String} optional - url * @param {String} optional - url
*/ */
@ -138,7 +138,7 @@ $.extend( $.IIIF11TileSource.prototype, $.TileSource.prototype, {
* Responsible for retreiving the url which will return an image for the * Responsible for retreiving the url which will return an image for the
* region speified by the given x, y, and level components. * region speified by the given x, y, and level components.
* @function * @function
* @name OpenSeadragon.IIIFTileSource.prototype.getTileUrl * @name OpenSeadragon.IIIF11TileSource.prototype.getTileUrl
* @param {Number} level - z index * @param {Number} level - z index
* @param {Number} x * @param {Number} x
* @param {Number} y * @param {Number} y
@ -153,13 +153,18 @@ $.extend( $.IIIF11TileSource.prototype, $.TileSource.prototype, {
//## get the scale (level as a decimal) //## get the scale (level as a decimal)
scale = Math.pow( 0.5, this.maxLevel - level ), scale = Math.pow( 0.5, this.maxLevel - level ),
//## get iiif size
iiif_size = 'pct:' + ( scale * 100 ),
//# image dimensions at this level //# image dimensions at this level
level_width = Math.ceil( this.width * scale ), level_width = Math.ceil( this.width * scale ),
level_height = Math.ceil( this.height * scale ), level_height = Math.ceil( this.height * scale ),
//## get iiif size
// Note that this uses pixels rather than percents (as in
// IIIF11TileSource), which will be more precise (i.e. the 'right
// 50% of 11px' case') and easier to pre-bake without worring about
// different browsers' decimal precision (if desired).
iiif_size = level_width + "," + level_height,
//## iiif region //## iiif region
iiif_tile_size_width = Math.ceil( this.tileSize / scale ), iiif_tile_size_width = Math.ceil( this.tileSize / scale ),
iiif_tile_size_height = Math.ceil( this.tileSize / scale ), iiif_tile_size_height = Math.ceil( this.tileSize / scale ),
@ -169,6 +174,7 @@ $.extend( $.IIIF11TileSource.prototype, $.TileSource.prototype, {
iiif_tile_w, iiif_tile_w,
iiif_tile_h; 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'; iiif_region = 'full';