react-d3-graph
react-d3-graph copied to clipboard
Adding an onRightClickGraph event.
Is your feature request related to a problem? Please describe. Hello there ! I was looking for a way to catch a right click event on the graph (not on a node), but I've noticed the event wasn't catched. Following https://stackoverflow.com/a/31113000, the onContextMenu, or an equivalent, does not seem to be present on the
Describe the solution you'd like
Being able to do a
<Graph ... onRightClickGraph={onRightClickGraph} ... />
or
<Graph ... onContextMenu={onRightClickGraph} ... />
Describe your use case Being able to show a Menu on graph right click. The event should be different from onRightClickNode, which should still work correctly by only triggering onRightClickNode.
Describe alternatives you've considered Haven't found any alternative yet.
Hi @ArnaudRib ,
To the best of my knowledge, this feature does not exist for now. However, onRightClickGraph would seem like a great feature and consistent with each graph element having a left and right click callback (onClickNode - onRightClickNode and onClickLink - onRightClickLink) but not the graph itself.
Feel free to submit a PR if you want to implement the feature.
Agree with @antoninklopp; it seems like low-hanging fruit. We can pass along onRightClickXXX callbacks for the Graph's elements (nodes & links), including the Graph itself as described in a feature request.
Up, do you have news about this feature ?