pskink / matrix_gesture_detector

A gesture detector mapping translation/rotation/scale gestures to a Matrix4 object.
Other
134 stars 101 forks source link

How do I know if the user uses 1 finger or 2 fingers? #14

Closed zenkog closed 4 years ago

zenkog commented 4 years ago

HI, thank you for the awesome package. What I want to achieve is that I only want to Pan and Zoom whenever the user uses two fingers to do it. Because I have other needs for the single finger. So how can I detect whether it is a single finger touch or two fingers touch?

Thanks

zenkog commented 4 years ago

Finally I solved the problem by using Listener and embed the MatrixGestureDetector as its child. Then I can count how many points is touching the screen by using its onPointerDown callback.

Hope this could help someone. Thanks

alexsullivan114 commented 4 years ago

@zenkog I'd love to get a bit more info about how you solved this issue. Right now I'm using the Listener approach you outlined and setting shouldTranslate according to how many pointer events we've received, but I'm not sure how to actually act on a pan with a single finger. Embedding another GestureDetector appears to throw off the gesture detector the library is using.

Any ideas?