mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-19 11:03:01 +00:00
Improve precision of joystick inputs by lifting the deadzone after 150 ms. This way it prevents false inputs when activation the stick buttons but allows for precise movements after confirming that the touch is intended.
This commit is contained in:
parent
2fc53644bc
commit
6d45ad7fe8
@ -35,6 +35,11 @@ public class AnalogStick extends VirtualControllerElement {
|
||||
*/
|
||||
public final static long timeoutDoubleClick = 250;
|
||||
|
||||
/**
|
||||
* touch down time until the deadzone is lifted to allow precise movements with the analog sticks
|
||||
*/
|
||||
public final static long timeoutDeadzone = 150;
|
||||
|
||||
/**
|
||||
* Listener interface to update registered observers.
|
||||
*/
|
||||
@ -262,7 +267,11 @@ public class AnalogStick extends VirtualControllerElement {
|
||||
|
||||
// Stay active even if we're back in the deadzone because we know the user is actively
|
||||
// giving analog stick input and we don't want to snap back into the deadzone.
|
||||
stick_state = (stick_state == STICK_STATE.MOVED_ACTIVE || movement_radius > radius_dead_zone) ?
|
||||
// We also release the deadzone if the user keeps the stick pressed for a bit to allow
|
||||
// them to make precise movements.
|
||||
stick_state = (stick_state == STICK_STATE.MOVED_ACTIVE ||
|
||||
System.currentTimeMillis() - timeLastClick > timeoutDeadzone ||
|
||||
movement_radius > radius_dead_zone) ?
|
||||
STICK_STATE.MOVED_ACTIVE : STICK_STATE.MOVED_IN_DEAD_ZONE;
|
||||
|
||||
// trigger move event if state active
|
||||
|
Loading…
x
Reference in New Issue
Block a user