Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix editor blueprints being selectable for too long when hit markers are enabled #24288

Merged
merged 6 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,35 @@ public partial class TestSceneOsuComposerSelection : TestSceneOsuEditor
{
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestBeatmap(ruleset, false);

[Test]
public void TestSelectAfterFadedOut()
{
var slider = new Slider
{
StartTime = 0,
Position = new Vector2(100, 100),
Path = new SliderPath
{
ControlPoints =
{
new PathControlPoint(),
new PathControlPoint(new Vector2(100))
}
}
};
AddStep("add slider", () => EditorBeatmap.Add(slider));

moveMouseToObject(() => slider);

AddStep("seek after end", () => EditorClock.Seek(750));
AddStep("left click", () => InputManager.Click(MouseButton.Left));
AddAssert("slider not selected", () => EditorBeatmap.SelectedHitObjects.Count == 0);

AddStep("seek to visible", () => EditorClock.Seek(650));
AddStep("left click", () => InputManager.Click(MouseButton.Left));
AddUntilStep("slider selected", () => EditorBeatmap.SelectedHitObjects.Single() == slider);
}

[Test]
public void TestContextMenuShownCorrectlyForSelectedSlider()
{
Expand Down
11 changes: 10 additions & 1 deletion osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@ public abstract partial class OsuSelectionBlueprint<T> : HitObjectSelectionBluep
protected override bool AlwaysShowWhenSelected => true;

protected override bool ShouldBeAlive => base.ShouldBeAlive
|| (DrawableObject is not DrawableSpinner && ShowHitMarkers.Value && editorClock.CurrentTime >= Item.StartTime && editorClock.CurrentTime - Item.GetEndTime() < HitCircleOverlapMarker.FADE_OUT_EXTENSION);
|| (DrawableObject is not DrawableSpinner && ShowHitMarkers.Value && editorClock.CurrentTime >= Item.StartTime
&& editorClock.CurrentTime - Item.GetEndTime() < HitCircleOverlapMarker.FADE_OUT_EXTENSION);

public override bool HandlePositionalInput =>
// Bypass fade out extension from hit markers for input handling purposes.
// This is to match stable, where even when the afterimage hit markers are still visible, objects are not selectable.
//
// Note that we are intentionally overriding HandlePositionalInput here and not ReceivePositionalInputAt
// as individual blueprint implementations override that.
base.ShouldBeAlive;

protected OsuSelectionBlueprint(T hitObject)
: base(hitObject)
Expand Down