prime31 / TouchKit

Gestures and input handling made sane for Unity
904 stars 137 forks source link

Updated pan gesture with fixes for multiple touches. #13

Closed gregharding closed 10 years ago

gregharding commented 10 years ago

Fixed pan gesture jumping with an unexpected delta when using more than one touch and releasing one of the touches. It happens in demo1 a bit using the Unity remote. It just needed an update to previousLocation in touchesEnded, else sometimes another pan gesture started right away with the remaining touch and immediately jumped with a big delta.

Modified pan gesture to add/remove touches while recognising, allowing the gesture to continue to be recognised rather than being reset to began or ended. It looked like you intended to allow multiple touches to control the pan to make it work nicely with two-finger pinches and rotations, but the additional touches aren't captured by the pan gesture so releasing the initial touch while continuing the other one ended the pan unexpectedly. The changes should allow adding and removing touches to the pan while continuously recognising, only ending the pan when there aren't enough touches.