Handling only one finger at time

Hello, i recently started using p5.js and it is quite funny. I have a problem with function touchStarted() because i want to handle only one finger at the time. If I touch two fingers at the same time I want to handle only the newer one. I would use mousePressed or mouseClicked but it dont work on mobiles. Thanks for your help!

Answers

  • edited April 2017

    Use the touches[] array. When the array changes length then you have added a second finger (or a third).

    I'm not sure I understand your application, but you could take the last entry or, if you cache the old array, then you could use distance to guess which entry is new (if that is important).

Sign In or Register to comment.