mirror of https://github.com/ppy/osu
Merge pull request #27974 from peppy/editor-menu-chev
Add a chevron to distinguish editor menus with submenus
This commit is contained in:
commit
a35bf77131
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
@ -184,6 +185,17 @@ public EditorMenuItem(MenuItem item)
|
|||
{
|
||||
}
|
||||
|
||||
private bool hasSubmenu => Item.Items.Any();
|
||||
|
||||
protected override TextContainer CreateTextContainer() => base.CreateTextContainer().With(c =>
|
||||
{
|
||||
c.Padding = new MarginPadding
|
||||
{
|
||||
// Add some padding for the chevron below.
|
||||
Right = hasSubmenu ? 5 : 0,
|
||||
};
|
||||
});
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
{
|
||||
|
@ -191,6 +203,18 @@ private void load(OverlayColourProvider colourProvider)
|
|||
BackgroundColourHover = colourProvider.Background1;
|
||||
|
||||
Foreground.Padding = new MarginPadding { Vertical = 2 };
|
||||
|
||||
if (hasSubmenu)
|
||||
{
|
||||
AddInternal(new SpriteIcon
|
||||
{
|
||||
Margin = new MarginPadding(6),
|
||||
Size = new Vector2(8),
|
||||
Icon = FontAwesome.Solid.ChevronRight,
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue