add level in OsuMarkdownListItem

This commit is contained in:
Gagah Pangeran Rosfatiputra 2021-04-30 10:39:48 +07:00
parent e3cc4561ab
commit f676526cf4
No known key found for this signature in database
GPG Key ID: 25F6F17FD29031E2
2 changed files with 6 additions and 3 deletions

View File

@ -23,7 +23,7 @@ protected override void AddMarkdownComponent(IMarkdownObject markdownObject, Fil
break;
case ListItemBlock listItemBlock:
var childContainer = CreateListItem(listItemBlock);
var childContainer = CreateListItem(listItemBlock, level);
container.Add(childContainer);
foreach (var single in listItemBlock)
base.AddMarkdownComponent(single, childContainer.Content, level);
@ -50,7 +50,7 @@ protected override void AddMarkdownComponent(IMarkdownObject markdownObject, Fil
Padding = new MarginPadding(0)
};
protected virtual OsuMarkdownListItem CreateListItem(ListItemBlock listItemBlock) => new OsuMarkdownListItem();
protected virtual OsuMarkdownListItem CreateListItem(ListItemBlock listItemBlock, int level) => new OsuMarkdownListItem(level);
protected override MarkdownPipeline CreateBuilder()
=> new MarkdownPipelineBuilder().UseAutoIdentifiers(AutoIdentifierOptions.GitHub)

View File

@ -11,6 +11,7 @@ namespace osu.Game.Graphics.Containers.Markdown
{
public class OsuMarkdownListItem : CompositeDrawable
{
private readonly int level;
private const float default_left_padding = 20;
[Resolved]
@ -18,8 +19,10 @@ public class OsuMarkdownListItem : CompositeDrawable
public FillFlowContainer Content { get; }
public OsuMarkdownListItem()
public OsuMarkdownListItem(int level)
{
this.level = level;
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
Padding = new MarginPadding { Left = default_left_padding };