mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +03:00
double click drag same position constraint removed
This commit is contained in:
parent
d44fc85582
commit
ca88de8e7f
@ -213,7 +213,7 @@ $.Viewer = function( options ) {
|
|||||||
lastZoomTime: null,
|
lastZoomTime: null,
|
||||||
fullPage: false,
|
fullPage: false,
|
||||||
onfullscreenchange: null,
|
onfullscreenchange: null,
|
||||||
lastClickInfo: { time: null, position: null },
|
lastClickTime: null,
|
||||||
draggingToZoom: false
|
draggingToZoom: false
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2900,6 +2900,7 @@ function onCanvasClick( event ) {
|
|||||||
|
|
||||||
this.raiseEvent( 'canvas-click', canvasClickEventArgs);
|
this.raiseEvent( 'canvas-click', canvasClickEventArgs);
|
||||||
|
|
||||||
|
|
||||||
if ( !canvasClickEventArgs.preventDefaultAction && this.viewport && event.quick ) {
|
if ( !canvasClickEventArgs.preventDefaultAction && this.viewport && event.quick ) {
|
||||||
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
|
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
|
||||||
|
|
||||||
@ -2912,8 +2913,7 @@ function onCanvasClick( event ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( gestureSettings.dblClickDragToZoom ) {
|
if( gestureSettings.dblClickDragToZoom ) {
|
||||||
THIS[ this.hash ].lastClickInfo.time = $.now();
|
THIS[ this.hash ].lastClickTime = $.now();
|
||||||
THIS[ this.hash ].lastClickInfo.position = event.position;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2996,7 +2996,8 @@ function onCanvasDrag( event ) {
|
|||||||
|
|
||||||
if(!canvasDragEventArgs.preventDefaultAction && this.viewport){
|
if(!canvasDragEventArgs.preventDefaultAction && this.viewport){
|
||||||
|
|
||||||
if (gestureSettings.dblTapDragToZoom && THIS[ this.hash ].draggingToZoom){
|
|
||||||
|
if (gestureSettings.dblClickDragToZoom && THIS[ this.hash ].draggingToZoom){
|
||||||
var factor = Math.pow( this.zoomPerDblClickDrag, event.delta.y);
|
var factor = Math.pow( this.zoomPerDblClickDrag, event.delta.y);
|
||||||
this.viewport.zoomBy(factor);
|
this.viewport.zoomBy(factor);
|
||||||
}
|
}
|
||||||
@ -3097,7 +3098,7 @@ function onCanvasDragEnd( event ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( gestureSettings.dblTapDragToZoom && THIS[ this.hash ].draggingToZoom === true ){
|
if( gestureSettings.dblClickDragToZoom && THIS[ this.hash ].draggingToZoom === true ){
|
||||||
THIS[ this.hash ].draggingToZoom = false;
|
THIS[ this.hash ].draggingToZoom = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3165,7 +3166,6 @@ function onCanvasLeave( event ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onCanvasPress( event ) {
|
function onCanvasPress( event ) {
|
||||||
|
|
||||||
var gestureSettings;
|
var gestureSettings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3194,24 +3194,19 @@ function onCanvasPress( event ) {
|
|||||||
|
|
||||||
|
|
||||||
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
|
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
|
||||||
|
if ( gestureSettings.dblClickDragToZoom ){
|
||||||
if ( gestureSettings.dblTapDragToZoom ){
|
var lastClickTime = THIS[ this.hash ].lastClickTime;
|
||||||
var lastClickTime = THIS[ this.hash ].lastClickInfo.time;
|
|
||||||
var lastClickPos = THIS[ this.hash ].lastClickInfo.position;
|
|
||||||
|
|
||||||
var currClickTime = $.now();
|
var currClickTime = $.now();
|
||||||
var currClickPos = event.position;
|
|
||||||
|
|
||||||
if ( lastClickTime === null || lastClickPos === null ) {
|
if ( lastClickTime === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastClickPos.distanceTo(currClickPos) < 10 && ((currClickTime - lastClickTime) < 2000)) {
|
if ((currClickTime - lastClickTime) < 2000) {
|
||||||
THIS[ this.hash ].draggingToZoom = true;
|
THIS[ this.hash ].draggingToZoom = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
THIS[ this.hash ].lastClickInfo.position = null;
|
THIS[ this.hash ].lastClickTime = null;
|
||||||
THIS[ this.hash ].lastClickInfo.time = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3246,7 +3241,7 @@ function onCanvasRelease( event ) {
|
|||||||
|
|
||||||
|
|
||||||
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
|
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
|
||||||
if( gestureSettings.dblTapDragToZoom && THIS[ this.hash ].draggingToZoom === true ){
|
if( gestureSettings.dblClickDragToZoom && THIS[ this.hash ].draggingToZoom === true ){
|
||||||
THIS[ this.hash ].draggingToZoom = false;
|
THIS[ this.hash ].draggingToZoom = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user