From eac6271bd011359afbe5658e664427d09479c44c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Jul 2023 18:13:35 +0900 Subject: [PATCH] Add new property to avoid overlapping usages --- .../Edit/Blueprints/OsuSelectionBlueprint.cs | 7 ++----- osu.Game/Rulesets/Edit/SelectionBlueprint.cs | 7 ++++++- .../Screens/Edit/Compose/Components/BlueprintContainer.cs | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs index 178b809d8b..8e8972a665 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/OsuSelectionBlueprint.cs @@ -25,12 +25,9 @@ public abstract partial class OsuSelectionBlueprint : HitObjectSelectionBluep || (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. + public override bool IsSelectable => + // Bypass fade out extension from hit markers for selection 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) diff --git a/osu.Game/Rulesets/Edit/SelectionBlueprint.cs b/osu.Game/Rulesets/Edit/SelectionBlueprint.cs index 3c878ffd33..158c3c102c 100644 --- a/osu.Game/Rulesets/Edit/SelectionBlueprint.cs +++ b/osu.Game/Rulesets/Edit/SelectionBlueprint.cs @@ -32,7 +32,7 @@ public abstract partial class SelectionBlueprint : CompositeDrawable, IStatef /// public event Action> Deselected; - public override bool HandlePositionalInput => ShouldBeAlive; + public override bool HandlePositionalInput => IsSelectable; public override bool RemoveWhenNotAlive => false; protected SelectionBlueprint(T item) @@ -125,6 +125,11 @@ protected virtual void OnSelected() /// public virtual MenuItem[] ContextMenuItems => Array.Empty(); + /// + /// Whether the can be currently selected via a click or a drag box. + /// + public virtual bool IsSelectable => ShouldBeAlive && IsPresent; + /// /// The screen-space main point that causes this to be selected via a drag. /// diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs index 2ee162bf3b..1de6c8364c 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs @@ -487,7 +487,7 @@ protected virtual void UpdateSelectionFromDragBox() break; case SelectionState.NotSelected: - if (blueprint.IsAlive && blueprint.IsPresent && quad.Contains(blueprint.ScreenSpaceSelectionPoint)) + if (blueprint.IsSelectable && quad.Contains(blueprint.ScreenSpaceSelectionPoint)) blueprint.Select(); break; }