From f676526cf49c270698499983098ed0eca80c5a2d Mon Sep 17 00:00:00 2001 From: Gagah Pangeran Rosfatiputra Date: Fri, 30 Apr 2021 10:39:48 +0700 Subject: [PATCH] add level in OsuMarkdownListItem --- .../Graphics/Containers/Markdown/OsuMarkdownContainer.cs | 4 ++-- osu.Game/Graphics/Containers/Markdown/OsuMarkdownListItem.cs | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownContainer.cs b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownContainer.cs index fc4eecf297..1db47d6978 100644 --- a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownContainer.cs +++ b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownContainer.cs @@ -23,7 +23,7 @@ namespace osu.Game.Graphics.Containers.Markdown 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 @@ namespace osu.Game.Graphics.Containers.Markdown 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) diff --git a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownListItem.cs b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownListItem.cs index 6b35321617..f9800d9262 100644 --- a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownListItem.cs +++ b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownListItem.cs @@ -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 @@ namespace osu.Game.Graphics.Containers.Markdown 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 };