Hi,
I’m implementing a drag’n’drop system and want to detect if the drop happens over a gui element or over the 3d world.
Let me explain some more:
I have a bunch of gui elements (basically frames with sub frames, buttons, labels, etc.) on the screen.
All these elements have been set up so to react to mouse events (state set to DGG.NORMAL, suppressMouse set to 0)
This way I easily can detect if I’m over a gui element or not:
base.mouseWatcherNode.isOverRegion() returns 1 if the mouse is over a gui element. (or I can use base.mouseWatcherNode.getOverRegion())
So far it all worked fine and felt like a very elegant solution.
However, as soon as I start a real drag operation it stops working:
My drag source region again is a DirectFrame which was enabled for mouse events. I bind the B1PRESS and B1RELEASE events to detect the sart/stop of the dragging.
But after I’ve pressed the mouse over the DirectFrame, the mouseWatcher remembers the frame region as being special, and from now on isOverRegion() only returns 1 if the mouse is over the region that was clicked in the first place.
So in effect I cannot detect anymore if I’m over any other gui region than the one I clicked in the first place.
Is there a way for me to tell the mouseWatcher to again consider all regions and to forget about the click origin region?
As a workaround I could monitor the WITHIN/WITHOUT events on all gui elements and so keep track of wether I’m over gui or not, but I’m not happy with that solution. It really feels as if the mouseWatcher already is so close to giving me the answer directly…
Btw., I also tried using isMouseOpen() but that didn’t work for me at all. Regardles of where I point the mouse, it always returns 0 for me.
Thanks,
Erik