Fix incorrect padding for nested comments

This commit is contained in:
Andrei Zavatski 2019-10-14 17:26:12 +03:00
parent b53fb0d228
commit 139170cdc8
1 changed files with 87 additions and 82 deletions

View File

@ -51,100 +51,105 @@ public DrawableComment(Comment comment)
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
content = new GridContainer new Container
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Margin = new MarginPadding(margin), Padding = new MarginPadding(margin),
ColumnDimensions = new[] Child = content = new GridContainer
{ {
new Dimension(GridSizeMode.AutoSize), RelativeSizeAxes = Axes.X,
new Dimension(), AutoSizeAxes = Axes.Y,
}, ColumnDimensions = new[]
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize)
},
Content = new[]
{
new Drawable[]
{ {
new FillFlowContainer new Dimension(GridSizeMode.AutoSize),
new Dimension(),
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize)
},
Content = new[]
{
new Drawable[]
{ {
AutoSizeAxes = Axes.Both, new FillFlowContainer
Margin = new MarginPadding { Horizontal = margin },
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5, 0),
Children = new Drawable[]
{ {
votePill = new VotePill(comment.VotesCount) AutoSizeAxes = Axes.Both,
Margin = new MarginPadding { Horizontal = margin },
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5, 0),
Children = new Drawable[]
{ {
Anchor = Anchor.Centre, votePill = new VotePill(comment.VotesCount)
Origin = Anchor.Centre,
AlwaysPresent = true,
},
new UpdateableAvatar(comment.User)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(avatar_size),
Masking = true,
CornerRadius = avatar_size / 2,
},
}
},
new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Spacing = new Vector2(0, 3),
Children = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(7, 0),
Children = new Drawable[]
{ {
username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true)) Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AlwaysPresent = true,
},
new UpdateableAvatar(comment.User)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(avatar_size),
Masking = true,
CornerRadius = avatar_size / 2,
},
}
},
new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Spacing = new Vector2(0, 3),
Children = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(7, 0),
Children = new Drawable[]
{ {
AutoSizeAxes = Axes.Both, username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true))
}, {
new ParentUsername(comment), AutoSizeAxes = Axes.Both,
new SpriteText },
{ new ParentUsername(comment),
Alpha = comment.IsDeleted? 1 : 0, new SpriteText
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true), {
Text = @"deleted", Alpha = comment.IsDeleted? 1 : 0,
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
Text = @"deleted",
}
} }
} },
}, message = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14))
message = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14))
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Right = 40 }
},
info = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
Colour = OsuColour.Gray(0.7f),
Children = new Drawable[]
{ {
new SpriteText RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Right = 40 }
},
info = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
Colour = OsuColour.Gray(0.7f),
Children = new Drawable[]
{ {
Anchor = Anchor.CentreLeft, new SpriteText
Origin = Anchor.CentreLeft, {
Font = OsuFont.GetFont(size: 12), Anchor = Anchor.CentreLeft,
Text = HumanizerUtils.Humanize(comment.CreatedAt) Origin = Anchor.CentreLeft,
}, Font = OsuFont.GetFont(size: 12),
new RepliesButton(comment.RepliesCount) Text = HumanizerUtils.Humanize(comment.CreatedAt)
{ },
Expanded = { BindTarget = childExpanded } new RepliesButton(comment.RepliesCount)
}, {
Expanded = { BindTarget = childExpanded }
},
}
} }
} }
} }
@ -161,7 +166,7 @@ public DrawableComment(Comment comment)
{ {
childCommentsContainer = new FillFlowContainer childCommentsContainer = new FillFlowContainer
{ {
Margin = new MarginPadding { Left = 20 }, Padding = new MarginPadding { Left = 20 },
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical Direction = FillDirection.Vertical