bkrem / react-d3-tree

:deciduous_tree: React component to create interactive D3 tree graphs
https://bkrem.github.io/react-d3-tree
MIT License
1.09k stars 270 forks source link

Fix: center on node feature works with collapsible disabled #457

Closed jawwad-btrt closed 1 year ago

jawwad-btrt commented 1 year ago

Fixes https://github.com/bkrem/react-d3-tree/issues/386.

If you disable collapsible, the "center on node" feature (via dimensions prop) ceases to work. My understanding is this due to the fact that a click on the node wouldn't trigger an update of the component. This PR adds the wasClicked state to the shouldNotTransform criteria. Tested this locally and it seems to work, as shown in attached clip.

https://user-images.githubusercontent.com/128327117/231506155-501ec223-9bcf-4d9f-97ff-025faca10c7c.mov

bkrem commented 1 year ago

Released as https://github.com/bkrem/react-d3-tree/releases/tag/v3.5.2