mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-01-31 15:12:07 +03:00
Added configuration parameter: preserveImageSizeOnResize to preserve the default behavior.
Changed fitBounds to fitBoundsWithConstraints as per Ian's instructions.
This commit is contained in:
parent
57c06a9a19
commit
fb21dabd76
@ -252,6 +252,9 @@
|
||||
* @property {Boolean} [autoResize=true]
|
||||
* Set to false to prevent polling for viewer size changes. Useful for providing custom resize behavior.
|
||||
*
|
||||
* @property {Boolean} [preserveImageSizeOnResize=false]
|
||||
* Set to true to have the image size preserved when the viewer is resized. This requires autoResize=false.
|
||||
*
|
||||
* @property {Number} [pixelsPerWheelLine=40]
|
||||
* For pixel-resolution scrolling devices, the number of pixels equal to one scroll line.
|
||||
*
|
||||
@ -987,6 +990,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
|
||||
maxZoomPixelRatio: 1.1, //-> higher allows 'over zoom' into pixels
|
||||
pixelsPerWheelLine: 40,
|
||||
autoResize: true,
|
||||
preserveImageSizeOnResize: false, // requires autoResize=false
|
||||
|
||||
//DEFAULT CONTROL SETTINGS
|
||||
showSequenceControl: true, //SEQUENCE
|
||||
|
@ -408,6 +408,7 @@ $.Viewer = function( options ) {
|
||||
width: this.navigatorWidth,
|
||||
height: this.navigatorHeight,
|
||||
autoResize: this.navigatorAutoResize,
|
||||
preserveImageSizeOnResize: this.preserveImageSizeOnResize,
|
||||
prefixUrl: this.prefixUrl,
|
||||
viewer: this,
|
||||
navigatorRotate: this.navigatorRotate,
|
||||
@ -2836,7 +2837,7 @@ function updateOnce( viewer ) {
|
||||
THIS[ viewer.hash ].forceRedraw = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if ( viewer.preserveImageSizeOnResize ) {
|
||||
containerSize = _getSafeElemSize( viewer.container );
|
||||
if ( !containerSize.equals( THIS[ viewer.hash ].prevContainerSize ) ) {
|
||||
var prevContainerSize = THIS[ viewer.hash ].prevContainerSize;
|
||||
@ -2851,7 +2852,7 @@ function updateOnce( viewer ) {
|
||||
bounds.height += viewportDiff.y;
|
||||
bounds.x -= (viewportDiff.x / 2);
|
||||
bounds.y -= (viewportDiff.y / 2);
|
||||
viewer.viewport.fitBounds(bounds, true);
|
||||
viewer.viewport.fitBoundsWithConstraints(bounds, true);
|
||||
viewer.forceRedraw();
|
||||
|
||||
THIS[ viewer.hash ].prevContainerSize = containerSize;
|
||||
|
Loading…
x
Reference in New Issue
Block a user