bugfix in getCenter during zoom animation

This commit is contained in:
Tom 2022-12-10 07:02:16 -05:00
parent 86c105beaa
commit 37a024f023
2 changed files with 2 additions and 25 deletions

View File

@ -578,7 +578,7 @@ $.Viewport.prototype = {
} }
var constraintApplied = xConstrained || yConstrained; 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.xConstrained = xConstrained;
newViewportBounds.yConstrained = yConstrained; newViewportBounds.yConstrained = yConstrained;
newViewportBounds.constraintApplied = constraintApplied; newViewportBounds.constraintApplied = constraintApplied;
@ -811,7 +811,6 @@ $.Viewport.prototype = {
constrainedBounds; constrainedBounds;
bounds = this.getBounds(current); bounds = this.getBounds(current);
// bounds = this.getBoundsNoRotate(current);
constrainedBounds = this._applyBoundaryConstraints(bounds); constrainedBounds = this._applyBoundaryConstraints(bounds);

View File

@ -83,7 +83,6 @@ setTimeout(() => viewport.applyConstraints(), 1000);</pre>
maxZoomPixelRatio: 10, maxZoomPixelRatio: 10,
visibilityRatio:1, visibilityRatio:1,
constrainDuringPan:true, constrainDuringPan:true,
// showNavigationControl:false,
}); });
viewer.addHandler("open", function(event) { viewer.addHandler("open", function(event) {
@ -148,29 +147,8 @@ setTimeout(() => viewport.applyConstraints(), 1000);</pre>
}); });
}) })
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(){ $('.method').on('click',function(){