-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Made the user avatar square, in UserAvatarNotification.
#34533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| IconContent.Masking = true; | ||
| IconContent.CornerRadius = CORNER_RADIUS; | ||
| IconContent.ChangeChildDepth(IconDrawable, float.MinValue); | ||
| IconContent.OnUpdate += _ => IconContent.Width = IconContent.BoundingBox.Height; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't get too comfortable doing this. Override Update() locally, and likely implement as IconContent.Width = Avatar.Height or something.
This:
- Stores a reference to
thisandIconContent. In this case it turns out to not be a problem. - Computes screen-space
BoundingBoxevery frame.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see the reference as a huge deal because it's a direct child.
For the BoundingBox part, I glossed over that, but
diff --git a/osu.Game/Overlays/Notifications/UserAvatarNotification.cs b/osu.Game/Overlays/Notifications/UserAvatarNotification.cs
index 32a0e31e30..e716004c2b 100644
--- a/osu.Game/Overlays/Notifications/UserAvatarNotification.cs
+++ b/osu.Game/Overlays/Notifications/UserAvatarNotification.cs
@@ -31,7 +31,7 @@ private void load()
IconContent.Masking = true;
IconContent.CornerRadius = CORNER_RADIUS;
IconContent.ChangeChildDepth(IconDrawable, float.MinValue);
- IconContent.OnUpdate += _ => IconContent.Width = IconContent.BoundingBox.Height;
+ IconContent.OnUpdate += _ => IconContent.Width = IconContent.DrawHeight;
LoadComponentAsync(Avatar = new DrawableAvatar(user)
{
should be fine as a replacement yeah?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or even better:
diff --git a/osu.Game/Overlays/Notifications/UserAvatarNotification.cs b/osu.Game/Overlays/Notifications/UserAvatarNotification.cs
index 32a0e31e30..f983643d8b 100644
--- a/osu.Game/Overlays/Notifications/UserAvatarNotification.cs
+++ b/osu.Game/Overlays/Notifications/UserAvatarNotification.cs
@@ -31,7 +31,6 @@ private void load()
IconContent.Masking = true;
IconContent.CornerRadius = CORNER_RADIUS;
IconContent.ChangeChildDepth(IconDrawable, float.MinValue);
- IconContent.OnUpdate += _ => IconContent.Width = IconContent.BoundingBox.Height;
LoadComponentAsync(Avatar = new DrawableAvatar(user)
{
@@ -39,5 +38,11 @@ private void load()
}, IconContent.Add);
}
}
+
+ protected override void Update()
+ {
+ base.Update();
+ IconContent.Width = IconContent.DrawHeight;
+ }
}
}
seems to work just as well
Before:

After:
