vkbansal / react-contextmenu

Project is no longer maintained
MIT License
1.4k stars 375 forks source link

Option to detect context menu coordinates #311

Closed ads692 closed 4 years ago

ads692 commented 4 years ago

Hi, I wanted to check if there's a way to detect the context menu's cooridinate values for left and top based on the container it is placed in? Right now it seems to be calculating it only from the top layer window's values.

vkbansal commented 4 years ago

You can do this:

const menu = document.querySelector('.react-contextmenu')
menu.getBoundingClientRect()

You can also pass a custom class and use that instead