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

Centering on a node when more nodes are added as children to that node. #485

Open
bsaranga opened this issue Jan 17, 2024 · 1 comment
Open

Comments

@bsaranga
Copy link

Not a bug. But, say many adding child nodes are added to particular node dynamically, the force simulation makes the node fly away out of the visible area. I have tried to center on the node after the children have been added using the zoom options available, but the result isn't that good.

How do I lock in on the node when child nodes are being added to it?

@vasturiano
Copy link
Owner

@bsaranga thanks for reaching out.

You could try to look at this example (click to focus on node): https://vasturiano.github.io/react-force-graph/example/click-to-focus/

It includes some logic for pointing the camera at a node's position. This is assuming we're talking about the 3D mode. For the 2D mode it would be a different method.

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

2 participants