mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 05:06:09 +03:00
MouseTracker: Allow pre-processing of click and dblclick events
This commit is contained in:
parent
ce098f889c
commit
6a1a6275ed
@ -1247,7 +1247,7 @@
|
||||
* @property {Number} eventPhase
|
||||
* 0 == NONE, 1 == CAPTURING_PHASE, 2 == AT_TARGET, 3 == BUBBLING_PHASE.
|
||||
* @property {String} eventType
|
||||
* "contextmenu", "gotpointercapture", "lostpointercapture", "pointerenter", "pointerleave", "pointerover", "pointerout", "pointerdown", "pointerup", "pointermove", "pointercancel", "wheel".
|
||||
* "contextmenu", "gotpointercapture", "lostpointercapture", "pointerenter", "pointerleave", "pointerover", "pointerout", "pointerdown", "pointerup", "pointermove", "pointercancel", "wheel", "click", "dblclick".
|
||||
* @property {String} pointerType
|
||||
* "mouse", "touch", "pen", etc.
|
||||
* @property {Boolean} isEmulated
|
||||
@ -1802,9 +1802,24 @@
|
||||
* @inner
|
||||
*/
|
||||
function onClick( tracker, event ) {
|
||||
if ( tracker.clickHandler ) {
|
||||
event = $.getEvent( event );
|
||||
|
||||
//$.console.log('onClick ' + (tracker.userData ? tracker.userData.toString() : ''));
|
||||
|
||||
var eventInfo = {
|
||||
originalEvent: event,
|
||||
eventType: 'click',
|
||||
pointerType: 'mouse',
|
||||
isEmulated: false
|
||||
};
|
||||
preProcessEvent( tracker, eventInfo );
|
||||
|
||||
if ( eventInfo.preventDefault && !eventInfo.defaultPrevented ) {
|
||||
$.cancelEvent( event );
|
||||
}
|
||||
if ( eventInfo.stopPropagation ) {
|
||||
$.stopEvent( event );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1813,9 +1828,24 @@
|
||||
* @inner
|
||||
*/
|
||||
function onDblClick( tracker, event ) {
|
||||
if ( tracker.dblClickHandler ) {
|
||||
event = $.getEvent( event );
|
||||
|
||||
//$.console.log('onDblClick ' + (tracker.userData ? tracker.userData.toString() : ''));
|
||||
|
||||
var eventInfo = {
|
||||
originalEvent: event,
|
||||
eventType: 'dblclick',
|
||||
pointerType: 'mouse',
|
||||
isEmulated: false
|
||||
};
|
||||
preProcessEvent( tracker, eventInfo );
|
||||
|
||||
if ( eventInfo.preventDefault && !eventInfo.defaultPrevented ) {
|
||||
$.cancelEvent( event );
|
||||
}
|
||||
if ( eventInfo.stopPropagation ) {
|
||||
$.stopEvent( event );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1972,7 +2002,7 @@
|
||||
preProcessEvent( tracker, eventInfo );
|
||||
|
||||
// ContextMenu
|
||||
if ( tracker.contextMenuHandler ) {
|
||||
if ( tracker.contextMenuHandler && !eventInfo.preventGesture && !eventInfo.defaultPrevented ) {
|
||||
tracker.contextMenuHandler(
|
||||
{
|
||||
eventSource: tracker,
|
||||
@ -3241,6 +3271,20 @@
|
||||
eventInfo.preventGesture = false;
|
||||
eventInfo.stopPropagation = false;
|
||||
break;
|
||||
case 'click':
|
||||
eventInfo.isStopable = true;
|
||||
eventInfo.isCancelable = true;
|
||||
eventInfo.preventDefault = !!tracker.clickHandler;
|
||||
eventInfo.preventGesture = false;
|
||||
eventInfo.stopPropagation = false;
|
||||
break;
|
||||
case 'dblclick':
|
||||
eventInfo.isStopable = true;
|
||||
eventInfo.isCancelable = true;
|
||||
eventInfo.preventDefault = !!tracker.dblClickHandler;
|
||||
eventInfo.preventGesture = false;
|
||||
eventInfo.stopPropagation = false;
|
||||
break;
|
||||
case 'contextmenu':
|
||||
eventInfo.isStopable = true;
|
||||
eventInfo.isCancelable = true;
|
||||
|
Loading…
Reference in New Issue
Block a user