ANDROID: Improving touchscreen/mouse support
|Reported by:||SF/mcnicholls||Owned by:||anguslees|
I'm creating this bug mainly as a way of discussing what might be the correct implementation as I would like to try and implement it and help Gus out with this port.
I have been in touch with Gus and it would seem that mouse input needs a few fixes.
Firstly the right click needs a way to be invoked from the touchscreen as not all phones have a camera/search button and it would be nicer to do it via the touch screen. Gus suggested a long press on the screen should invoke a right click. This seems sensible as long press on Android typically brings up context menus and so can be thought of as a right click.
Also click and drag support. At the moment all dragging on the touchscreen represents a click and drag (I think). I guess this isn't always desirable and Gus suggested maybe a double tap will initiate a click drag.
I have seen in the forum that people have complained they manage to click the wrong thing as there fingers are a lot bigger than the item they are clicking on. It was suggested that perhaps we only respond to releasing the touchscreen, thereby allowing the user to fine tune where they want to click before letting go and initiating the click.
Based on all of this, as a starting point, I would like to propose the following:
- An initial touch on the screen does nothing (except be stored to look for long presses/double taps).
- If released before a long press timeout, we simply pass a left button down to the vm and a left button up.
- If pressed again within the double tap timeout, we send the vm a left button down and continue to pass the move events until released where we pass a left button up to the vm.
- If held down past the long press timeout (without enough movement to signify this isn't a long press) we send a right button down.
- Once the finger is released we send relevant left button up or right button up messages depending on the state.
The main thing is I am unfamiliar with the vm and how the engines use it.
Will the above work for all the use cases?
Is click and drag useful in some of the games?
Is it useful to be able to avoid click and drag by default as the above scheme outlines?
Any feedback would be great, I can then get to work to try to implement it.
Ticket imported from: #3040062. Ticket imported from: feature-requests/588.