Hi,
I have the following situation. I have a game with multiple elements that can be clicked. They also trigger a mouse pointer. The game also includes a button, which will trigger a menu. This menu will be visible “on top” of the current scene, and this menu will make most of the game scene with the clickable elements invisible (the menu does not take the full width and height)
However, when I display this menu, the elements that are below this menu are still clickable. So the mouse still changes to a pointer when I move the mouse around the menu and “accidentally” hover over one of the clickable elements (which are no longer visible at this point). I can also click these elements, even when the menu is on top of these elements.
Is there a quick way to “remove” the click-event and the mouse-pointer event from these elements when the menu is displayed? I now create an array with all the elements which have a click-event. When I display the menu, I loop over the array and call disableInteractive()
on the elements. After the menu is closed, I loop over the array again and call enableInteractive({cursor: 'pointer'})
on all the elements.
Is there a better way to do this, or is this the preferred way?
Thanks!