[ContextMenu] How to get the open position? #941
-
I am trying to obtain the position where a ContextMenu is open. This is what I have so far
by defining an The problem is that if I make a new right-click in a different position (while the context menu is open) the |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Hi @axelhzf, can I ask why you need to get access to the position? |
Beta Was this translation helpful? Give feedback.
-
Thanks @benoitgrelard! using My use case: I have an svg that looks like this I am trying to add interactivity on top of this svg using a single div on top of this svg. The menu should show different options depending on the element you clicked. |
Beta Was this translation helpful? Give feedback.
-
If I may, I'd ilke an answer to the original question. My use case that I have an image that shows various markers with x,y coordinates. I'm implemention a context menu over the area to add new items. I wand to prepopulate the x,y coordinates with the position the user right-clicked on the area. Having access to those values would make things much easier than having to calculate it manually. Thanks! :) Maybe haging the root context menu element to bubble up the mouse event? |
Beta Was this translation helpful? Give feedback.
Hi @axelhzf, can I ask why you need to get access to the position?
Also you could try
onContextMenu
instead, that's what we use internally.