mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +03:00
Merge pull request #1148 from sickrandir/preventDefault-canvas-click
Manage preventDefaultAction inside canvas-click event
This commit is contained in:
commit
7f2a6eb74b
@ -2463,16 +2463,15 @@ function onCanvasClick( event ) {
|
|||||||
this.canvas.focus();
|
this.canvas.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !event.preventDefaultAction && this.viewport && event.quick ) {
|
var canvasClickEventArgs = {
|
||||||
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
|
tracker: event.eventSource,
|
||||||
if ( gestureSettings.clickToZoom ) {
|
position: event.position,
|
||||||
this.viewport.zoomBy(
|
quick: event.quick,
|
||||||
event.shift ? 1.0 / this.zoomPerClick : this.zoomPerClick,
|
shift: event.shift,
|
||||||
this.viewport.pointFromPixel( event.position, true )
|
originalEvent: event.originalEvent,
|
||||||
);
|
preventDefaultAction: event.preventDefaultAction
|
||||||
this.viewport.applyConstraints();
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Raised when a mouse press/release or touch/remove occurs on the {@link OpenSeadragon.Viewer#canvas} element.
|
* Raised when a mouse press/release or touch/remove occurs on the {@link OpenSeadragon.Viewer#canvas} element.
|
||||||
*
|
*
|
||||||
@ -2485,15 +2484,21 @@ function onCanvasClick( event ) {
|
|||||||
* @property {Boolean} quick - True only if the clickDistThreshold and clickTimeThreshold are both passed. Useful for differentiating between clicks and drags.
|
* @property {Boolean} quick - True only if the clickDistThreshold and clickTimeThreshold are both passed. Useful for differentiating between clicks and drags.
|
||||||
* @property {Boolean} shift - True if the shift key was pressed during this event.
|
* @property {Boolean} shift - True if the shift key was pressed during this event.
|
||||||
* @property {Object} originalEvent - The original DOM event.
|
* @property {Object} originalEvent - The original DOM event.
|
||||||
|
* @property {Boolean} preventDefaultAction - Set to true to prevent default click to zoom behaviour. Default: false.
|
||||||
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
||||||
*/
|
*/
|
||||||
this.raiseEvent( 'canvas-click', {
|
this.raiseEvent( 'canvas-click', canvasClickEventArgs);
|
||||||
tracker: event.eventSource,
|
|
||||||
position: event.position,
|
if ( !canvasClickEventArgs.preventDefaultAction && this.viewport && event.quick ) {
|
||||||
quick: event.quick,
|
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
|
||||||
shift: event.shift,
|
if ( gestureSettings.clickToZoom ) {
|
||||||
originalEvent: event.originalEvent
|
this.viewport.zoomBy(
|
||||||
});
|
event.shift ? 1.0 / this.zoomPerClick : this.zoomPerClick,
|
||||||
|
this.viewport.pointFromPixel( event.position, true )
|
||||||
|
);
|
||||||
|
this.viewport.applyConstraints();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onCanvasDblClick( event ) {
|
function onCanvasDblClick( event ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user