Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
multi-touch?
-
When using Pythonista for a scene-based script, I've experimented with the begin/moved/end touch events. The problem I've found, though, is dealing with multi-touch. If you place one finger you get the begin/moved/end as expected. If, while the first finger is held, down you place another finger on the screen you'll now be getting 2 moved events together, i.e. you'll be getting move invoked for both touches. The problem is there doesn't appear to be any way to reliably distinguish which is which.
When the first finger is placed and being moved you want to track its movement differently from the second so that the second doesn't throw off whatever movement you were generating as a result of the first.
Any ideas on this?
One thing I tried was using the prev_location to tie the move event with the correct touch. This -sort of- works, however, the ended event doesn't seem to match, the location of the end event doesn't seem to line up with the prev_location of the move event previously received so when a touch is ended it throws things off a bit.
So how does one properly deal with multi-touch in a pythonista scene-based script? How do you track to which touch the move event applies?
-
Every touch has a <code>touch_id</code> attribute that stays the same for the entire duration of that particular touch.
-
Here's a very basic example of how to track multiple touches:
-
d'oh! Well I guess I feel dumb now for spending all that time trying to correlate the touches using the prev position :) A unique ID is exactly what I was hoping for; I must have just missed it in the docs. Thanks, I think that'll work perfectly :)