This commit is contained in:
Hamza Tatheer 2022-10-24 23:17:03 +05:00
parent 2f28970e32
commit 89ab847ef6
2 changed files with 21 additions and 5 deletions

View File

@ -1192,11 +1192,13 @@ function OpenSeadragon( options ){
dblClickDistThreshold: 20, dblClickDistThreshold: 20,
springStiffness: 6.5, springStiffness: 6.5,
animationTime: 1.2, animationTime: 1.2,
dblTapDragToZoomSpeed: 0.5,
gestureSettingsMouse: { gestureSettingsMouse: {
dragToPan: true, dragToPan: true,
scrollToZoom: true, scrollToZoom: true,
clickToZoom: true, clickToZoom: true,
dblClickToZoom: false, dblClickToZoom: false,
dblTapDragToZoom: false,
pinchToZoom: false, pinchToZoom: false,
zoomToRefPoint: true, zoomToRefPoint: true,
flickEnabled: false, flickEnabled: false,
@ -1209,6 +1211,7 @@ function OpenSeadragon( options ){
scrollToZoom: false, scrollToZoom: false,
clickToZoom: false, clickToZoom: false,
dblClickToZoom: true, dblClickToZoom: true,
dblTapDragToZoom: true,
pinchToZoom: true, pinchToZoom: true,
zoomToRefPoint: true, zoomToRefPoint: true,
flickEnabled: true, flickEnabled: true,
@ -1221,6 +1224,7 @@ function OpenSeadragon( options ){
scrollToZoom: false, scrollToZoom: false,
clickToZoom: true, clickToZoom: true,
dblClickToZoom: false, dblClickToZoom: false,
dblTapDragToZoom: false,
pinchToZoom: false, pinchToZoom: false,
zoomToRefPoint: true, zoomToRefPoint: true,
flickEnabled: false, flickEnabled: false,
@ -1233,6 +1237,7 @@ function OpenSeadragon( options ){
scrollToZoom: false, scrollToZoom: false,
clickToZoom: false, clickToZoom: false,
dblClickToZoom: true, dblClickToZoom: true,
dblTapDragToZoom: true,
pinchToZoom: true, pinchToZoom: true,
zoomToRefPoint: true, zoomToRefPoint: true,
flickEnabled: true, flickEnabled: true,

View File

@ -2909,7 +2909,7 @@ function onCanvasClick( event ) {
); );
this.viewport.applyConstraints(); this.viewport.applyConstraints();
} }
else if( gestureSettings.dblClickToZoom ) { else if( gestureSettings.dblTapDragToZoom ) {
THIS[ this.hash ].lastClickInfo.time = (new Date()).getTime(); THIS[ this.hash ].lastClickInfo.time = (new Date()).getTime();
THIS[ this.hash ].lastClickInfo.position = event.position; THIS[ this.hash ].lastClickInfo.position = event.position;
} }
@ -2992,8 +2992,9 @@ function onCanvasDrag( event ) {
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType ); gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
if (gestureSettings.dblClickToZoom && THIS[ this.hash ].draggingToZoom){ if (gestureSettings.dblTapDragToZoom && THIS[ this.hash ].draggingToZoom){
var factor = Math.pow( this.zoomPerDblTapDrag, event.delta.y / 50 ); var userSpeedForZoom = this.dblTapDragToZoomSpeed;
var factor = Math.pow( this.zoomPerDblTapDrag, event.delta.y / (200 * (1 - userSpeedForZoom)));
this.viewport.zoomBy(factor); this.viewport.zoomBy(factor);
// this.viewport.applyConstraints(); // this.viewport.applyConstraints();
} }
@ -3096,7 +3097,7 @@ function onCanvasDragEnd( event ) {
} }
if( gestureSettings.dblClickToZoom && THIS[ this.hash ].draggingToZoom === true ){ if( gestureSettings.dblTapDragToZoom && THIS[ this.hash ].draggingToZoom === true ){
THIS[ this.hash ].draggingToZoom = false; THIS[ this.hash ].draggingToZoom = false;
} }
@ -3194,9 +3195,10 @@ function onCanvasPress( event ) {
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType ); gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
if ( gestureSettings.dblClickToZoom ){ if ( gestureSettings.dblTapDragToZoom ){
var lastClickTime = THIS[ this.hash ].lastClickInfo.time; var lastClickTime = THIS[ this.hash ].lastClickInfo.time;
var lastClickPos = THIS[ this.hash ].lastClickInfo.position; var lastClickPos = THIS[ this.hash ].lastClickInfo.position;
var currClickTime = (new Date()).getTime(); var currClickTime = (new Date()).getTime();
var currClickPos = event.position; var currClickPos = event.position;
@ -3215,6 +3217,9 @@ function onCanvasPress( event ) {
} }
function onCanvasRelease( event ) { function onCanvasRelease( event ) {
var gestureSettings;
/** /**
* Raised when the primary mouse button is released or touch ends on the {@link OpenSeadragon.Viewer#canvas} element. * Raised when the primary mouse button is released or touch ends on the {@link OpenSeadragon.Viewer#canvas} element.
* *
@ -3238,6 +3243,12 @@ function onCanvasRelease( event ) {
insideElementReleased: event.insideElementReleased, insideElementReleased: event.insideElementReleased,
originalEvent: event.originalEvent originalEvent: event.originalEvent
}); });
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
if( gestureSettings.dblTapDragToZoom && THIS[ this.hash ].draggingToZoom === true ){
THIS[ this.hash ].draggingToZoom = false;
}
} }
function onCanvasNonPrimaryPress( event ) { function onCanvasNonPrimaryPress( event ) {