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

Incorrect pointer event translation through Fisheye after resizing canvas #2165

Open
disco0 opened this issue Oct 30, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@disco0
Copy link

disco0 commented Oct 30, 2024

  • three version: 0.169.0
  • @react-three/fiber version: 8.17.6
  • @react-three/drei version: 9.115.0
  • node version: 22.9.0
  • npm (or yarn) version: 10.8.3

Problem description:

Pointer events through a Fisheye camera become inaccurate after canvas size change. This can be observed in the ThreeJS Journey Lv 1 Fisheye demo on the rotating box—resizing the window causes a offset to its pointer events.

Relevant code:

Split view demo of the current behavior, and the suggested solution:

https://codesandbox.io/p/sandbox/drei-fisheye-raycast-resize-demo-g6cq3n?file=%2Fsrc%2FFisheyePatched.tsx%3A75%2C5-75%2C20

Suggested solution:

Adding width and height to the dependency array of compute's useCallback inside Fisheye fixes the issue (see linked FisheyePatch component in above demo)

@disco0 disco0 added the bug Something isn't working label Oct 30, 2024
@abernier
Copy link
Member

can you make a PR?

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

2 participants