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 @@ namespace osu.Game.Graphics.Containers.Markdown
break; break;
case ListItemBlock listItemBlock: case ListItemBlock listItemBlock:
var childContainer = CreateListItem(listItemBlock); var childContainer = CreateListItem(listItemBlock, level);
container.Add(childContainer); container.Add(childContainer);
foreach (var single in listItemBlock) foreach (var single in listItemBlock)
base.AddMarkdownComponent(single, childContainer.Content, level); base.AddMarkdownComponent(single, childContainer.Content, level);
@ -50,7 +50,7 @@ namespace osu.Game.Graphics.Containers.Markdown
Padding = new MarginPadding(0) 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() protected override MarkdownPipeline CreateBuilder()
=> new MarkdownPipelineBuilder().UseAutoIdentifiers(AutoIdentifierOptions.GitHub) => new MarkdownPipelineBuilder().UseAutoIdentifiers(AutoIdentifierOptions.GitHub)

View File

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