pmndrs / react-three-fiber

🇨🇭 A React renderer for Three.js
https://docs.pmnd.rs/react-three-fiber
MIT License
27.62k stars 1.6k forks source link

fix(native): missing pointerId in pointer events #3347

Closed moose96 closed 2 months ago

moose96 commented 2 months ago

Fixes issue related to @react-three/drei repository: #2067.

Analysis and explanation

The problem exists in handleTouchMoveDolly method of OrbitControls class in three-stdlib. dollyDelta.y value is NaN, because dollyStart.y and dollyEnd.y in dollyEnd.y / dollyStart.y are 0. It happens because of getSecondPointerPosition function which uses event.pointerId to identify pointers in arrays. Because event.pointerId is missing the method always returns the same pointer position, giving zero in the next calculations.

Please also look at removePointer and trackPointer methods above - they use event.pointerId as well.

codesandbox-ci[bot] commented 2 months ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit b26042d816a77dbb86c32f5f9dff624e281e9170:

Sandbox Source
example Configuration
CodyJasonBennett commented 2 months ago

Incredible find and breakdown. This might also help #3315.