Replies: 2 comments
-
also, the context menu could be cut off as shown in the screenshot: |
Beta Was this translation helpful? Give feedback.
-
I also try to use useState to set/get the clicked element: ` const [targetType, setTargetType] = useState(""); const handleContextMenu = (event: any) => { I can see the event includes both event.targetType and event.target.id in the console. However, I can set the targetType value, but CANNOT set the target value. I also tried to set event.target itself, but I could not do it either. It looks like the event.target is not accessible from the setState. Any idea will be appreciated! |
Beta Was this translation helpful? Give feedback.
-
Hi there,
I'm testing the V5 beta contextmenu plugin and I have a question about the event handler.
In the previous version, handleMenuClick received two parameters: target and item. This provided clear information about the clicked menu item and the corresponding node, edge, or canvas element.
However, in the new V5 plugin API, the onClick function only receives two parameters: v (string) and target (HTMLElement). The target seems to be the clicked menu item itself, not the node, edge, or canvas that was right-clicked. Is this the intended behavior? I would expect the target to be the element that was right-clicked (node, edge, or canvas).
Additional Question:
Is there a way to enable right-click selection of nodes and edges in addition to left-click selection?
Thanks for your clarification!
-ZJ
Beta Was this translation helpful? Give feedback.
All reactions