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

Zoom to mouse cursor position #698

Open
Treebu-Extension opened this issue Dec 31, 2024 · 0 comments
Open

Zoom to mouse cursor position #698

Treebu-Extension opened this issue Dec 31, 2024 · 0 comments

Comments

@Treebu-Extension
Copy link

Describe the bug
I'm trying to zoom to cursor pointer position with ForceGraph3D. I found this solution : https://codepen.io/duhaime/pen/poJLdyd that modify the function this.zoomCamera and it work perfectly well, but when I rotate the camera (with right click)), the zoom is then broken.

I guess the issue is that it has to correctly transforming the cursor position into the world space based on the current camera rotation.
When you rotate the camera, the mouse position should be calculated in the context of the new camera view (taking into account the camera's position and orientation). The zoom should then be applied in a way that takes into account the current camera perspective, not the initial world position.

Anyone knows how to do it ?

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://codepen.io/duhaime/pen/poJLdyd
  2. Zoom in & out to cursor position -> it works
  3. Rotate camera
  4. Zoom in & out to cursor position -> it's broken

Expected behavior
I should be able to zoom in / zoom out to cursor poistion whatever the camera orientation is.

Desktop (please complete the following information):

  • Windows
  • Brave
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

No branches or pull requests

1 participant