Removed allowZoomToConstraintsOnResize and made the new resize behaviour

the default
This commit is contained in:
Shaun Whitely 2015-08-29 16:46:56 +10:00
parent 4d6e730ab1
commit 6d3b582e58
2 changed files with 7 additions and 29 deletions

View File

@ -255,11 +255,6 @@
* @property {Boolean} [preserveImageSizeOnResize=false]
* Set to true to have the image size preserved when the viewer is resized. This requires autoResize=true (default).
*
* @property {Boolean} [allowZoomToConstraintsOnResize=false]
* Set to true to allow the image to remain zoomed out past the home zoom level during resize.
* If false the image will be zoomed in if necessary such that it touches the edge of the viewer.
* This requires autoResize=true (default).
*
* @property {Number} [pixelsPerWheelLine=40]
* For pixel-resolution scrolling devices, the number of pixels equal to one scroll line.
*
@ -1000,7 +995,6 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
pixelsPerWheelLine: 40,
autoResize: true,
preserveImageSizeOnResize: false, // requires autoResize=true
allowZoomToConstraintsOnResize: false, // requires autoResize=true
//DEFAULT CONTROL SETTINGS
showSequenceControl: true, //SEQUENCE

View File

@ -2947,31 +2947,15 @@ function resizeViewportAndRecenter( viewer, containerSize, oldBounds, oldCenter
viewport.resize( containerSize, true );
var newWidth = oldBounds.width;
var newHeight = oldBounds.height;
if (!viewer.allowZoomToConstraintsOnResize) {
var worldBounds = viewer.world.getHomeBounds();
if (oldBounds.width > worldBounds.width) {
newWidth = worldBounds.width;
}
if (oldBounds.height > worldBounds.height) {
newHeight = worldBounds.height;
}
}
var newBounds = new $.Rect(
oldCenter.x - ( newWidth / 2.0 ),
oldCenter.y - ( newHeight / 2.0 ),
newWidth,
newHeight
);
oldCenter.x - ( oldBounds.width / 2.0 ),
oldCenter.y - ( oldBounds.height / 2.0 ),
oldBounds.width,
oldBounds.height
);
if (viewer.allowZoomToConstraintsOnResize) {
viewport.fitBoundsWithConstraints( newBounds, true );
} else {
viewport.fitBounds( newBounds, true );
}
// let the viewport decide if the bounds are too big or too small
viewport.fitBoundsWithConstraints( newBounds, true );
}
function drawWorld( viewer ) {