bkrem / react-d3-tree

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

Add handlers to custom node element #372

Closed lucasdellabella closed 2 years ago

lucasdellabella commented 2 years ago

renderCustomNodeElement should have access to all the relevant handlers, as far as i can tell. as such, here's my changes

For context, I'm trying to write my own node renderer and I also want to add onNodeMouseOver and Out handlers.

bkrem commented 2 years ago

Thanks for pointing this out!

This is one of those where I'm sure I had a good reason for omitting the default event handlers from being passed at the time, but in retrospect I don't see why πŸ˜…

Once tests pass I'm happy to merge this, update types etc, and then publish as a fix πŸ‘

lucasdellabella commented 2 years ago

hey @bkrem got around to making the change, thanks for paying attention to my PR. I need to access the refs outside the tree so I can write a utility that allows the user to move the canvas around to different nodes around the tree. Whats the best way of doing this? Passing in a refGenerator() prop to the tree thats invoked and generates a ref to attach to a specific node?

Interested in hearing your thoughts.

bkrem commented 2 years ago

Thanks for making the adjustments here πŸ‘Œ I will try to get this merged later today or tomorrow and look into your PoC regarding refs. Haven’t had capacity for open source work the past few days.

bkrem commented 2 years ago

Published as v3.2.1 πŸš€

Thanks again :)