Add new property to avoid overlapping usages

This commit is contained in:
Dean Herbert 2023-07-25 18:13:35 +09:00
parent 2f7d38d98b
commit eac6271bd0
3 changed files with 9 additions and 7 deletions

View File

@ -25,12 +25,9 @@ public abstract partial class OsuSelectionBlueprint<T> : 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)

View File

@ -32,7 +32,7 @@ public abstract partial class SelectionBlueprint<T> : CompositeDrawable, IStatef
/// </summary>
public event Action<SelectionBlueprint<T>> 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()
/// </summary>
public virtual MenuItem[] ContextMenuItems => Array.Empty<MenuItem>();
/// <summary>
/// Whether the <see cref="SelectionBlueprint{T}"/> can be currently selected via a click or a drag box.
/// </summary>
public virtual bool IsSelectable => ShouldBeAlive && IsPresent;
/// <summary>
/// The screen-space main point that causes this <see cref="HitObjectSelectionBlueprint"/> to be selected via a drag.
/// </summary>

View File

@ -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;
}