Skip to content
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

Fix StarRatingDisplay not using fixed width text #32744

Merged
merged 3 commits into from
Apr 10, 2025

Conversation

peppy
Copy link
Member

@peppy peppy commented Apr 9, 2025

No description provided.

@bdach bdach self-requested a review April 9, 2025 11:44
@bdach
Copy link
Collaborator

bdach commented Apr 9, 2025

Probably can revert #25774 if you're going to do this?:

diff --git a/osu.Game/Beatmaps/Drawables/StarRatingDisplay.cs b/osu.Game/Beatmaps/Drawables/StarRatingDisplay.cs
index dbd4918c81..9eea53d621 100644
--- a/osu.Game/Beatmaps/Drawables/StarRatingDisplay.cs
+++ b/osu.Game/Beatmaps/Drawables/StarRatingDisplay.cs
@@ -119,18 +119,14 @@ public StarRatingDisplay(StarDifficulty starDifficulty, StarRatingDisplaySize si
                                     Size = new Vector2(8f),
                                 },
                                 Empty(),
-                                textContainer = new Container
+                                starsText = new OsuSpriteText
                                 {
-                                    AutoSizeAxes = Axes.Y,
-                                    Child = starsText = new OsuSpriteText
-                                    {
-                                        Anchor = Anchor.Centre,
-                                        Origin = Anchor.Centre,
-                                        Margin = new MarginPadding { Bottom = 1.5f },
-                                        Spacing = new Vector2(-1.4f),
-                                        Font = OsuFont.Torus.With(size: 14.4f, weight: FontWeight.Bold, fixedWidth: true),
-                                        Shadow = false,
-                                    },
+                                    Anchor = Anchor.Centre,
+                                    Origin = Anchor.Centre,
+                                    Margin = new MarginPadding { Bottom = 1.5f },
+                                    Spacing = new Vector2(-1.4f),
+                                    Font = OsuFont.Torus.With(size: 14.4f, weight: FontWeight.Bold, fixedWidth: true),
+                                    Shadow = false,
                                 },
                             }
                         }
@@ -161,11 +157,6 @@ protected override void LoadComplete()
 
                 starIcon.Colour = s.NewValue >= 6.5 ? colours.Orange1 : colourProvider?.Background5 ?? Color4Extensions.FromHex("303d47");
                 starsText.Colour = s.NewValue >= 6.5 ? colours.Orange1 : colourProvider?.Background5 ?? Color4.Black.Opacity(0.75f);
-
-                // In order to avoid autosize throwing the width of these displays all over the place,
-                // let's lock in some sane defaults for the text width based on how many digits we're
-                // displaying.
-                textContainer.Width = 24 + Math.Max(starsText.Text.ToString().Length - 4, 0) * 6;
             }, true);
         }
     }

@bdach bdach merged commit 9412334 into ppy:master Apr 10, 2025
10 checks passed
@peppy peppy deleted the star-rating-fixed-width branch April 14, 2025 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants