diff --git a/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs b/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs
index 488ba220a2..616cabbab2 100644
--- a/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs
+++ b/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs
@@ -41,12 +41,15 @@ namespace osu.Game.Screens.Edit.Menus
private class DrawableEditorBarMenuItem : DrawableOsuMenuItem
{
+ private BackgroundBox background;
public DrawableEditorBarMenuItem(MenuItem item)
: base(item)
{
Anchor = Anchor.CentreLeft;
Origin = Anchor.CentreLeft;
+
+ StateChanged += stateChanged;
}
[BackgroundDependencyLoader]
@@ -79,25 +82,15 @@ namespace osu.Game.Screens.Edit.Menus
base.UpdateForegroundColour();
}
- protected override void Update()
+ private void stateChanged(MenuItemState newState)
{
- base.Update();
+ if (newState == MenuItemState.Selected)
+ background.Expand();
+ else
+ background.Contract();
}
- protected override Drawable CreateBackground() => new Container
- {
- RelativeSizeAxes = Axes.Both,
- Masking = true,
- Child = new Container
- {
- RelativeSizeAxes = Axes.Both,
- Height = 2,
- Masking = true,
- CornerRadius = 4,
- Child = new Box { RelativeSizeAxes = Axes.Both }
- }
- };
-
+ protected override Drawable CreateBackground() => background = new BackgroundBox();
protected override DrawableOsuMenuItem.TextContainer CreateTextContainer() => new TextContainer();
private new class TextContainer : DrawableOsuMenuItem.TextContainer
@@ -108,6 +101,34 @@ namespace osu.Game.Screens.Edit.Menus
NormalText.Margin = BoldText.Margin = new MarginPadding { Horizontal = 10, Vertical = MARGIN_VERTICAL };
}
}
+
+ private class BackgroundBox : CompositeDrawable
+ {
+ private readonly Container innerBackground;
+
+ public BackgroundBox()
+ {
+ RelativeSizeAxes = Axes.Both;
+ Masking = true;
+ InternalChild = innerBackground = new Container
+ {
+ RelativeSizeAxes = Axes.Both,
+ Masking = true,
+ CornerRadius = 4,
+ Child = new Box { RelativeSizeAxes = Axes.Both }
+ };
+ }
+
+ ///
+ /// Expands the background such that it doesn't show the bottom corners.
+ ///
+ public void Expand() => innerBackground.Height = 2;
+
+ ///
+ /// Contracts the background such that it shows the bottom corners.
+ ///
+ public void Contract() => innerBackground.Height = 1;
+ }
}
private class SubMenu : OsuMenu