mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 05:06:09 +03:00
pr changes
This commit is contained in:
parent
a0ac8666e0
commit
d44fc85582
@ -152,7 +152,6 @@ $.Control = function ( element, options, container ) {
|
||||
parent.appendChild( this.wrapper );
|
||||
}
|
||||
|
||||
this.wrapper.style.display = "none";
|
||||
};
|
||||
|
||||
/** @lends OpenSeadragon.Control.prototype */
|
||||
|
@ -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,
|
||||
|
@ -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 ) {
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user