`centerGraph()` also seems to adjust zoom
knowncolor opened this issue · comments
Describe the bug
On my project locally it zooms in slightly, on the demos page is zooms out quite far.
https://reagraph.dev/?path=%2Fstory%2Fdemos-controls--all
Tried multiple browsers, different browser sizes - same.
Steps to Reproduce the Bug or Issue
- Goto https://reagraph.dev/?path=%2Fstory%2Fdemos-controls--all
- Click Center Node 2 button
Expected behavior
Center and not adjust zoom
Screenshots or Videos
Any chance for a fix soon? Is there a workaround?
Is there an alternative solution at the moment to fix this?
Hmmm I'm not able to recreate this issue. @Edouard-Tby can you provide a repo that recreates it?
Screen.Recording.2024-05-15.at.11.28.54.AM.mov
Enregistrement.2024-05-15.215609.mp4
@ghsteff, thanks for your answer, to recreate it you have to zoom in or zoom out. As you can see in the screen recording the centerGraph function will reset the zoom.
Please let me know if that is not clear.
@ghsteff, thanks for your answer, to recreate it you have to zoom in or zoom out. As you can see in the screen recording the centerGraph function will reset the zoom.
Please let me know if that is not clear.
Ah I see what you're saying. To me personally, it feels expected that if you're zoomed way in or out that centering the graph adjusts the camera position and fits the zoom nicely onto the node you're centering on. I get how that's preference tho
Maybe we can separate the functionality into centerGraph()
and fitZoom()
or somethin
@ghsteff, thanks for your answer, to recreate it you have to zoom in or zoom out. As you can see in the screen recording the centerGraph function will reset the zoom.
Please let me know if that is not clear.Ah I see what you're saying. To me personally, it feels expected that if you're zoomed way in or out that centering the graph adjusts the camera position and fits the zoom nicely onto the node you're centering on. I get how that's preference tho
Maybe we can separate the functionality into
centerGraph()
andfitZoom()
or somethin
I understand you point but in the case of large graphs, the current approach can sometimes be disorienting for the end user. We could for instance separate the functionalities as you suggest or introduce a boolean parameter, fitZoom, into the centerGraph function to enhance user experience.
This should be fixed in 4.18.0