diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 3996a56..9c2cf38 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -1349,6 +1349,9 @@ const isTouch = data.pointerType === 'touch'; const isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen'); + // need to track mouse down status in the mouse block so that we can emit + // event in a later block + let isMouseTap = false; // Mouse only if (isMouse) @@ -1368,8 +1371,8 @@ if (isDown) { this.dispatchEvent(displayObject, isRightButton ? 'rightclick' : 'click', interactionEvent); - // because we can confirm that the mousedown happened on this object, emit pointertap - this.dispatchEvent(displayObject, 'pointertap', interactionEvent); + // because we can confirm that the mousedown happened on this object, flag for later emit of pointertap + isMouseTap = true; } } else if (isDown) @@ -1398,8 +1401,8 @@ if (trackingData) { - // mouse pointer taps are handled in the isMouse block for code simplicity - if (!isMouse) + // emit pointertap if not a mouse, or if the mouse block decided it was a tap + if (!isMouse || isMouseTap) { this.dispatchEvent(displayObject, 'pointertap', interactionEvent); }