mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 08:02:55 +08:00
Add non-hiding selection state
This commit is contained in:
parent
53fe0ce790
commit
8f16c1cb04
@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
AlwaysPresent = true;
|
||||
Alpha = 0;
|
||||
OnDeselected();
|
||||
}
|
||||
|
||||
private SelectionState state;
|
||||
@ -64,12 +64,12 @@ namespace osu.Game.Rulesets.Edit
|
||||
switch (state)
|
||||
{
|
||||
case SelectionState.Selected:
|
||||
Show();
|
||||
OnSelected();
|
||||
Selected?.Invoke(this);
|
||||
break;
|
||||
|
||||
case SelectionState.NotSelected:
|
||||
Hide();
|
||||
OnDeselected();
|
||||
Deselected?.Invoke(this);
|
||||
break;
|
||||
}
|
||||
@ -78,6 +78,10 @@ namespace osu.Game.Rulesets.Edit
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnDeselected() => Hide();
|
||||
|
||||
protected virtual void OnSelected() => Show();
|
||||
|
||||
// When not selected, input is only required for the blueprint itself to receive IsHovering
|
||||
protected override bool ShouldBeConsideredForInput(Drawable child) => State == SelectionState.Selected;
|
||||
|
||||
|
@ -70,6 +70,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
|
||||
private class TimelineHitObjectRepresentation : SelectionBlueprint
|
||||
{
|
||||
private Circle circle;
|
||||
|
||||
public const float THICKNESS = 3;
|
||||
|
||||
public TimelineHitObjectRepresentation(HitObject hitObject)
|
||||
@ -104,7 +106,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
});
|
||||
}
|
||||
|
||||
AddInternal(new Circle
|
||||
AddInternal(circle = new Circle
|
||||
{
|
||||
Size = new Vector2(16),
|
||||
Anchor = Anchor.CentreLeft,
|
||||
@ -116,6 +118,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
BorderThickness = THICKNESS,
|
||||
});
|
||||
}
|
||||
|
||||
protected override void OnSelected() => circle.BorderColour = Color4.Orange;
|
||||
|
||||
protected override void OnDeselected() => circle.BorderColour = Color4.Black;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user