clicking 2 overlapping buttons at once
Hello! I am wondering if anyone can suggest a simpler solution to this, perhaps I'm overlooking something.
I have several elements used as buttons, some of them overlap. If I click on the overlapping elements, they both need to trigger their respective functions. By default, only the top element will register a click, and the one underneath will not.
My solution was as follows:
Rather than assign click event listeners, I store nominal bounds of all buttons and on click check if my mouse position falls inside any of them. If yes, I trigger the function for anything that's hit.
This works, but it seems very overengineered. Is there a simpler way to do this?
Thank you!
