Update viewer.js

This commit is contained in:
Hamza Tatheer 2022-10-23 01:30:16 +05:00
parent 9a4b802286
commit 2f2285711d

View File

@ -3039,6 +3039,7 @@ function onCanvasDrag( event ) {
} }
function onCanvasDragEnd( event ) { function onCanvasDragEnd( event ) {
var gestureSettings;
var canvasDragEndEventArgs = { var canvasDragEndEventArgs = {
tracker: event.eventSource, tracker: event.eventSource,
pointerType: event.pointerType, pointerType: event.pointerType,
@ -3069,9 +3070,11 @@ function onCanvasDragEnd( event ) {
*/ */
this.raiseEvent('canvas-drag-end', canvasDragEndEventArgs); this.raiseEvent('canvas-drag-end', canvasDragEndEventArgs);
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
if (!canvasDragEndEventArgs.preventDefaultAction && this.viewport) { if (!canvasDragEndEventArgs.preventDefaultAction && this.viewport) {
var gestureSettings = this.gestureSettingsByDeviceType(event.pointerType); if ( !THIS[ this.hash ].draggingToZoom &&
if (gestureSettings.flickEnabled && gestureSettings.flickEnabled &&
event.speed >= gestureSettings.flickMinSpeed) { event.speed >= gestureSettings.flickMinSpeed) {
var amplitudeX = 0; var amplitudeX = 0;
if (this.panHorizontal) { if (this.panHorizontal) {
@ -3091,6 +3094,13 @@ function onCanvasDragEnd( event ) {
} }
this.viewport.applyConstraints(); this.viewport.applyConstraints();
} }
if( gestureSettings.dblClickToZoom && THIS[ this.hash ].draggingToZoom === true ){
THIS[ this.hash ].draggingToZoom = false;
}
} }
function onCanvasEnter( event ) { function onCanvasEnter( event ) {
@ -3205,8 +3215,6 @@ 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.
* *
@ -3230,13 +3238,6 @@ function onCanvasRelease( event ) {
insideElementReleased: event.insideElementReleased, insideElementReleased: event.insideElementReleased,
originalEvent: event.originalEvent originalEvent: event.originalEvent
}); });
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
if( gestureSettings.dblClickToZoom ){
THIS[ this.hash ].draggingToZoom = false;
}
} }
function onCanvasNonPrimaryPress( event ) { function onCanvasNonPrimaryPress( event ) {