What is averageTouches
in Pan Gestures ?
#2346
-
I was looking at this example on simultaneous touches and saw the following : // Some code ...
const dragGesture = Gesture.Pan()
.averageTouches(true) // <---------- **THIS THING**
// Some code ... Then, I tried to search about Can someone explain what is the usage of |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I don't know either, but a guess is it takes the average amount of points generated per stroke (a stroke meaning a sequence of points generated while the pen is down). This is probably not what it is, but you're gonna have to guess from the context. |
Beta Was this translation helpful? Give feedback.
-
Thanks for pointing out it's not explained in the docs, it should be fixed soon. |
Beta Was this translation helpful? Give feedback.
.averageTouches(true)
is a modifier that makes Android mimic the behavior of iOS - when you have a pan gesture with more than one finger, Android by default will track the position of only the first one, while iOS averages the position of all active pointers. Using this modifier you can tell Android to use the averaged position of all active pointers to calculate the translation values for the gesture.Thanks for pointing out it's not explained in the docs, it should be fixed soon.