1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 05:42:56 +08:00

change sprite text to text flow

This commit is contained in:
Gagah Pangeran Rosfatiputra 2021-06-04 12:50:03 +07:00
parent 91e77ee4de
commit a706ff63ed
No known key found for this signature in database
GPG Key ID: 25F6F17FD29031E2

View File

@ -54,26 +54,30 @@ namespace osu.Game.Overlays.Wiki
[Resolved]
private OverlayScrollContainer scrollContainer { get; set; }
private readonly OsuSpriteText spriteText;
private readonly MarkdownHeading target;
private readonly OsuTextFlowContainer textFlow;
public TocTitle(string text, MarkdownHeading target, bool subtitle = false)
{
this.target = target;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Child = spriteText = new OsuSpriteText
Child = textFlow = new OsuTextFlowContainer(t =>
{
Text = text,
Font = OsuFont.GetFont(size: subtitle ? 12 : 15),
};
t.Font = OsuFont.GetFont(size: subtitle ? 12 : 15);
}).With(f =>
{
f.AddText(text);
f.RelativeSizeAxes = Axes.X;
f.AutoSizeAxes = Axes.Y;
});
Margin = new MarginPadding { Top = subtitle ? 5 : 10 };
Padding = new MarginPadding { Left = subtitle ? 10 : 0 };
}
protected override IEnumerable<Drawable> EffectTargets => new Drawable[] { spriteText };
protected override IEnumerable<Drawable> EffectTargets => new Drawable[] { textFlow };
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)