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

TrackballControls: Fix multi-touch in onTouchEnd(). #24631

Merged
merged 3 commits into from
Sep 13, 2022

Conversation

Fly-in-Free
Copy link
Contributor

Related issue: (Didn't raise an issue yet)

Description

When using trackball control on my mobile app, I discovered that camera position will suddenly change a lot after zoom/pan multi-touch gesture, this can be reproduced by running trackball sample on iOS or Android touch screen devices and perform a zoom/pan gesture with two fingers.

As diff shows, when lifting first finger, the _moveCurr and _movePrev position was assigned to the lifted finger, if move event is detected on the other finger, the camera position will change as user swipe from lifted position to other finger's position. I addressed it by assigning two position variables with other finger's position instead.

I'm not a professional JS developer, so please feel free to edit / give me any suggestions : )

problem is observed on mobile phone, when lifting one finger after multitouch gesture, the camera will change dramatically as if swiped from that position to where first finger is
@Mugen87 Mugen87 changed the title Fix abnormal camera change after zoom gesture on touchscreen TrackballControls: Fix multi-touch in onTouchEnd(). Sep 13, 2022
@Mugen87 Mugen87 added this to the r145 milestone Sep 13, 2022
@Mugen87 Mugen87 merged commit 9e12fd1 into mrdoob:dev Sep 13, 2022
@Fly-in-Free Fly-in-Free deleted the fix_trackball_control_gesture branch September 13, 2022 09:23
@mrdoob
Copy link
Owner

mrdoob commented Sep 13, 2022

Thanks!

abernier pushed a commit to abernier/three.js that referenced this pull request Sep 16, 2022
* Fix camera runaway after zoom gesture

problem is observed on mobile phone, when lifting one finger after multitouch gesture, the camera will change dramatically as if swiped from that position to where first finger is

* Update TrackballControls.js

Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants