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

Center Node feature only works when toggling the node. Not working with onNodeClick #386

Closed
marcos-medeiros opened this issue Mar 25, 2022 · 1 comment · Fixed by #457
Closed

Comments

@marcos-medeiros
Copy link

marcos-medeiros commented Mar 25, 2022

Thank you for taking the time to report an issue with react-d3-tree!

Feel free to delete any questions that do not apply.

Are you reporting a bug, or opening a feature request?

BUG

What is the actual behavior/output?

After enabling the dimensions prop, the center node feature works only when toggling the node. If you disable the collapsible feature, for instance, it doesn't work at all.

What is the behavior/output you expect?

When enabling the dimensions prop, I expect that the onNodeClick event handler triggers the centering of the given node.

Can you consistently reproduce the issue/create a reproduction case (e.g. on https://codesandbox.io)?

Yes. In fact, when using the example (https://bkrem.github.io/react-d3-tree/), if you enable centerNode and disable collapsible, you'll notice that the node that is clicked does not get centered.

What version of react-d3-tree are you using?

3.3.2

If react-d3-tree crashed with a traceback, please paste the full traceback below.

No crash.

@marcos-medeiros marcos-medeiros changed the title Center Node feature only works when toggling the node when using renderCustomNode. Not working with onNodeClick Center Node feature only works when toggling the node. Not working with onNodeClick Mar 25, 2022
@arielrezinn
Copy link

I can confirm that this is still a problem. I discovered it when trying to center a custom element passed in using the "renderCustomNodeElement" prop. I just spent a couple hours digging through the code, but I believe fixing this bug is a bit beyond my skill level.

Any suggestions for a workaround @bkrem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants