mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +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
|
* @property {Number} eventPhase
|
||||||
* 0 == NONE, 1 == CAPTURING_PHASE, 2 == AT_TARGET, 3 == BUBBLING_PHASE.
|
* 0 == NONE, 1 == CAPTURING_PHASE, 2 == AT_TARGET, 3 == BUBBLING_PHASE.
|
||||||
* @property {String} eventType
|
* @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
|
* @property {String} pointerType
|
||||||
* "mouse", "touch", "pen", etc.
|
* "mouse", "touch", "pen", etc.
|
||||||
* @property {Boolean} isEmulated
|
* @property {Boolean} isEmulated
|
||||||
@ -1802,9 +1802,24 @@
|
|||||||
* @inner
|
* @inner
|
||||||
*/
|
*/
|
||||||
function onClick( tracker, event ) {
|
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 );
|
$.cancelEvent( event );
|
||||||
}
|
}
|
||||||
|
if ( eventInfo.stopPropagation ) {
|
||||||
|
$.stopEvent( event );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1813,9 +1828,24 @@
|
|||||||
* @inner
|
* @inner
|
||||||
*/
|
*/
|
||||||
function onDblClick( tracker, event ) {
|
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 );
|
$.cancelEvent( event );
|
||||||
}
|
}
|
||||||
|
if ( eventInfo.stopPropagation ) {
|
||||||
|
$.stopEvent( event );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1972,7 +2002,7 @@
|
|||||||
preProcessEvent( tracker, eventInfo );
|
preProcessEvent( tracker, eventInfo );
|
||||||
|
|
||||||
// ContextMenu
|
// ContextMenu
|
||||||
if ( tracker.contextMenuHandler ) {
|
if ( tracker.contextMenuHandler && !eventInfo.preventGesture && !eventInfo.defaultPrevented ) {
|
||||||
tracker.contextMenuHandler(
|
tracker.contextMenuHandler(
|
||||||
{
|
{
|
||||||
eventSource: tracker,
|
eventSource: tracker,
|
||||||
@ -3241,6 +3271,20 @@
|
|||||||
eventInfo.preventGesture = false;
|
eventInfo.preventGesture = false;
|
||||||
eventInfo.stopPropagation = false;
|
eventInfo.stopPropagation = false;
|
||||||
break;
|
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':
|
case 'contextmenu':
|
||||||
eventInfo.isStopable = true;
|
eventInfo.isStopable = true;
|
||||||
eventInfo.isCancelable = true;
|
eventInfo.isCancelable = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user