Skip to content

Conversation

@AeroKoder
Copy link

Before:
Screenshot 2025-08-02 131438

After:
Screenshot 2025-08-02 173718

@peppy peppy self-requested a review August 15, 2025 05:59
@peppy peppy merged commit 6ed7ba3 into ppy:master Aug 15, 2025
7 of 9 checks passed
IconContent.Masking = true;
IconContent.CornerRadius = CORNER_RADIUS;
IconContent.ChangeChildDepth(IconDrawable, float.MinValue);
IconContent.OnUpdate += _ => IconContent.Width = IconContent.BoundingBox.Height;
Copy link
Contributor

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 this and IconContent. In this case it turns out to not be a problem.
  • Computes screen-space BoundingBox every frame.

Copy link
Member

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?

Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants