Double touch detection in Diddy
Monkey Forums/Monkey Programming/Double touch detection in Diddy
| ||
How should I modify inputcache.monkey to support something akin to OnTouchDoubleClick in Screen? In inputcache, I've got: If Not touchData[pointer].movedTooFar And Not touchData[pointer].firedLongPress Then screen.OnTouchClick(x, y, pointer) Else ' check to see how fast we were moving to see if we fire a fling If touchData[pointer].touchVelocityX * touchData[pointer].touchVelocityX + touchData[pointer].touchVelocityY * touchData[pointer].touchVelocityY >= flingThreshold * flingThreshold Then screen.OnTouchFling(x, y, touchData[pointer].touchVelocityX, touchData[pointer].touchVelocityY, touchData[pointer].touchVelocitySpeed, pointer) End End I am bit puzzled on how to best do this. In fact, I want to replace a LongPress, which is not suited to my interaction, with a DoubleTouch. Thanks! |
| ||
Hmm... that's a tricky one. I can look into it for you if you like. |
| ||
In fact, I am currently implementing an kind of EventRecorder that is used by my own subclass of Screen and records touches through Method OnTouchClick:Void(x:Int, y:Int, pointer:Int) and hooks into Self.OnTouchDoubleClick(x,y,pointer) if it detects more than two clicks in a row for the same pointer. There is a tolerance introduced there as well but it duplicates the inputcache I think. It is all about entering answers for exercises. The best would be to have a gesture recognizer where one can draw digits on the screen with the finger but that's for the future :-) |