mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 06:36:11 +03:00
Merge pull request #474 from nein09/issue-127
Add option for home button to fill viewer (issue 127)
This commit is contained in:
commit
356b7e1f5f
@ -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,
|
||||
|
@ -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
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user