1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 13:32:54 +08:00

Track comment's nesting and reduce padding for too nested

This commit is contained in:
ansel 2023-01-18 02:11:07 +03:00
parent 12544c16ea
commit ca3be71381

View File

@ -57,6 +57,11 @@ namespace osu.Game.Overlays.Comments
/// </summary>
public bool WasDeleted { get; protected set; }
/// <summary>
/// Tracks this comment's level of nesting. 0 means that this comment has no parents.
/// </summary>
public int Level { get; private set; }
private FillFlowContainer childCommentsVisibilityContainer = null!;
private FillFlowContainer childCommentsContainer = null!;
private LoadRepliesButton loadRepliesButton = null!;
@ -88,12 +93,16 @@ namespace osu.Game.Overlays.Comments
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
private void load(OverlayColourProvider colourProvider, DrawableComment? parentComment)
{
LinkFlowContainer username;
FillFlowContainer info;
CommentMarkdownContainer message;
Level = parentComment?.Level + 1 ?? 0;
float childrenPadding = Level < 6 ? 20 : 5;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
InternalChildren = new Drawable[]
@ -248,7 +257,7 @@ namespace osu.Game.Overlays.Comments
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Padding = new MarginPadding { Left = 20 },
Padding = new MarginPadding { Left = childrenPadding },
Children = new Drawable[]
{
childCommentsContainer = new FillFlowContainer