pr changes

This commit is contained in:
Hamza Tatheer 2022-10-29 21:22:25 +05:00
parent a0ac8666e0
commit d44fc85582
4 changed files with 47 additions and 81 deletions

View File

@ -152,7 +152,6 @@ $.Control = function ( element, options, container ) {
parent.appendChild( this.wrapper );
}
this.wrapper.style.display = "none";
};
/** @lends OpenSeadragon.Control.prototype */

View File

@ -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,

View File

@ -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,14 +2994,13 @@ 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 (gestureSettings.dblTapDragToZoom && THIS[ this.hash ].draggingToZoom){
var factor = Math.pow( this.zoomPerDblClickDrag, event.delta.y);
this.viewport.zoomBy(factor);
}
else if (gestureSettings.dragToPan && !THIS[ this.hash ].draggingToZoom) {
if( !this.panHorizontal ){
event.delta.x = 0;
}
@ -3034,8 +3035,7 @@ function onCanvasDrag( event ) {
this.viewport.panBy( this.viewport.deltaPointsFromPixels( event.delta.negate() ), gestureSettings.flickEnabled && !this.constrainDuringPan);
}
}
}
@ -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 ) {

View File

@ -5,42 +5,6 @@
<script type="text/javascript" src='../../../build/openseadragon/openseadragon.js'></script>
<script type="text/javascript" src='../../lib/jquery-1.9.1.min.js'></script>
<script type="text/javascript" src='main.js'></script>
<style type="text/css">
html,
body,
.openseadragon1 {
width: 100%;
height: 100%;
margin: 0;
}
.openseadragon1.small {
width: 50%;
}
.openseadragon-overlay {
background-color: rgba(255, 0, 0, 0.3);
}
[title ='Zoom in'] {
display: none;
}
[title ='Zoom out'] {
display: none;
}
[title ='Go home'] {
display: none;
}
[title ='Toggle full page'] {
display: none;
}
</style>
</head>
<body>
<div id="contentDiv" class="openseadragon1"></div>