bkrem / react-d3-tree

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

MouseOver still triggered upon node collpase/expand despite x/y position staying the same #317

Open franklx2 opened 4 years ago

franklx2 commented 4 years ago

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?

I have behavior that is dependent on mouseOver and mouseOut, however, I notice that upon collapsing a node and its children, then the subsequent expand on the same node WITHOUT MOVING MY MOUSE AT ALL, the "rebuild/re-render" of the node/subtree causes mouseOut code to be executed, thereby causing unexpected behavior

What is the behavior/output you expect?

I am expecting the mouseOut code to not be triggered

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

Yes, I can consistently reproduce the issue

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

v1.16.1

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

Did not crash

franklx2 commented 4 years ago

Upon further investigation this seems to be happening because when the node is being expanded from a collapsed state, the children that are "spawning" are triggering their own "mouseOver" events. Once they move out of range of the mouse, the original node that was clicked on triggers its "mouseOver" event. I've figured out a workaround in my project so I am good for the time being. Do you have any thoughts as to how we can turn off "mouseOver" during animation?