add bullet marker in OsuMarkdownListItem

This commit is contained in:
Gagah Pangeran Rosfatiputra 2021-04-30 10:35:40 +07:00
parent 010c51e6ed
commit e3cc4561ab
No known key found for this signature in database
GPG Key ID: 25F6F17FD29031E2

View File

@ -1,8 +1,10 @@
// 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 osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Containers.Markdown;
using osuTK;
namespace osu.Game.Graphics.Containers.Markdown
@ -11,6 +13,9 @@ namespace osu.Game.Graphics.Containers.Markdown
{
private const float default_left_padding = 20;
[Resolved]
private IMarkdownTextComponent parentTextComponent { get; set; }
public FillFlowContainer Content { get; }
public OsuMarkdownListItem()
@ -30,5 +35,18 @@ namespace osu.Game.Graphics.Containers.Markdown
}
};
}
[BackgroundDependencyLoader]
private void load()
{
var marker = parentTextComponent.CreateSpriteText();
marker.Text = "●";
marker.Font = OsuFont.GetFont(size: marker.Font.Size / 2);
marker.Origin = Anchor.Centre;
marker.X = -default_left_padding / 2;
marker.Y = marker.Font.Size;
AddInternal(marker);
}
}
}