Feature - Mouse devices on android#2597
Feature - Mouse devices on android#2597joliver82 wants to merge 4 commits intojMonkeyEngine:masterfrom
Conversation
Added setMouseGrab method to both MouseInput and InputManager. Android cannot change to grab/capture mode while dragging, all events after mouse down are ignored till mouse up is received
|
Looks solid, but i am not sure about the new setMouseGrab method, usually in jme we consider setCursorVisible(false) = mouse grab, isn't there a way to make this behavior work in the new android input handler? |
|
Thanks for reviewing. I know jme3 uses setVisibility as grab method but in Android it's not possible to do it this way unless we accept that drag to rotate functionality won't work when using a mouse. As I wrote in the first comment, if changed grab state after a mouse down event, the following events (move events) are not sent by the OS till mouse up (checked in all my devices and the behavior is the same). Notice that I updated all existing mouse handlers to include the set grab method as wrapper for setVisibility(!grab) and also updated all classes using mouse handler setVisibility to use it or setGrab (only three classes) I don't see much issue in adding this method, in fact I feel it's a more meaningful name. Also I don't know if there're lots of users using setVisibility directly or just through current existing jme3 classes (like FlyByCamera). |
|
My goal would be to make this behave exactly like in desktop without any api change. |
|
I've pushed the changes that fixed it for me, without the setMouseGrab, here on this branch. (feel free to revert the commit or to force push, if it is conflicting with your local branch) |
This pull request adds mouse device support to android. (Issue #2173 )
In addition to specific android code, I had to add a new method "setMouseGrab" to both InputManager and MouseInput (and classes implemeting it).
This changed was done because when Android changes to grab/capture mode while dragging all events after mouse down are ignored till mouse up is received. FlyByCamera and ChaseCamera changes visibility while dragging if set dragToRotate=true. So changing grab state in setVisibility method avoids being able to move the camera in this mode. Also I wanted to be able to properly capture the mouse if the game requires it like jme3 works on desktop when running setVisibility(false)