1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 20:59:35 +08:00

extract out table head and body border into separate component

This commit is contained in:
Gagah Pangeran Rosfatiputra 2021-05-07 14:47:46 +07:00
parent 64e9c5e9ba
commit d92e593ddd
No known key found for this signature in database
GPG Key ID: 25F6F17FD29031E2

View File

@ -26,27 +26,10 @@ namespace osu.Game.Graphics.Containers.Markdown
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider) private void load(OverlayColourProvider colourProvider)
{ {
var border = new Box
{
RelativeSizeAxes = Axes.X,
};
if (isHeading) if (isHeading)
{ AddInternal(new TableHeadBorder());
border.Colour = colourProvider.Background3;
border.Height = 2;
border.Anchor = Anchor.BottomLeft;
border.Origin = Anchor.BottomLeft;
}
else else
{ AddInternal(new TableBodyBorder());
border.Colour = colourProvider.Background4;
border.Height = 1;
border.Anchor = Anchor.TopLeft;
border.Origin = Anchor.TopLeft;
}
AddInternal(border);
} }
public override MarkdownTextFlowContainer CreateTextFlow() => new TableCellTextFlowContainer public override MarkdownTextFlowContainer CreateTextFlow() => new TableCellTextFlowContainer
@ -55,6 +38,30 @@ namespace osu.Game.Graphics.Containers.Markdown
Padding = new MarginPadding(10), Padding = new MarginPadding(10),
}; };
private class TableHeadBorder : Box
{
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
Colour = colourProvider.Background3;
RelativeSizeAxes = Axes.X;
Height = 2;
Anchor = Anchor.BottomLeft;
Origin = Anchor.BottomLeft;
}
}
private class TableBodyBorder : Box
{
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
Colour = colourProvider.Background4;
RelativeSizeAxes = Axes.X;
Height = 1;
}
}
private class TableCellTextFlowContainer : OsuMarkdownTextFlowContainer private class TableCellTextFlowContainer : OsuMarkdownTextFlowContainer
{ {
public FontWeight Weight { get; set; } public FontWeight Weight { get; set; }