diff --git a/src/viewport.js b/src/viewport.js index a0e5a6f1..b507096e 100644 --- a/src/viewport.js +++ b/src/viewport.js @@ -578,7 +578,7 @@ $.Viewport.prototype = { } var constraintApplied = xConstrained || yConstrained; - var newViewportBounds = constraintApplied ? this.viewerElementToViewportRectangle(newBounds, false) : bounds.clone(); + var newViewportBounds = constraintApplied ? this.viewerElementToViewportRectangle(newBounds) : bounds.clone(); newViewportBounds.xConstrained = xConstrained; newViewportBounds.yConstrained = yConstrained; newViewportBounds.constraintApplied = constraintApplied; @@ -811,7 +811,6 @@ $.Viewport.prototype = { constrainedBounds; bounds = this.getBounds(current); - // bounds = this.getBoundsNoRotate(current); constrainedBounds = this._applyBoundaryConstraints(bounds); diff --git a/test/demo/fitboundswithconstraints.html b/test/demo/fitboundswithconstraints.html index 5851a424..617b139c 100644 --- a/test/demo/fitboundswithconstraints.html +++ b/test/demo/fitboundswithconstraints.html @@ -83,7 +83,6 @@ setTimeout(() => viewport.applyConstraints(), 1000); maxZoomPixelRatio: 10, visibilityRatio:1, constrainDuringPan:true, - // showNavigationControl:false, }); viewer.addHandler("open", function(event) { @@ -148,29 +147,8 @@ setTimeout(() => viewport.applyConstraints(), 1000); }); }) - viewer.viewport.zoomTo(1/2, null, true); + viewer.viewport.zoomTo(0.5, null, true); - // viewer.viewport.panBy(new OpenSeadragon.Point(0.5, 0.5).minus(viewer.viewport.pointFromPixel(new OpenSeadragon.Point(0, 0)))) - // setTimeout(()=>viewer.viewport.contentCoords(),1500); - // // setTimeout(()=>{ - // // viewer.viewport.rotateBy(-90, new OpenSeadragon.Point(0.5, 0.5)); - // // console.log('Rotated by -90') - // // viewer.viewport.contentCoords(); - // // setTimeout(()=>{ - // // console.log('After rotation'); - // // viewer.viewport.contentCoords(); - // // },1500); - // // }, 2000) - - // setTimeout(()=>{ - // viewer.viewport.zoomBy(2, new OpenSeadragon.Point(0.5, 0.5)); - // console.log('Zoomed by 2') - // viewer.viewport.contentCoords(); - // setTimeout(()=>{ - // console.log('After zoom'); - // viewer.viewport.contentCoords(); - // },1500); - // }, 4500) }); $('.method').on('click',function(){