Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed faulty pinch gesture handler on Android when in a ScrollView/FlatList #1725

Conversation

timbrandin
Copy link

FYI this is my first time writing Kotlin, please be gentle.

I noticed that ScaleGestureDetector returned zero and different values for scale and focal point as the iOS equivalent, so I suggest this solution which uses the bounding box of the touches to calculate the scale from the difference between the hypothenuse from initial touch. Similar to how PanGestureHandler calculates translation using start difference.

Also with this we get focal point in the local coordinate system of the handler view, calculated using average position of all touches. Which is what you would expect from iOS.

Fixes #1709
Fixes #1406
Fixes #1082

Test plan

Have tested on Android Emulator - Pixel 4 API 31, will test with physical devices in the coming days when trying out this fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant