From b86f387fd30acab999ad27d38dfb31bd9a993e8a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Dec 2023 15:04:20 +0900 Subject: [PATCH 1/3] Fix the width of vertical attribute display numbers Not necessarily required to fix the issue at hand, but probably good practice here. --- osu.Game/Overlays/Mods/VerticalAttributeDisplay.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/VerticalAttributeDisplay.cs b/osu.Game/Overlays/Mods/VerticalAttributeDisplay.cs index 62c08f8132..33b7eaae1c 100644 --- a/osu.Game/Overlays/Mods/VerticalAttributeDisplay.cs +++ b/osu.Game/Overlays/Mods/VerticalAttributeDisplay.cs @@ -82,7 +82,8 @@ namespace osu.Game.Overlays.Mods { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - AutoSizeAxes = Axes.Both, + AutoSizeAxes = Axes.Y, + Width = 50, Direction = FillDirection.Vertical, Children = new Drawable[] { From dc5c9837ed969d736645b9bf287099069774caa1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Dec 2023 16:00:03 +0900 Subject: [PATCH 2/3] Fix `StarRatingDisplay`'s display width to avoid text making slight autosize changes --- .../Beatmaps/Drawables/StarRatingDisplay.cs | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/StarRatingDisplay.cs b/osu.Game/Beatmaps/Drawables/StarRatingDisplay.cs index df8953d57c..55ef6f705e 100644 --- a/osu.Game/Beatmaps/Drawables/StarRatingDisplay.cs +++ b/osu.Game/Beatmaps/Drawables/StarRatingDisplay.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; @@ -38,6 +39,8 @@ namespace osu.Game.Beatmaps.Drawables private readonly Bindable displayedStars = new BindableDouble(); + private readonly Container textContainer; + /// /// The currently displayed stars of this display wrapped in a bindable. /// This bindable gets transformed on change rather than instantaneous, if animation is enabled. @@ -116,15 +119,19 @@ namespace osu.Game.Beatmaps.Drawables Size = new Vector2(8f), }, Empty(), - starsText = new OsuSpriteText + textContainer = new Container { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Margin = new MarginPadding { Bottom = 1.5f }, - // todo: this should be size: 12f, but to match up with the design, it needs to be 14.4f - // see https://github.com/ppy/osu-framework/issues/3271. - Font = OsuFont.Torus.With(size: 14.4f, weight: FontWeight.Bold), - Shadow = false, + AutoSizeAxes = Axes.Y, + Child = starsText = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Margin = new MarginPadding { Bottom = 1.5f }, + // todo: this should be size: 12f, but to match up with the design, it needs to be 14.4f + // see https://github.com/ppy/osu-framework/issues/3271. + Font = OsuFont.Torus.With(size: 14.4f, weight: FontWeight.Bold), + Shadow = false, + }, }, } } @@ -155,6 +162,11 @@ namespace osu.Game.Beatmaps.Drawables 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); } } From 4357bb1040b6f7e64f7bc24eb98434e682d352cf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Dec 2023 16:01:07 +0900 Subject: [PATCH 3/3] Change `LeftContent` autosize duration to match main content to reduce visual awkwards --- osu.Game/Overlays/Mods/BeatmapAttributesDisplay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Mods/BeatmapAttributesDisplay.cs b/osu.Game/Overlays/Mods/BeatmapAttributesDisplay.cs index d50b2c33d7..94dd96ec1c 100644 --- a/osu.Game/Overlays/Mods/BeatmapAttributesDisplay.cs +++ b/osu.Game/Overlays/Mods/BeatmapAttributesDisplay.cs @@ -144,8 +144,8 @@ namespace osu.Game.Overlays.Mods private void startAnimating() { - Content.AutoSizeEasing = Easing.OutQuint; - Content.AutoSizeDuration = transition_duration; + LeftContent.AutoSizeEasing = Content.AutoSizeEasing = Easing.OutQuint; + LeftContent.AutoSizeDuration = Content.AutoSizeDuration = transition_duration; } private void updateValues() => Scheduler.AddOnce(() =>