mirror of https://github.com/ppy/osu
Merge pull request #22507 from Joehuu/fix-comment-padding
Fix comments having too much padding at the bottom
This commit is contained in:
commit
78eae171ed
|
@ -76,6 +76,7 @@ public partial class DrawableComment : CompositeDrawable
|
|||
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 @@ private void load(OverlayColourProvider colourProvider, DrawableComment? parentC
|
|||
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 @@ private void toggleReply()
|
|||
{
|
||||
if (replyEditorContainer.Count == 0)
|
||||
{
|
||||
replyEditorContainer.Show();
|
||||
replyEditorContainer.Add(new ReplyCommentEditor(Comment)
|
||||
{
|
||||
OnPost = comments =>
|
||||
|
@ -456,12 +460,14 @@ private void toggleReply()
|
|||
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 @@ private void updateButtonsState()
|
|||
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);
|
||||
|
|
|
@ -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 @@ public partial class ReplyCommentEditor : CancellableCommentEditor
|
|||
public ReplyCommentEditor(Comment parent)
|
||||
{
|
||||
parentComment = parent;
|
||||
OnCancel = () => this.FadeOut(200).Expire();
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
|
|
Loading…
Reference in New Issue