Multi-Tap Gesture Detection for Screen Zones
How can I make it so that pressing two fast knocks (taps) on a specific area of the screen (let's say the bottom-left corner) outputs one state, while pressing three fast knocks outputs a different state?
For example, I know that the bottom-left area of my screen is around y=75 and x=10. I want to detect fast presses, and I don't want every press in that corner to trigger it.
the problem with my try is that it will always trigger preset 1 even when I tap 3 fast time (it needed to trigger only preset 2)
Store the [counter] input as a variable, and output it only when the [del] bangs. By patching exactly this I realized it would be the same as using [thresh] instead of [del] + [counter]:
Thanks this is great! is there an option to detect something more complicated such as two short taps then long hold of 2 sec? something like * * _____
You could something like this:
But it's not a very good UX choice I would say. It adds up latency (you need to wait after a click is released to know if the user wants to make more clicks or not in order to know which event they want to trigger), and I don't think I ever saw any app relying on such click sequences for anything? One long, one short, two shorts, yes, but combination of both or more than two clicks, no.
It depends of what you need it for, I used such gimmicks a lot to use one pedal switch for many functions.
As TFL stated, you need to set thresholds for detection, like double tap must happen within 200 ms, long press and realease afer 500ms and so on.
You can use for example double tap with long release, or tripple tap with very long release.
In that cases press and release start different timers, or clocker etc
P.S. you must also include rules to only accept touches within zone,
and only when their state changes, like if one touches wrong zone, slides to set one
and then slides out again, what should that trigger ?
Thanks for the above suggestion and patches. Very clear and nice.
and only when their state changes, like if one touches wrong zone, slides to set one
and then slides out again, what should that trigger ?
in that case it should not trigger at all
to compare list I should use zl.compare or any other object?
to start with , you need to simplify capture and add disqualifier for out of range mouse position.
something like this :

gives -1 whenever mouse gets out of the zone.
then you need to add logic to measure touches and start timer
only if state STARTS with a touch
in correct zone and ENDS with release in correct zone.
[zl.compare] yes, or use [tosymbol] with a [route "1" "1 1" "1 1 2"], or store your various actions in a coll like so:
"1", single_click;
"1 1", double_click;
"1 1 2", two_shorts_one_long;