react-sigma
react-sigma copied to clipboard
onDoubleClick eventHandler to add more interactive actions
I'd like to add onDoubleClick eventhandler does this exist?
Hi there!
Yes, the double click event exists; here are two possible implementations: (from MDN).
addEventListener('dblclick', (event) => {});
ondblclick = (event) => { };
And here some docs: https://developer.mozilla.org/en-US/docs/Web/API/Element/dblclick_event https://caniuse.com/mdn-api_element_dblclick_event
Hope this helps!
Thanks for the reply. I guess I'm a newb here is there away to add double click handler when clicking on the nodes? I basically want to override the current behavior of zooming in if a node is dblclicked.
Tried to do something like:
×
←→1 of 2 errors on the page
TypeError: _sigma$current.addEventListener is not a function
(anonymous function)
64 | const onDblClick = (event: any) => {
65 | console.log('dblclick', event);
66 | };
> 67 | sigma.current?.addEventListener('dblclick', onDblClick);
| ^ 68 |
69 | return () => {
70 | sigma.current?.removeEventListener('dblclick', onDblClick);
also tried sigma.current.bind('dblclick', onDblClick) as well
where sigma.current is a ref on the Sigma component. and no joy...
Any thoughts?