1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 06:03:08 +08:00

Allow section headers to wrap

This commit is contained in:
Dean Herbert 2022-03-16 17:19:08 +09:00
parent a0a033520f
commit ba1642a680
2 changed files with 21 additions and 13 deletions

View File

@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual.UserInterface
}) })
}, },
}, },
new EditorSidebarSection("Section 2") new EditorSidebarSection("Section with a really long section header")
{ {
Child = new FillFlowContainer Child = new FillFlowContainer
{ {

View File

@ -7,7 +7,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Containers;
using osu.Game.Overlays; using osu.Game.Overlays;
using osuTK; using osuTK;
@ -49,25 +49,33 @@ namespace osu.Game.Screens.Edit.Components
Margin = new MarginPadding { Vertical = 10, Horizontal = 5 }; Margin = new MarginPadding { Vertical = 10, Horizontal = 5 };
AutoSizeAxes = Axes.Both; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider) private void load(OverlayColourProvider colourProvider)
{ {
InternalChildren = new Drawable[] InternalChild = new FillFlowContainer
{ {
new OsuSpriteText RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(2),
Children = new Drawable[]
{
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 16, weight: FontWeight.SemiBold))
{ {
Text = text, Text = text,
Font = OsuFont.Default.With(size: 16, weight: FontWeight.SemiBold), RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
}, },
new Circle new Circle
{ {
Y = 18,
Colour = colourProvider.Highlight1, Colour = colourProvider.Highlight1,
Size = new Vector2(28, 2), Size = new Vector2(28, 2),
} }
}
}; };
} }
} }