Fix previous touch action not being released when it's not a direct touch

This commit is contained in:
Dean Herbert 2023-03-15 16:38:26 +09:00
parent 6c4f596a9a
commit 42359a9754
2 changed files with 4 additions and 4 deletions

View File

@ -172,7 +172,7 @@ namespace osu.Game.Rulesets.Osu.Tests
beginTouch(TouchSource.Touch2);
assertKeyCounter(1, 1);
checkPressed(OsuAction.LeftButton);
checkNotPressed(OsuAction.LeftButton);
checkPressed(OsuAction.RightButton);
// in this case, touch 2 should not become the positional tracking touch.
checkPosition(TouchSource.Touch1);

View File

@ -105,12 +105,12 @@ namespace osu.Game.Rulesets.Osu.UI
}
// In the case the new touch was not used for position tracking, we should also check the previous position tracking touch.
// If it was a direct touch and still has its action pressed, that action should be released.
// If it still has its action pressed, that action should be released.
//
// This is done to allow tracking with the initial touch while still having both Left/Right actions available for alternating with two more touches.
if (positionTrackingTouch.DirectTouch && positionTrackingTouch.Action is OsuAction directTouchAction)
if (positionTrackingTouch.Action is OsuAction touchAction)
{
osuInputManager.KeyBindingContainer.TriggerReleased(directTouchAction);
osuInputManager.KeyBindingContainer.TriggerReleased(touchAction);
positionTrackingTouch.Action = null;
}
}