1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Merge pull request #27974 from peppy/editor-menu-chev

Add a chevron to distinguish editor menus with submenus
This commit is contained in:
Bartłomiej Dach 2024-04-23 18:12:08 +02:00 committed by GitHub
commit a35bf77131
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 @@ namespace osu.Game.Screens.Edit.Components.Menus
{
}
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 @@ namespace osu.Game.Screens.Edit.Components.Menus
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,
});
}
}
}
}