Skip to content

Commit

Permalink
Merge pull request #28167 from smoogipoo/fix-touch-on-judged-circles
Browse files Browse the repository at this point in the history
Fix touches on judged circles changing cursor position
  • Loading branch information
peppy authored May 13, 2024
2 parents 87f2a23 + 20e2896 commit 1fd5d73
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions osu.Game.Rulesets.Osu.Tests/TestSceneOsuTouchInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using osu.Game.Configuration;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.Osu.UI.Cursor;
using osu.Game.Screens.Play.HUD;
using osu.Game.Tests.Visual;
Expand Down Expand Up @@ -578,6 +579,24 @@ public void TestWithDisallowedUserCursor()
assertKeyCounter(1, 1);
}

[Test]
public void TestTouchJudgedCircle()
{
addHitCircleAt(TouchSource.Touch1);
addHitCircleAt(TouchSource.Touch2);

beginTouch(TouchSource.Touch1);
endTouch(TouchSource.Touch1);

// Hold the second touch (this becomes the primary touch).
beginTouch(TouchSource.Touch2);

// Touch again on the first circle.
// Because it's been judged, the cursor should not move here.
beginTouch(TouchSource.Touch1);
checkPosition(TouchSource.Touch2);
}

private void addHitCircleAt(TouchSource source)
{
AddStep($"Add circle at {source}", () =>
Expand All @@ -590,6 +609,7 @@ private void addHitCircleAt(TouchSource source)
{
Clock = new FramedClock(new ManualClock()),
Position = mainContent.ToLocalSpace(getSanePositionForSource(source)),
CheckHittable = (_, _, _) => ClickAction.Hit
});
});
}
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Osu/OsuInputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public bool CheckScreenSpaceActionPressJudgeable(Vector2 screenSpacePosition) =>
//
// Based on user feedback of more nuanced scenarios (where touch doesn't behave as expected),
// this can be expanded to a more complex implementation, but I'd still want to keep it as simple as we can.
NonPositionalInputQueue.OfType<DrawableHitCircle.HitReceptor>().Any(c => c.ReceivePositionalInputAt(screenSpacePosition));
NonPositionalInputQueue.OfType<DrawableHitCircle.HitReceptor>().Any(c => c.CanBeHit() && c.ReceivePositionalInputAt(screenSpacePosition));

public OsuInputManager(RulesetInfo ruleset)
: base(ruleset, 0, SimultaneousBindingMode.Unique)
Expand Down

0 comments on commit 1fd5d73

Please sign in to comment.