Add non-hiding selection state

This commit is contained in:
Dean Herbert 2020-01-21 14:21:00 +09:00
parent 53fe0ce790
commit 8f16c1cb04
2 changed files with 14 additions and 4 deletions

View File

@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Edit
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
AlwaysPresent = true; AlwaysPresent = true;
Alpha = 0; OnDeselected();
} }
private SelectionState state; private SelectionState state;
@ -64,12 +64,12 @@ namespace osu.Game.Rulesets.Edit
switch (state) switch (state)
{ {
case SelectionState.Selected: case SelectionState.Selected:
Show(); OnSelected();
Selected?.Invoke(this); Selected?.Invoke(this);
break; break;
case SelectionState.NotSelected: case SelectionState.NotSelected:
Hide(); OnDeselected();
Deselected?.Invoke(this); Deselected?.Invoke(this);
break; 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 // When not selected, input is only required for the blueprint itself to receive IsHovering
protected override bool ShouldBeConsideredForInput(Drawable child) => State == SelectionState.Selected; protected override bool ShouldBeConsideredForInput(Drawable child) => State == SelectionState.Selected;

View File

@ -70,6 +70,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private class TimelineHitObjectRepresentation : SelectionBlueprint private class TimelineHitObjectRepresentation : SelectionBlueprint
{ {
private Circle circle;
public const float THICKNESS = 3; public const float THICKNESS = 3;
public TimelineHitObjectRepresentation(HitObject hitObject) 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), Size = new Vector2(16),
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
@ -116,6 +118,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
BorderThickness = THICKNESS, BorderThickness = THICKNESS,
}); });
} }
protected override void OnSelected() => circle.BorderColour = Color4.Orange;
protected override void OnDeselected() => circle.BorderColour = Color4.Black;
} }
} }
} }