From 85241b124926c329c61497aa0bca25cbf7e77434 Mon Sep 17 00:00:00 2001 From: Conner Wingard Date: Fri, 26 Jun 2015 16:26:09 -0400 Subject: [PATCH] Fix for maintaining IIIFTileSource support while implementing #670. Change docs to reflect that TileSource.prototype.tileSize is now an OpenSeadragon.Point --- src/iiiftilesource.js | 7 +++++-- src/tilesource.js | 18 ++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/iiiftilesource.js b/src/iiiftilesource.js index 54779158..a1e88a12 100644 --- a/src/iiiftilesource.js +++ b/src/iiiftilesource.js @@ -190,9 +190,12 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea var scaleFactor = Math.pow(2, this.maxLevel - level); // cache it in case any external code is going to read it directly 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; }, /** diff --git a/src/tilesource.js b/src/tilesource.js index 9ed329dc..74a9c539 100644 --- a/src/tilesource.js +++ b/src/tilesource.js @@ -146,7 +146,7 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve * The size of the image tiles used to compose the image. * Please note that tileSize may be deprecated in a future release. * Instead the getTileSize(level) function should be used. - * @member {Number} tileSize + * @member {OpenSeadragon.Point} tileSize * @memberof OpenSeadragon.TileSource# */ /** @@ -179,7 +179,7 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve //async mechanism set some safe defaults first this.aspectRatio = 1; this.dimensions = new $.Point( 10, 10 ); - this.tileSize = 0; + this.tileSize = new $.Point( 0, 0 ); this.tileOverlap = 0; this.minLevel = 0; this.maxLevel = 0; @@ -196,10 +196,16 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve this.aspectRatio = ( options.width && options.height ) ? ( options.width / options.height ) : 1; this.dimensions = new $.Point( options.width, options.height ); - this.tileSize = new $.Point( - ( options.tileSize ? options.tileSize : options.tileWidth ), - ( options.tileSize ? options.tileSize : options.tileHeight ) - ); + + if( options.tileSize ){ + 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.minLevel = options.minLevel ? options.minLevel : 0; this.maxLevel = ( undefined !== options.maxLevel && null !== options.maxLevel ) ?