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

centerGraph() also seems to adjust zoom #130

Closed
knowncolor opened this issue Sep 13, 2023 · 7 comments · Fixed by #244
Closed

centerGraph() also seems to adjust zoom #130

knowncolor opened this issue Sep 13, 2023 · 7 comments · Fixed by #244
Assignees
Labels
bug Something isn't working

Comments

@knowncolor
Copy link

knowncolor commented Sep 13, 2023

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

  1. Goto https://reagraph.dev/?path=%2Fstory%2Fdemos-controls--all
  2. Click Center Node 2 button

Expected behavior

Center and not adjust zoom

Screenshots or Videos

Peek 2023-09-13 22-26

@amcdnl amcdnl added the bug Something isn't working label Sep 18, 2023
@mgroma
Copy link

mgroma commented Oct 17, 2023

Any chance for a fix soon? Is there a workaround?

@Edouard-Tby
Copy link

Is there an alternative solution at the moment to fix this?

@ghsteff
Copy link
Contributor

ghsteff commented May 15, 2024

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

@Edouard-Tby
Copy link

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
Copy link
Contributor

ghsteff commented May 15, 2024

@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

@Edouard-Tby
Copy link

@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

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.

@ghsteff ghsteff self-assigned this May 23, 2024
@ghsteff ghsteff mentioned this issue May 23, 2024
2 tasks
@ghsteff ghsteff linked a pull request May 23, 2024 that will close this issue
2 tasks
@ghsteff
Copy link
Contributor

ghsteff commented May 23, 2024

This should be fixed in 4.18.0

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

Successfully merging a pull request may close this issue.

5 participants