Skip to content

TypeError when interacting with OrbitControls with touch and mouse #411

@tonttu

Description

@tonttu
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions