d3-context-menu icon indicating copy to clipboard operation
d3-context-menu copied to clipboard

Accessing event information with D3 6.x

Open danielePala opened this issue 4 years ago • 2 comments

In D3 6.x the global d3.event has been removed, so in order to access event information from the context menu callbacks I think it would be useful to add the event as a second input parameter, in addition to the datum d. Is this something you are willing to add?

danielePala avatar Jan 07 '21 21:01 danielePala

I think this sounds reasonable, though it would need to be the 3rd parameter since the index is passed as the second parameter.

I would accept a PR for this.

patorjk avatar Jan 07 '21 21:01 patorjk

Submitted PR #59 where the second argument of the callbacks will be the event for D3 6.x and the index for D3 5.x or earlier. This because the index argument will be undefined for D3 6.x, while the event argument is not needed for D3 5.x or earlier.

danielePala avatar Jan 08 '21 15:01 danielePala