1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

use container for main title and sub title table of contents

This commit is contained in:
Gagah Pangeran Rosfatiputra 2021-06-06 08:37:03 +07:00
parent 9f45a28623
commit 525c16419a
No known key found for this signature in database
GPG Key ID: 25F6F17FD29031E2

View File

@ -15,9 +15,9 @@ namespace osu.Game.Overlays.Wiki
{
private readonly FillFlowContainer content;
private FillFlowContainer lastItem;
private Container lastMainTitle;
private FillFlowContainer lastSubsection;
private Container lastSubTitle;
public WikiTableOfContents()
{
@ -37,29 +37,26 @@ namespace osu.Game.Overlays.Wiki
if (subtitle)
{
lastSubsection ??= new FillFlowContainer
lastMainTitle.Margin = new MarginPadding(0);
if (lastSubTitle != null)
lastSubTitle.Margin = new MarginPadding(0);
content.Add(lastSubTitle = new Container
{
Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Left = 10 },
};
lastSubsection.Add(entry);
Margin = new MarginPadding { Bottom = 10 },
Child = entry,
});
return;
}
if (lastSubsection != null)
{
lastItem.Add(lastSubsection);
lastItem.Margin = new MarginPadding { Bottom = 10 };
lastSubsection = null;
}
lastSubTitle = null;
content.Add(lastItem = new FillFlowContainer
content.Add(lastMainTitle = new Container
{
Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Margin = new MarginPadding { Bottom = 5 },
@ -92,6 +89,7 @@ namespace osu.Game.Overlays.Wiki
f.AutoSizeAxes = Axes.Y;
});
Margin = new MarginPadding { Bottom = 2 };
Padding = new MarginPadding { Left = subtitle ? 10 : 0 };
}
protected override IEnumerable<Drawable> EffectTargets => new Drawable[] { textFlow };