Mouse Clicks consumed when cursor is disabled

When the cursor is disabled via inputManager app.getInputManager().setCursorVisible(false) all mouse click events are still consumed if the now invisible mouse cursor clicks a lemur object.

I can get around this in a few ways, but I don’t think this is intended behavior.

There was a similar issue in nifty, which I presume was just fixed by checking if the mouse is visible or not before continuing:

On further thinking, since lemur can happily function in a 3D environment, you wouldn’t want it to stop consuming click events. Say for example it clicked a button placed in the 3D world.

So I guess this is more of a question now - how should one handle this? Remove the GUI node from mouseAppState collision system?

To turn off all mouse-related event processing (and turn the cursor back on) by lemur then you should call:
http://jmonkeyengine-contributions.github.io/Lemur/javadoc/Lemur/com/simsilica/lemur/GuiGlobals.html#setCursorEventsEnabled(boolean)

…instead of messing with the input manager.

If you just want to turn off processing for the GUI node then you should grab the BasePickState and then remove the GUI node from the collision roots:
http://jmonkeyengine-contributions.github.io/Lemur/javadoc/Lemur/com/simsilica/lemur/event/BasePickState.html

Either:
http://jmonkeyengine-contributions.github.io/Lemur/javadoc/Lemur/com/simsilica/lemur/event/BasePickState.html#removeCollisionRoot(com.jme3.renderer.ViewPort)

Or:
http://jmonkeyengine-contributions.github.io/Lemur/javadoc/Lemur/com/simsilica/lemur/event/BasePickState.html#removeCollisionRoot(com.jme3.scene.Spatial)

Edit: and if you want to add the GUI node back… remember to use the version of addCollisionRoot() that takes a layer parameter to make sure you are called before the scene:
http://jmonkeyengine-contributions.github.io/Lemur/javadoc/Lemur/com/simsilica/lemur/event/PickState.html#PICK_LAYER_GUI

Edit 2: re: “(and turn the cursor back on)” that should be “(and turn the cursor back off)”

2 Likes

:ok_hand:

:point_left:

o.O

:moneybag::moneybag::moneybag: please, its not a free show sir.

And FYI :underage:

1 Like

LOL!!! Hey for that much money I’d better see more than that! :stuck_out_tongue:

The show is based largely on quantity, not quality. There is a lot of repetition. Most definitely worth though