taye / interact.js

JavaScript drag and drop, resizing and multi-touch gestures with inertia and snapping for modern browsers (and also IE9+)
http://interactjs.io/
MIT License
12.32k stars 783 forks source link

'tap' events are firing on 'doubletap' and 'hold' V1.10.11 #964

Open tmtron opened 2 years ago

tmtron commented 2 years ago

When we double click, then tapwill also fire (with event.double is false).
The same is true for 'hold'

If I understood this comment https://github.com/taye/interact.js/issues/155#issuecomment-71202352 correctly, then it is expected, that (on double clikc) the tap event is also fired with event.double=false - but this is not the case (event.double=true)

Here is a full stackblitz example

Expected behavior

On double-click the tap event should fire and have event.double=true.
On hold the tap event should not fire.

Actual behavior

On double-click the tap event fires and has event.double=false.
On hold the 'hold' event fires, and then the tap event fires.

System configuration

1.10.11: Google Chrome Version 100.0.4896.88: Windows 10:

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

tmtron commented 2 years ago

not stale

taye commented 2 years ago

I don't see tap firing with double == false, but I realized that doubletap events don't have a double property. I'm going to add a double == true property to doubletap events.

If you want to ignore taps after hold, you can check tapEvent.dt < 500

tmtron commented 1 year ago

If you want to ignore taps after hold, you can check tapEvent.dt < 500

thanks, that works: tapEvent.dt >= 500 can be detected to use a tap after hold (which I want to ignore)

I don't see tap firing with double == false