1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 07:33:20 +08:00

Merge pull request #22507 from Joehuu/fix-comment-padding

Fix comments having too much padding at the bottom
This commit is contained in:
Dean Herbert 2023-02-08 15:01:05 +09:00 committed by GitHub
commit 78eae171ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 7 deletions

View File

@ -76,6 +76,7 @@ namespace osu.Game.Overlays.Comments
private GridContainer content = null!;
private VotePill votePill = null!;
private Container<CommentEditor> replyEditorContainer = null!;
private Container repliesButtonContainer = null!;
[Resolved]
private IDialogOverlay? dialogOverlay { get; set; }
@ -239,10 +240,12 @@ namespace osu.Game.Overlays.Comments
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Padding = new MarginPadding { Top = 10 },
Alpha = 0,
},
new Container
repliesButtonContainer = new Container
{
AutoSizeAxes = Axes.Both,
Alpha = 0,
Children = new Drawable[]
{
showRepliesButton = new ShowRepliesButton(Comment.RepliesCount)
@ -449,6 +452,7 @@ namespace osu.Game.Overlays.Comments
{
if (replyEditorContainer.Count == 0)
{
replyEditorContainer.Show();
replyEditorContainer.Add(new ReplyCommentEditor(Comment)
{
OnPost = comments =>
@ -456,12 +460,14 @@ namespace osu.Game.Overlays.Comments
Comment.RepliesCount += comments.Length;
showRepliesButton.Count = Comment.RepliesCount;
Replies.AddRange(comments);
}
},
OnCancel = toggleReply
});
}
else
{
replyEditorContainer.Clear(true);
replyEditorContainer.ForEach(e => e.Expire());
replyEditorContainer.Hide();
}
}
@ -513,9 +519,11 @@ namespace osu.Game.Overlays.Comments
int loadedRepliesCount = loadedReplies.Count;
bool hasUnloadedReplies = loadedRepliesCount != Comment.RepliesCount;
loadRepliesButton.FadeTo(hasUnloadedReplies && loadedRepliesCount == 0 ? 1 : 0);
showMoreButton.FadeTo(hasUnloadedReplies && loadedRepliesCount > 0 ? 1 : 0);
showRepliesButton.FadeTo(loadedRepliesCount != 0 ? 1 : 0);
loadRepliesButton.FadeTo(hasUnloadedReplies && loadedRepliesCount == 0 ? 1 : 0);
repliesButtonContainer.FadeTo(repliesButtonContainer.Any(child => child.Alpha > 0) ? 1 : 0);
showMoreButton.FadeTo(hasUnloadedReplies && loadedRepliesCount > 0 ? 1 : 0);
if (Comment.IsTopLevel)
chevronButton.FadeTo(loadedRepliesCount != 0 ? 1 : 0);

View File

@ -4,7 +4,6 @@
using System;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Framework.Logging;
using osu.Game.Online.API;
@ -33,7 +32,6 @@ namespace osu.Game.Overlays.Comments
public ReplyCommentEditor(Comment parent)
{
parentComment = parent;
OnCancel = () => this.FadeOut(200).Expire();
}
protected override void LoadComplete()