mirror of
https://github.com/osukey/osukey.git
synced 2025-05-14 01:57:22 +09:00
Only use positional input from most recent touch
This commit is contained in:
parent
6b16d3ee61
commit
b3860c6d52
@ -51,24 +51,26 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
? OsuAction.RightButton
|
? OsuAction.RightButton
|
||||||
: OsuAction.LeftButton;
|
: OsuAction.LeftButton;
|
||||||
|
|
||||||
|
// Ignore any taps which trigger an action which is already handled. But track them for potential positional input in the future.
|
||||||
|
bool shouldResultInAction = !mouseDisabled.Value && trackedTouches.All(t => t.Action != action);
|
||||||
|
|
||||||
|
trackedTouches.Add(new TrackedTouch(e.Touch, shouldResultInAction ? action : null));
|
||||||
|
|
||||||
|
// Important to update position before triggering the pressed action.
|
||||||
handleTouchMovement(e);
|
handleTouchMovement(e);
|
||||||
|
|
||||||
if (!mouseDisabled.Value && trackedTouches.All(t => t.Action != action))
|
if (shouldResultInAction)
|
||||||
{
|
|
||||||
trackedTouches.Add(new TrackedTouch(e.Touch, action));
|
|
||||||
osuInputManager.KeyBindingContainer.TriggerPressed(action);
|
osuInputManager.KeyBindingContainer.TriggerPressed(action);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Ignore any taps which trigger an action which is already handled. But track them for potential positional input in the future.
|
|
||||||
trackedTouches.Add(new TrackedTouch(e.Touch, null));
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleTouchMovement(TouchEvent touchEvent)
|
private void handleTouchMovement(TouchEvent touchEvent)
|
||||||
{
|
{
|
||||||
|
// Movement should only be tracked for the most recent touch.
|
||||||
|
if (touchEvent.Touch != trackedTouches.Last().Touch)
|
||||||
|
return;
|
||||||
|
|
||||||
new MousePositionAbsoluteInput { Position = touchEvent.ScreenSpaceTouch.Position }.Apply(osuInputManager.CurrentState, osuInputManager);
|
new MousePositionAbsoluteInput { Position = touchEvent.ScreenSpaceTouch.Position }.Apply(osuInputManager.CurrentState, osuInputManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user