Swipe/gesture recognition

Monkey Forums/Monkey Programming/Swipe/gesture recognition

matt(Posted 2011) [#1]
Has anybody coded any type of swipe or gesture recognition?

Thanks,
matt


JIM(Posted 2011) [#2]
I kinda did something similar. Not sure how "right" this is, but the way I did it is this:

When TouchDown(0) and TouchDown(1) and TouchHit(2) (my gesture uses 3 fingers for swiping), record the average position (TouchX, TouchY) of those 3.

Then while all 3 are TouchDown, make a difference between the current position and the old one. If it's greater than 40% of deviceWidth, you got a swipe :D

You can of course make a time constraint (aka cancel it after 2 seconds for example). You can also constrain it on X only or Y only.