1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 04:13:00 +08:00

Only track TouchSource for now

This commit is contained in:
Dean Herbert 2023-01-17 14:51:45 +09:00
parent b3860c6d52
commit c6d33df147

View File

@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Osu.UI
// Ignore any taps which trigger an action which is already handled. But track them for potential positional input in the future. // 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); bool shouldResultInAction = !mouseDisabled.Value && trackedTouches.All(t => t.Action != action);
trackedTouches.Add(new TrackedTouch(e.Touch, shouldResultInAction ? action : null)); trackedTouches.Add(new TrackedTouch(e.Touch.Source, shouldResultInAction ? action : null));
// Important to update position before triggering the pressed action. // Important to update position before triggering the pressed action.
handleTouchMovement(e); handleTouchMovement(e);
@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Osu.UI
private void handleTouchMovement(TouchEvent touchEvent) private void handleTouchMovement(TouchEvent touchEvent)
{ {
// Movement should only be tracked for the most recent touch. // Movement should only be tracked for the most recent touch.
if (touchEvent.Touch != trackedTouches.Last().Touch) if (touchEvent.Touch.Source != trackedTouches.Last().Source)
return; return;
new MousePositionAbsoluteInput { Position = touchEvent.ScreenSpaceTouch.Position }.Apply(osuInputManager.CurrentState, osuInputManager); new MousePositionAbsoluteInput { Position = touchEvent.ScreenSpaceTouch.Position }.Apply(osuInputManager.CurrentState, osuInputManager);
@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Osu.UI
protected override void OnTouchUp(TouchUpEvent e) protected override void OnTouchUp(TouchUpEvent e)
{ {
var tracked = trackedTouches.First(t => t.Touch.Source == e.Touch.Source); var tracked = trackedTouches.First(t => t.Source == e.Touch.Source);
if (tracked.Action is OsuAction action) if (tracked.Action is OsuAction action)
osuInputManager.KeyBindingContainer.TriggerReleased(action); osuInputManager.KeyBindingContainer.TriggerReleased(action);
@ -88,13 +88,13 @@ namespace osu.Game.Rulesets.Osu.UI
private class TrackedTouch private class TrackedTouch
{ {
public readonly Touch Touch; public readonly TouchSource Source;
public readonly OsuAction? Action; public readonly OsuAction? Action;
public TrackedTouch(Touch touch, OsuAction? action) public TrackedTouch(TouchSource source, OsuAction? action)
{ {
Touch = touch; Source = source;
Action = action; Action = action;
} }
} }