From cb2fbe9b50b8f2dcab247a0b8f3ffec36c1994d1 Mon Sep 17 00:00:00 2001 From: Hamza Tatheer <> Date: Sun, 6 Nov 2022 18:23:12 +0500 Subject: [PATCH] pr changes latest --- src/openseadragon.js | 2 +- src/viewer.js | 25 +++---------------------- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index fa1ac590..daf77046 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -411,7 +411,7 @@ * The "zoom distance" per mouse scroll or touch pinch. Note: Setting this to 1.0 effectively disables the mouse-wheel zoom feature (also see gestureSettings[Mouse|Touch|Pen].scrollToZoom}). * * @property {Number} [zoomPerDblClickDrag=1.2] - * The "zoom distance" per mouse drag. + * The "zoom distance" per mouse drag. Note: Setting this to 1.0 effectively disables the double-click-drag-to-Zoom feature (also see gestureSettings[Mouse|Touch|Pen].dblClickDragToZoom). * * @property {Number} [zoomPerSecond=1.0] * Sets the zoom amount per second when zoomIn/zoomOut buttons are pressed and held. diff --git a/src/viewer.js b/src/viewer.js index a640e479..3108d034 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -215,7 +215,6 @@ $.Viewer = function( options ) { onfullscreenchange: null, lastClickTime: null, draggingToZoom: false, - onClickActionTimeoutId: null, }; this._sequenceIndex = 0; @@ -2905,23 +2904,12 @@ function onCanvasClick( event ) { if ( !canvasClickEventArgs.preventDefaultAction && this.viewport && event.quick ) { gestureSettings = this.gestureSettingsByDeviceType( event.pointerType ); - - if(gestureSettings.clickToZoom === true && gestureSettings.dblClickDragToZoom === true){ - var root = this; - var zoomImage = function() { - root.viewport.zoomBy( - event.shift ? 1.0 / root.zoomPerClick : root.zoomPerClick, - gestureSettings.zoomToRefPoint ? root.viewport.pointFromPixel( event.position, true ) : null - ); - }; - - THIS[ this.hash ].onClickActionTimeoutId = setTimeout(zoomImage, 300); - } - else if (gestureSettings.clickToZoom === true){ + if (gestureSettings.clickToZoom === true){ this.viewport.zoomBy( event.shift ? 1.0 / this.zoomPerClick : this.zoomPerClick, gestureSettings.zoomToRefPoint ? this.viewport.pointFromPixel( event.position, true ) : null ); + this.viewport.applyConstraints(); } if( gestureSettings.dblClickDragToZoom){ @@ -2967,10 +2955,6 @@ function onCanvasDblClick( event ) { if ( !canvasDblClickEventArgs.preventDefaultAction && this.viewport ) { gestureSettings = this.gestureSettingsByDeviceType( event.pointerType ); if ( gestureSettings.dblClickToZoom ) { - - - - this.viewport.zoomBy( event.shift ? 1.0 / this.zoomPerClick : this.zoomPerClick, gestureSettings.zoomToRefPoint ? this.viewport.pointFromPixel( event.position, true ) : null @@ -3019,7 +3003,6 @@ function onCanvasDrag( event ) { if(!canvasDragEventArgs.preventDefaultAction && this.viewport){ - if (gestureSettings.dblClickDragToZoom && THIS[ this.hash ].draggingToZoom){ var factor = Math.pow( this.zoomPerDblClickDrag, event.delta.y / 50); this.viewport.zoomBy(factor); @@ -3224,9 +3207,7 @@ function onCanvasPress( event ) { return; } - if ((currClickTime - lastClickTime) < 290) { - clearTimeout(THIS[ this.hash ].onClickActionTimeoutId); - THIS[ this.hash ].onClickActionTimeoutId = null; + if ((currClickTime - lastClickTime) < 2000) { THIS[ this.hash ].draggingToZoom = true; }