mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 14:46:10 +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 );
|
parent.appendChild( this.wrapper );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.wrapper.style.display = "none";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @lends OpenSeadragon.Control.prototype */
|
/** @lends OpenSeadragon.Control.prototype */
|
||||||
|
@ -341,6 +341,10 @@
|
|||||||
* @property {Boolean} [gestureSettingsMouse.clickToZoom=true] - Zoom on click gesture
|
* @property {Boolean} [gestureSettingsMouse.clickToZoom=true] - Zoom on click gesture
|
||||||
* @property {Boolean} [gestureSettingsMouse.dblClickToZoom=false] - Zoom on double-click gesture. Note: If set to true
|
* @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.
|
* 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.pinchToZoom=false] - Zoom on pinch gesture
|
||||||
* @property {Boolean} [gestureSettingsMouse.zoomToRefPoint=true] - If zoomToRefPoint is true, the zoom is centered at the pointer position. Otherwise,
|
* @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.
|
* the zoom is centered at the canvas center.
|
||||||
@ -1198,13 +1202,12 @@ function OpenSeadragon( options ){
|
|||||||
dblClickDistThreshold: 20,
|
dblClickDistThreshold: 20,
|
||||||
springStiffness: 6.5,
|
springStiffness: 6.5,
|
||||||
animationTime: 1.2,
|
animationTime: 1.2,
|
||||||
dblTapDragToZoomSpeed: 0.5,
|
|
||||||
gestureSettingsMouse: {
|
gestureSettingsMouse: {
|
||||||
dragToPan: true,
|
dragToPan: true,
|
||||||
scrollToZoom: true,
|
scrollToZoom: true,
|
||||||
clickToZoom: true,
|
clickToZoom: true,
|
||||||
dblClickToZoom: false,
|
dblClickToZoom: false,
|
||||||
dblTapDragToZoom: false,
|
dblClickDragToZoom: false,
|
||||||
pinchToZoom: false,
|
pinchToZoom: false,
|
||||||
zoomToRefPoint: true,
|
zoomToRefPoint: true,
|
||||||
flickEnabled: false,
|
flickEnabled: false,
|
||||||
@ -1217,7 +1220,7 @@ function OpenSeadragon( options ){
|
|||||||
scrollToZoom: false,
|
scrollToZoom: false,
|
||||||
clickToZoom: false,
|
clickToZoom: false,
|
||||||
dblClickToZoom: true,
|
dblClickToZoom: true,
|
||||||
dblTapDragToZoom: true,
|
dblClickDragToZoom: true,
|
||||||
pinchToZoom: true,
|
pinchToZoom: true,
|
||||||
zoomToRefPoint: true,
|
zoomToRefPoint: true,
|
||||||
flickEnabled: true,
|
flickEnabled: true,
|
||||||
@ -1230,7 +1233,7 @@ function OpenSeadragon( options ){
|
|||||||
scrollToZoom: false,
|
scrollToZoom: false,
|
||||||
clickToZoom: true,
|
clickToZoom: true,
|
||||||
dblClickToZoom: false,
|
dblClickToZoom: false,
|
||||||
dblTapDragToZoom: false,
|
dblClickDragToZoom: false,
|
||||||
pinchToZoom: false,
|
pinchToZoom: false,
|
||||||
zoomToRefPoint: true,
|
zoomToRefPoint: true,
|
||||||
flickEnabled: false,
|
flickEnabled: false,
|
||||||
@ -1243,7 +1246,7 @@ function OpenSeadragon( options ){
|
|||||||
scrollToZoom: false,
|
scrollToZoom: false,
|
||||||
clickToZoom: false,
|
clickToZoom: false,
|
||||||
dblClickToZoom: true,
|
dblClickToZoom: true,
|
||||||
dblTapDragToZoom: true,
|
dblClickDragToZoom: true,
|
||||||
pinchToZoom: true,
|
pinchToZoom: true,
|
||||||
zoomToRefPoint: true,
|
zoomToRefPoint: true,
|
||||||
flickEnabled: true,
|
flickEnabled: true,
|
||||||
@ -1253,7 +1256,7 @@ function OpenSeadragon( options ){
|
|||||||
},
|
},
|
||||||
zoomPerClick: 2,
|
zoomPerClick: 2,
|
||||||
zoomPerScroll: 1.2,
|
zoomPerScroll: 1.2,
|
||||||
zoomPerDblTapDrag: 1.2,
|
zoomPerDblClickDrag: 1.01,
|
||||||
zoomPerSecond: 1.0,
|
zoomPerSecond: 1.0,
|
||||||
blendTime: 0,
|
blendTime: 0,
|
||||||
alwaysBlend: false,
|
alwaysBlend: false,
|
||||||
|
@ -2902,6 +2902,7 @@ 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 ) {
|
if ( gestureSettings.clickToZoom ) {
|
||||||
this.viewport.zoomBy(
|
this.viewport.zoomBy(
|
||||||
event.shift ? 1.0 / this.zoomPerClick : this.zoomPerClick,
|
event.shift ? 1.0 / this.zoomPerClick : this.zoomPerClick,
|
||||||
@ -2909,8 +2910,9 @@ function onCanvasClick( event ) {
|
|||||||
);
|
);
|
||||||
this.viewport.applyConstraints();
|
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;
|
THIS[ this.hash ].lastClickInfo.position = event.position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2992,51 +2994,49 @@ function onCanvasDrag( event ) {
|
|||||||
|
|
||||||
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
|
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
|
||||||
|
|
||||||
if (gestureSettings.dblTapDragToZoom && THIS[ this.hash ].draggingToZoom){
|
if(!canvasDragEventArgs.preventDefaultAction && this.viewport){
|
||||||
var userSpeedForZoom = this.dblTapDragToZoomSpeed;
|
|
||||||
var factor = Math.pow( this.zoomPerDblTapDrag, event.delta.y / (200 * (1 - userSpeedForZoom)));
|
|
||||||
this.viewport.zoomBy(factor);
|
|
||||||
// this.viewport.applyConstraints();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gestureSettings.dragToPan && !THIS[ this.hash ].draggingToZoom && !canvasDragEventArgs.preventDefaultAction && this.viewport ) {
|
if (gestureSettings.dblTapDragToZoom && THIS[ this.hash ].draggingToZoom){
|
||||||
if( !this.panHorizontal ){
|
var factor = Math.pow( this.zoomPerDblClickDrag, event.delta.y);
|
||||||
event.delta.x = 0;
|
this.viewport.zoomBy(factor);
|
||||||
}
|
}
|
||||||
if( !this.panVertical ){
|
else if (gestureSettings.dragToPan && !THIS[ this.hash ].draggingToZoom) {
|
||||||
event.delta.y = 0;
|
if( !this.panHorizontal ){
|
||||||
}
|
|
||||||
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;
|
event.delta.x = 0;
|
||||||
}
|
}
|
||||||
|
if( !this.panVertical ){
|
||||||
if (bounds.y !== constrainedBounds.y) {
|
|
||||||
event.delta.y = 0;
|
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 ) {
|
function onCanvasDragEnd( event ) {
|
||||||
@ -3199,7 +3199,7 @@ function onCanvasPress( event ) {
|
|||||||
var lastClickTime = THIS[ this.hash ].lastClickInfo.time;
|
var lastClickTime = THIS[ this.hash ].lastClickInfo.time;
|
||||||
var lastClickPos = THIS[ this.hash ].lastClickInfo.position;
|
var lastClickPos = THIS[ this.hash ].lastClickInfo.position;
|
||||||
|
|
||||||
var currClickTime = (new Date()).getTime();
|
var currClickTime = $.now();
|
||||||
var currClickPos = event.position;
|
var currClickPos = event.position;
|
||||||
|
|
||||||
if ( lastClickTime === null || lastClickPos === null ) {
|
if ( lastClickTime === null || lastClickPos === null ) {
|
||||||
|
@ -5,42 +5,6 @@
|
|||||||
<script type="text/javascript" src='../../../build/openseadragon/openseadragon.js'></script>
|
<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='../../lib/jquery-1.9.1.min.js'></script>
|
||||||
<script type="text/javascript" src='main.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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="contentDiv" class="openseadragon1"></div>
|
<div id="contentDiv" class="openseadragon1"></div>
|
||||||
|
Loading…
Reference in New Issue
Block a user