Fix for maintaining IIIFTileSource support while implementing #670. Change docs to reflect that TileSource.prototype.tileSize is now an OpenSeadragon.Point

This commit is contained in:
Conner Wingard 2015-06-26 16:26:09 -04:00
parent 7e950fda2b
commit 85241b1249
2 changed files with 17 additions and 8 deletions

View File

@ -190,9 +190,12 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
var scaleFactor = Math.pow(2, this.maxLevel - level); var scaleFactor = Math.pow(2, this.maxLevel - level);
// cache it in case any external code is going to read it directly // cache it in case any external code is going to read it directly
if (this.tileSizePerScaleFactor && this.tileSizePerScaleFactor[scaleFactor]) { if (this.tileSizePerScaleFactor && this.tileSizePerScaleFactor[scaleFactor]) {
this.tileSize = this.tileSizePerScaleFactor[scaleFactor]; this.tileSize = new $.Point(
this.tileSizePerScaleFactor[scaleFactor],
this.tileSizePerScaleFactor[scaleFactor]
);
} }
return new $.Point(this.tileSize, this.tileSize); return this.tileSize;
}, },
/** /**

View File

@ -146,7 +146,7 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve
* The size of the image tiles used to compose the image. * The size of the image tiles used to compose the image.
* Please note that tileSize may be deprecated in a future release. * Please note that tileSize may be deprecated in a future release.
* Instead the getTileSize(level) function should be used. * Instead the getTileSize(level) function should be used.
* @member {Number} tileSize * @member {OpenSeadragon.Point} tileSize
* @memberof OpenSeadragon.TileSource# * @memberof OpenSeadragon.TileSource#
*/ */
/** /**
@ -179,7 +179,7 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve
//async mechanism set some safe defaults first //async mechanism set some safe defaults first
this.aspectRatio = 1; this.aspectRatio = 1;
this.dimensions = new $.Point( 10, 10 ); this.dimensions = new $.Point( 10, 10 );
this.tileSize = 0; this.tileSize = new $.Point( 0, 0 );
this.tileOverlap = 0; this.tileOverlap = 0;
this.minLevel = 0; this.minLevel = 0;
this.maxLevel = 0; this.maxLevel = 0;
@ -196,10 +196,16 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve
this.aspectRatio = ( options.width && options.height ) ? this.aspectRatio = ( options.width && options.height ) ?
( options.width / options.height ) : 1; ( options.width / options.height ) : 1;
this.dimensions = new $.Point( options.width, options.height ); this.dimensions = new $.Point( options.width, options.height );
this.tileSize = new $.Point(
( options.tileSize ? options.tileSize : options.tileWidth ), if( options.tileSize ){
( options.tileSize ? options.tileSize : options.tileHeight ) this.tileSize = new $.Point(options.tileSize, options.tileSize);
); } else {
this.tileSize = new $.Point(
(options.tileWidth ? options.tileWidth : 0),
(options.tileHeight ? options.tileHeight : 0)
);
}
this.tileOverlap = options.tileOverlap ? options.tileOverlap : 0; this.tileOverlap = options.tileOverlap ? options.tileOverlap : 0;
this.minLevel = options.minLevel ? options.minLevel : 0; this.minLevel = options.minLevel ? options.minLevel : 0;
this.maxLevel = ( undefined !== options.maxLevel && null !== options.maxLevel ) ? this.maxLevel = ( undefined !== options.maxLevel && null !== options.maxLevel ) ?