Skip to content

TypeError when interacting with OrbitControls with touch and mouse #411

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

Open
tonttu opened this issue Mar 12, 2025 · 0 comments
Open

TypeError when interacting with OrbitControls with touch and mouse #411

tonttu opened this issue Mar 12, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@tonttu
Copy link

tonttu commented Mar 12, 2025

  • three version: v174
  • Chrome, Windows

Problem description:

This is triggered:

OrbitControls.js:932 Uncaught TypeError: Cannot read properties of undefined (reading 'x')
    at OrbitControls._handleTouchStartDolly (OrbitControls.js:932:37)
    at OrbitControls._handleTouchStartDollyPan (OrbitControls.js:943:31)
    at OrbitControls.onTouchStart (OrbitControls.js:1428:11)
    at OrbitControls.onPointerDown (OrbitControls.js:1172:8)

Suggested solution:

OrbitControls seems to maintain pointers array using onPointerDown and other pointer events, but maintains pointerPositions using only touch events. Not all pointer events are touch events, so those two arrays are not in sync, and that is why getSecondPointerPosition returns undefined.

@tonttu tonttu added the bug Something isn't working label Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant