diff --git a/src/control.js b/src/control.js index 1ab1276c..c9670ecc 100644 --- a/src/control.js +++ b/src/control.js @@ -152,7 +152,6 @@ $.Control = function ( element, options, container ) { parent.appendChild( this.wrapper ); } - this.wrapper.style.display = "none"; }; /** @lends OpenSeadragon.Control.prototype */ diff --git a/src/openseadragon.js b/src/openseadragon.js index 56474f63..92dc62b2 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -341,6 +341,10 @@ * @property {Boolean} [gestureSettingsMouse.clickToZoom=true] - Zoom on click gesture * @property {Boolean} [gestureSettingsMouse.dblClickToZoom=false] - Zoom on double-click gesture. Note: If set to true * then clickToZoom should be set to false to prevent multiple zooms. + * @property {Boolean} [gestureSettingsMouse.dblClickDragToZoom=false] - Zoom on dragging through + * double-click gesture ( single click and next click to drag). Note: If set to true + * then clickToZoom should be set to false to prevent multiple zooms. + * @property {Boolean} [gestureSettingsMouse.pinchToZoom=false] - Zoom on pinch gesture * @property {Boolean} [gestureSettingsMouse.zoomToRefPoint=true] - If zoomToRefPoint is true, the zoom is centered at the pointer position. Otherwise, * the zoom is centered at the canvas center. @@ -1198,13 +1202,12 @@ function OpenSeadragon( options ){ dblClickDistThreshold: 20, springStiffness: 6.5, animationTime: 1.2, - dblTapDragToZoomSpeed: 0.5, gestureSettingsMouse: { dragToPan: true, scrollToZoom: true, clickToZoom: true, dblClickToZoom: false, - dblTapDragToZoom: false, + dblClickDragToZoom: false, pinchToZoom: false, zoomToRefPoint: true, flickEnabled: false, @@ -1217,7 +1220,7 @@ function OpenSeadragon( options ){ scrollToZoom: false, clickToZoom: false, dblClickToZoom: true, - dblTapDragToZoom: true, + dblClickDragToZoom: true, pinchToZoom: true, zoomToRefPoint: true, flickEnabled: true, @@ -1230,7 +1233,7 @@ function OpenSeadragon( options ){ scrollToZoom: false, clickToZoom: true, dblClickToZoom: false, - dblTapDragToZoom: false, + dblClickDragToZoom: false, pinchToZoom: false, zoomToRefPoint: true, flickEnabled: false, @@ -1243,7 +1246,7 @@ function OpenSeadragon( options ){ scrollToZoom: false, clickToZoom: false, dblClickToZoom: true, - dblTapDragToZoom: true, + dblClickDragToZoom: true, pinchToZoom: true, zoomToRefPoint: true, flickEnabled: true, @@ -1253,7 +1256,7 @@ function OpenSeadragon( options ){ }, zoomPerClick: 2, zoomPerScroll: 1.2, - zoomPerDblTapDrag: 1.2, + zoomPerDblClickDrag: 1.01, zoomPerSecond: 1.0, blendTime: 0, alwaysBlend: false, diff --git a/src/viewer.js b/src/viewer.js index 1483ea4a..ed2fc429 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -2902,6 +2902,7 @@ function onCanvasClick( event ) { if ( !canvasClickEventArgs.preventDefaultAction && this.viewport && event.quick ) { gestureSettings = this.gestureSettingsByDeviceType( event.pointerType ); + if ( gestureSettings.clickToZoom ) { this.viewport.zoomBy( event.shift ? 1.0 / this.zoomPerClick : this.zoomPerClick, @@ -2909,8 +2910,9 @@ function onCanvasClick( event ) { ); this.viewport.applyConstraints(); } - else if( gestureSettings.dblTapDragToZoom ) { - THIS[ this.hash ].lastClickInfo.time = (new Date()).getTime(); + + if( gestureSettings.dblClickDragToZoom ) { + THIS[ this.hash ].lastClickInfo.time = $.now(); THIS[ this.hash ].lastClickInfo.position = event.position; } } @@ -2992,51 +2994,49 @@ function onCanvasDrag( event ) { gestureSettings = this.gestureSettingsByDeviceType( event.pointerType ); - if (gestureSettings.dblTapDragToZoom && THIS[ this.hash ].draggingToZoom){ - var userSpeedForZoom = this.dblTapDragToZoomSpeed; - var factor = Math.pow( this.zoomPerDblTapDrag, event.delta.y / (200 * (1 - userSpeedForZoom))); - this.viewport.zoomBy(factor); - // this.viewport.applyConstraints(); - } + if(!canvasDragEventArgs.preventDefaultAction && this.viewport){ - if (gestureSettings.dragToPan && !THIS[ this.hash ].draggingToZoom && !canvasDragEventArgs.preventDefaultAction && this.viewport ) { - if( !this.panHorizontal ){ - event.delta.x = 0; + if (gestureSettings.dblTapDragToZoom && THIS[ this.hash ].draggingToZoom){ + var factor = Math.pow( this.zoomPerDblClickDrag, event.delta.y); + this.viewport.zoomBy(factor); } - if( !this.panVertical ){ - event.delta.y = 0; - } - if(this.viewport.flipped){ - event.delta.x = -event.delta.x; - } - - if( this.constrainDuringPan ){ - var delta = this.viewport.deltaPointsFromPixels( event.delta.negate() ); - - this.viewport.centerSpringX.target.value += delta.x; - this.viewport.centerSpringY.target.value += delta.y; - - var bounds = this.viewport.getBounds(); - var constrainedBounds = this.viewport.getConstrainedBounds(); - - this.viewport.centerSpringX.target.value -= delta.x; - this.viewport.centerSpringY.target.value -= delta.y; - - if (bounds.x !== constrainedBounds.x) { + else if (gestureSettings.dragToPan && !THIS[ this.hash ].draggingToZoom) { + if( !this.panHorizontal ){ event.delta.x = 0; } - - if (bounds.y !== constrainedBounds.y) { + if( !this.panVertical ){ event.delta.y = 0; } + if(this.viewport.flipped){ + event.delta.x = -event.delta.x; + } + + if( this.constrainDuringPan ){ + var delta = this.viewport.deltaPointsFromPixels( event.delta.negate() ); + + this.viewport.centerSpringX.target.value += delta.x; + this.viewport.centerSpringY.target.value += delta.y; + + var bounds = this.viewport.getBounds(); + var constrainedBounds = this.viewport.getConstrainedBounds(); + + this.viewport.centerSpringX.target.value -= delta.x; + this.viewport.centerSpringY.target.value -= delta.y; + + if (bounds.x !== constrainedBounds.x) { + event.delta.x = 0; + } + + if (bounds.y !== constrainedBounds.y) { + event.delta.y = 0; + } + } + + this.viewport.panBy( this.viewport.deltaPointsFromPixels( event.delta.negate() ), gestureSettings.flickEnabled && !this.constrainDuringPan); } - this.viewport.panBy( this.viewport.deltaPointsFromPixels( event.delta.negate() ), gestureSettings.flickEnabled && !this.constrainDuringPan); } - - - } function onCanvasDragEnd( event ) { @@ -3199,7 +3199,7 @@ function onCanvasPress( event ) { var lastClickTime = THIS[ this.hash ].lastClickInfo.time; var lastClickPos = THIS[ this.hash ].lastClickInfo.position; - var currClickTime = (new Date()).getTime(); + var currClickTime = $.now(); var currClickPos = event.position; if ( lastClickTime === null || lastClickPos === null ) { diff --git a/test/demo/collections/index.html b/test/demo/collections/index.html index 4074babc..e434574d 100644 --- a/test/demo/collections/index.html +++ b/test/demo/collections/index.html @@ -5,42 +5,6 @@ -