Merge branch 'master' of github.com:openseadragon/openseadragon

This commit is contained in:
Ian Gilman 2014-09-15 13:51:43 -07:00
commit c2fdddc306
5 changed files with 54 additions and 39 deletions

View File

@ -54,6 +54,7 @@ $.IIIFTileSource = function( options ){
options.tileSizePerScaleFactor = {};
// N.B. 2.0 renamed scale_factors to scaleFactors
if ( this.tile_width ) {
options.tileSize = this.tile_width;
} else if ( this.tile_height ) {
@ -62,13 +63,13 @@ $.IIIFTileSource = function( options ){
// Version 2.0 forwards
if ( this.tiles.length == 1 ) {
options.tileSize = this.tiles[0].width;
this.scale_factors = this.tiles[0].scale_factors;
this.scale_factors = this.tiles[0].scaleFactors;
} else {
// Multiple tile sizes at different levels
this.scale_factors = [];
for (var t = 0; t < this.tiles.length; t++ ) {
for (var sf = 0; sf < this.tiles[t].scale_factors.length; sf++) {
var scaleFactor = this.tiles[t].scale_factors[sf];
for (var sf = 0; sf < this.tiles[t].scaleFactors.length; sf++) {
var scaleFactor = this.tiles[t].scaleFactors[sf];
this.scale_factors.push(scaleFactor);
options.tileSizePerScaleFactor[scaleFactor] = this.tiles[t].width;
}

View File

@ -221,6 +221,10 @@
*
* @property {Number} [maxZoomLevel=null]
*
* @property {Boolean} [homeFillsViewer=false]
* Make the 'home' button fill the viewer and clip the image, instead
* of fitting the image to the viewer and letterboxing.
*
* @property {Boolean} [panHorizontal=true]
* Allow horizontal pan.
*
@ -912,6 +916,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
defaultZoomLevel: 0,
minZoomLevel: null,
maxZoomLevel: null,
homeFillsViewer: false,
//UI RESPONSIVENESS AND FEEL
clickTimeThreshold: 300,

View File

@ -1937,7 +1937,8 @@ function openTileSource( viewer, source ) {
degrees: _this.degrees //,
//TODO: figure out how to support these in a way that makes sense
//minZoomLevel: this.minZoomLevel,
//maxZoomLevel: this.maxZoomLevel
//maxZoomLevel: this.maxZoomLevel,
//homeFillsViewer: this.homeFillsViewer
});
} else {
if( source ){
@ -1958,7 +1959,8 @@ function openTileSource( viewer, source ) {
maxZoomLevel: _this.maxZoomLevel,
viewer: _this,
degrees: _this.degrees,
navigatorRotate: _this.navigatorRotate
navigatorRotate: _this.navigatorRotate,
homeFillsViewer: _this.homeFillsViewer
});
}

View File

@ -84,7 +84,8 @@ $.Viewport = function( options ) {
defaultZoomLevel: $.DEFAULT_SETTINGS.defaultZoomLevel,
minZoomLevel: $.DEFAULT_SETTINGS.minZoomLevel,
maxZoomLevel: $.DEFAULT_SETTINGS.maxZoomLevel,
degrees: $.DEFAULT_SETTINGS.degrees
degrees: $.DEFAULT_SETTINGS.degrees,
homeFillsViewer: $.DEFAULT_SETTINGS.homeFillsViewer
}, options );
@ -148,16 +149,22 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
* @function
*/
getHomeZoom: function() {
if( this.defaultZoomLevel ){
return this.defaultZoomLevel;
} else {
var aspectFactor =
this.contentAspectX / this.getAspectRatio();
if( this.defaultZoomLevel ){
return this.defaultZoomLevel;
if( this.homeFillsViewer ){ // fill the viewer and clip the image
return ( aspectFactor >= 1) ?
aspectFactor :
1;
} else {
return ( aspectFactor >= 1 ) ?
1 :
aspectFactor;
}
}
},
/**

View File

@ -4,7 +4,7 @@
"protocol": "http://iiif.io/api/image",
"height": 1024,
"width": 775,
"tiles" : [{"width":256, "scale_factors":[1,2,4,8]}],
"tiles" : [{"width":256, "scaleFactors":[1,2,4,8]}],
"profile": ["http://iiif.io/api/image/2/level1.json",
{