pr changes latest

This commit is contained in:
Hamza Tatheer 2022-11-06 18:23:12 +05:00
parent fccab2da56
commit cb2fbe9b50
2 changed files with 4 additions and 23 deletions

View File

@ -411,7 +411,7 @@
* The "zoom distance" per mouse scroll or touch pinch. <em><strong>Note:</strong> Setting this to 1.0 effectively disables the mouse-wheel zoom feature (also see gestureSettings[Mouse|Touch|Pen].scrollToZoom}).</em> * The "zoom distance" per mouse scroll or touch pinch. <em><strong>Note:</strong> Setting this to 1.0 effectively disables the mouse-wheel zoom feature (also see gestureSettings[Mouse|Touch|Pen].scrollToZoom}).</em>
* *
* @property {Number} [zoomPerDblClickDrag=1.2] * @property {Number} [zoomPerDblClickDrag=1.2]
* The "zoom distance" per mouse drag. * The "zoom distance" per mouse drag. <em><strong>Note:</strong> Setting this to 1.0 effectively disables the double-click-drag-to-Zoom feature (also see gestureSettings[Mouse|Touch|Pen].dblClickDragToZoom).</em>
* *
* @property {Number} [zoomPerSecond=1.0] * @property {Number} [zoomPerSecond=1.0]
* Sets the zoom amount per second when zoomIn/zoomOut buttons are pressed and held. * Sets the zoom amount per second when zoomIn/zoomOut buttons are pressed and held.

View File

@ -215,7 +215,6 @@ $.Viewer = function( options ) {
onfullscreenchange: null, onfullscreenchange: null,
lastClickTime: null, lastClickTime: null,
draggingToZoom: false, draggingToZoom: false,
onClickActionTimeoutId: null,
}; };
this._sequenceIndex = 0; this._sequenceIndex = 0;
@ -2905,23 +2904,12 @@ function onCanvasClick( event ) {
if ( !canvasClickEventArgs.preventDefaultAction && this.viewport && event.quick ) { if ( !canvasClickEventArgs.preventDefaultAction && this.viewport && event.quick ) {
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType ); gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
if (gestureSettings.clickToZoom === true){
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){
this.viewport.zoomBy( this.viewport.zoomBy(
event.shift ? 1.0 / this.zoomPerClick : this.zoomPerClick, event.shift ? 1.0 / this.zoomPerClick : this.zoomPerClick,
gestureSettings.zoomToRefPoint ? this.viewport.pointFromPixel( event.position, true ) : null gestureSettings.zoomToRefPoint ? this.viewport.pointFromPixel( event.position, true ) : null
); );
this.viewport.applyConstraints();
} }
if( gestureSettings.dblClickDragToZoom){ if( gestureSettings.dblClickDragToZoom){
@ -2967,10 +2955,6 @@ function onCanvasDblClick( event ) {
if ( !canvasDblClickEventArgs.preventDefaultAction && this.viewport ) { if ( !canvasDblClickEventArgs.preventDefaultAction && this.viewport ) {
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType ); gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
if ( gestureSettings.dblClickToZoom ) { if ( gestureSettings.dblClickToZoom ) {
this.viewport.zoomBy( this.viewport.zoomBy(
event.shift ? 1.0 / this.zoomPerClick : this.zoomPerClick, event.shift ? 1.0 / this.zoomPerClick : this.zoomPerClick,
gestureSettings.zoomToRefPoint ? this.viewport.pointFromPixel( event.position, true ) : null gestureSettings.zoomToRefPoint ? this.viewport.pointFromPixel( event.position, true ) : null
@ -3019,7 +3003,6 @@ function onCanvasDrag( event ) {
if(!canvasDragEventArgs.preventDefaultAction && this.viewport){ if(!canvasDragEventArgs.preventDefaultAction && this.viewport){
if (gestureSettings.dblClickDragToZoom && THIS[ this.hash ].draggingToZoom){ if (gestureSettings.dblClickDragToZoom && THIS[ this.hash ].draggingToZoom){
var factor = Math.pow( this.zoomPerDblClickDrag, event.delta.y / 50); var factor = Math.pow( this.zoomPerDblClickDrag, event.delta.y / 50);
this.viewport.zoomBy(factor); this.viewport.zoomBy(factor);
@ -3224,9 +3207,7 @@ function onCanvasPress( event ) {
return; return;
} }
if ((currClickTime - lastClickTime) < 290) { if ((currClickTime - lastClickTime) < 2000) {
clearTimeout(THIS[ this.hash ].onClickActionTimeoutId);
THIS[ this.hash ].onClickActionTimeoutId = null;
THIS[ this.hash ].draggingToZoom = true; THIS[ this.hash ].draggingToZoom = true;
} }