diff --git a/osu.Game/Overlays/SettingsToolboxGroup.cs b/osu.Game/Overlays/SettingsToolboxGroup.cs index 02b5bdc1e1..fcc7ff2504 100644 --- a/osu.Game/Overlays/SettingsToolboxGroup.cs +++ b/osu.Game/Overlays/SettingsToolboxGroup.cs @@ -2,11 +2,13 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; +using osu.Framework.Layout; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -53,6 +55,8 @@ public bool Expanded private Color4 expandedColour; + private readonly OsuSpriteText headerText; + /// /// Create a new instance. /// @@ -90,12 +94,10 @@ protected SettingsToolboxGroup(string title) Height = header_height, Children = new Drawable[] { - new OsuSpriteText + headerText = new OsuSpriteText { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - RelativeSizeAxes = Axes.X, - Truncate = true, Text = title.ToUpperInvariant(), Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 17), Padding = new MarginPadding { Left = 10, Right = 30 }, @@ -132,6 +134,16 @@ protected SettingsToolboxGroup(string title) private const float fade_duration = 800; private const float inactive_alpha = 0.5f; + protected override bool OnInvalidate(Invalidation invalidation, InvalidationSource source) + { + // These toolbox grouped may be contracted to only show icons. + // For now, let's hide the header to avoid text truncation weirdness in such cases. + if (invalidation.HasFlagFast(Invalidation.DrawSize)) + headerText.FadeTo(headerText.DrawWidth < DrawWidth ? 1 : 0, 150, Easing.OutQuint); + + return base.OnInvalidate(invalidation, source); + } + protected override void LoadComplete() { base.LoadComplete();