mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 05:06:09 +03:00
Added dragToPan to the GestureSettings class, implemented in Viewer
This commit is contained in:
parent
118f4cfed6
commit
3947c81726
@ -38,6 +38,7 @@ OPENSEADRAGON CHANGELOG
|
||||
* Added preventDefault option to MouseTracker.contextMenuHandler and Viewer 'canvas-contextmenu' event args (#1951 @msalsbery)
|
||||
* MouseTracker: Added preProcessEventHandler for keydown, keyup, keypress, focus, blur Events (#1951 @msalsbery)
|
||||
* Fixed preventDefaultAction functionality in viewer events (#1953 @msalsbery)
|
||||
* Added dragToPan to the GestureSettings class, implemented in Viewer (# @msalsbery)
|
||||
|
||||
2.4.2:
|
||||
|
||||
|
@ -230,7 +230,18 @@ $.Navigator = function( options ){
|
||||
dragHandler: $.delegate( this, onCanvasDrag ),
|
||||
clickHandler: $.delegate( this, onCanvasClick ),
|
||||
releaseHandler: $.delegate( this, onCanvasRelease ),
|
||||
scrollHandler: $.delegate( this, onCanvasScroll )
|
||||
scrollHandler: $.delegate( this, onCanvasScroll ),
|
||||
preProcessEventHandler: function (eventInfo) {
|
||||
switch (eventInfo.eventType) {
|
||||
case 'wheel':
|
||||
//don't scroll the page up and down if the user is scrolling
|
||||
//in the navigator
|
||||
eventInfo.preventDefault = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
this.outerTracker.userData = 'Navigator.outerTracker';
|
||||
|
||||
@ -607,10 +618,6 @@ function onCanvasScroll( event ) {
|
||||
shift: event.shift,
|
||||
originalEvent: event.originalEvent
|
||||
});
|
||||
|
||||
//don't scroll the page up and down if the user is scrolling
|
||||
//in the navigator
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -320,6 +320,7 @@
|
||||
*
|
||||
* @property {OpenSeadragon.GestureSettings} [gestureSettingsMouse]
|
||||
* Settings for gestures generated by a mouse pointer device. (See {@link OpenSeadragon.GestureSettings})
|
||||
* @property {Boolean} [gestureSettingsMouse.dragToPan=true] - Pan on drag gesture
|
||||
* @property {Boolean} [gestureSettingsMouse.scrollToZoom=true] - Zoom on scroll 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
|
||||
@ -334,6 +335,7 @@
|
||||
*
|
||||
* @property {OpenSeadragon.GestureSettings} [gestureSettingsTouch]
|
||||
* Settings for gestures generated by a touch pointer device. (See {@link OpenSeadragon.GestureSettings})
|
||||
* @property {Boolean} [gestureSettingsMouse.dragToPan=true] - Pan on drag gesture
|
||||
* @property {Boolean} [gestureSettingsTouch.scrollToZoom=false] - Zoom on scroll gesture
|
||||
* @property {Boolean} [gestureSettingsTouch.clickToZoom=false] - Zoom on click gesture
|
||||
* @property {Boolean} [gestureSettingsTouch.dblClickToZoom=true] - Zoom on double-click gesture. Note: If set to true
|
||||
@ -348,6 +350,7 @@
|
||||
*
|
||||
* @property {OpenSeadragon.GestureSettings} [gestureSettingsPen]
|
||||
* Settings for gestures generated by a pen pointer device. (See {@link OpenSeadragon.GestureSettings})
|
||||
* @property {Boolean} [gestureSettingsMouse.dragToPan=true] - Pan on drag gesture
|
||||
* @property {Boolean} [gestureSettingsPen.scrollToZoom=false] - Zoom on scroll gesture
|
||||
* @property {Boolean} [gestureSettingsPen.clickToZoom=true] - Zoom on click gesture
|
||||
* @property {Boolean} [gestureSettingsPen.dblClickToZoom=false] - Zoom on double-click gesture. Note: If set to true
|
||||
@ -362,6 +365,7 @@
|
||||
*
|
||||
* @property {OpenSeadragon.GestureSettings} [gestureSettingsUnknown]
|
||||
* Settings for gestures generated by unknown pointer devices. (See {@link OpenSeadragon.GestureSettings})
|
||||
* @property {Boolean} [gestureSettingsMouse.dragToPan=true] - Pan on drag gesture
|
||||
* @property {Boolean} [gestureSettingsUnknown.scrollToZoom=true] - Zoom on scroll gesture
|
||||
* @property {Boolean} [gestureSettingsUnknown.clickToZoom=false] - Zoom on click gesture
|
||||
* @property {Boolean} [gestureSettingsUnknown.dblClickToZoom=true] - Zoom on double-click gesture. Note: If set to true
|
||||
@ -651,6 +655,9 @@
|
||||
* @typedef {Object} GestureSettings
|
||||
* @memberof OpenSeadragon
|
||||
*
|
||||
* @property {Boolean} dragToPan
|
||||
* Set to false to disable panning on drag gestures.
|
||||
*
|
||||
* @property {Boolean} scrollToZoom
|
||||
* Set to false to disable zooming on scroll gestures.
|
||||
*
|
||||
|
@ -121,7 +121,16 @@ $.ReferenceStrip = function ( options ) {
|
||||
enterHandler: $.delegate( this, onStripEnter ),
|
||||
leaveHandler: $.delegate( this, onStripLeave ),
|
||||
keyDownHandler: $.delegate( this, onKeyDown ),
|
||||
keyHandler: $.delegate( this, onKeyPress )
|
||||
keyHandler: $.delegate( this, onKeyPress ),
|
||||
preProcessEventHandler: function (eventInfo) {
|
||||
switch (eventInfo.eventType) {
|
||||
case 'wheel':
|
||||
eventInfo.preventDefault = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
//Controls the position and orientation of the reference strip and sets the
|
||||
@ -348,7 +357,6 @@ function onStripDrag( event ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@ -397,8 +405,6 @@ function onStripScroll( event ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
//cancels event
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -489,7 +495,6 @@ function onStripEnter( event ) {
|
||||
element.style.marginLeft = "0px";
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -512,7 +517,6 @@ function onStripLeave( event ) {
|
||||
element.style.marginLeft = "-" + ( $.getElementSize( element ).x / 2 ) + "px";
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2846,8 +2846,9 @@ function onCanvasDrag( event ) {
|
||||
*/
|
||||
this.raiseEvent( 'canvas-drag', canvasDragEventArgs);
|
||||
|
||||
if ( !canvasDragEventArgs.preventDefaultAction && this.viewport ) {
|
||||
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
|
||||
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
|
||||
|
||||
if ( gestureSettings.dragToPan && !canvasDragEventArgs.preventDefaultAction && this.viewport ) {
|
||||
if( !this.panHorizontal ){
|
||||
event.delta.x = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user