mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-01-19 17:21:50 +03:00
Merge pull request #2158 from cavenel/master
Fix wrong center point on pinch zoom
This commit is contained in:
commit
f3f20fd30d
@ -3289,9 +3289,6 @@ function onCanvasPinch( event ) {
|
|||||||
if ( gestureSettings.pinchToZoom &&
|
if ( gestureSettings.pinchToZoom &&
|
||||||
(!canvasPinchEventArgs.preventDefaultPanAction || !canvasPinchEventArgs.preventDefaultZoomAction) ) {
|
(!canvasPinchEventArgs.preventDefaultPanAction || !canvasPinchEventArgs.preventDefaultZoomAction) ) {
|
||||||
centerPt = this.viewport.pointFromPixel( event.center, true );
|
centerPt = this.viewport.pointFromPixel( event.center, true );
|
||||||
if ( !canvasPinchEventArgs.preventDefaultZoomAction ) {
|
|
||||||
this.viewport.zoomBy( event.distance / event.lastDistance, centerPt, true );
|
|
||||||
}
|
|
||||||
if ( gestureSettings.zoomToRefPoint && !canvasPinchEventArgs.preventDefaultPanAction ) {
|
if ( gestureSettings.zoomToRefPoint && !canvasPinchEventArgs.preventDefaultPanAction ) {
|
||||||
lastCenterPt = this.viewport.pointFromPixel( event.lastCenter, true );
|
lastCenterPt = this.viewport.pointFromPixel( event.lastCenter, true );
|
||||||
panByPt = lastCenterPt.minus( centerPt );
|
panByPt = lastCenterPt.minus( centerPt );
|
||||||
@ -3303,6 +3300,9 @@ function onCanvasPinch( event ) {
|
|||||||
}
|
}
|
||||||
this.viewport.panBy(panByPt, true);
|
this.viewport.panBy(panByPt, true);
|
||||||
}
|
}
|
||||||
|
if ( !canvasPinchEventArgs.preventDefaultZoomAction ) {
|
||||||
|
this.viewport.zoomBy( event.distance / event.lastDistance, centerPt, true );
|
||||||
|
}
|
||||||
this.viewport.applyConstraints();
|
this.viewport.applyConstraints();
|
||||||
}
|
}
|
||||||
if ( gestureSettings.pinchRotate && !canvasPinchEventArgs.preventDefaultRotateAction ) {
|
if ( gestureSettings.pinchRotate && !canvasPinchEventArgs.preventDefaultRotateAction ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user