1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-23 06:59:53 +08:00

Fix tooltip not being displayed around edges of text content

This commit is contained in:
Dean Herbert
2025-06-10 17:17:47 +09:00
Unverified
parent f16a7309f8
commit 599b4c8236
+26 -24
View File
@@ -57,7 +57,7 @@ namespace osu.Game.Screens.SelectV2
private Container modContainer = null!;
private Container overflowModCountDisplay = null!;
private ModCountText overflowModCountDisplay = null!;
[Resolved]
private OsuColour colours { get; set; } = null!;
@@ -142,27 +142,7 @@ namespace osu.Game.Screens.SelectV2
Current = { BindTarget = Current },
ExpansionMode = ExpansionMode.AlwaysContracted,
},
overflowModCountDisplay = new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
new Box
{
Colour = colourProvider.Background3,
Alpha = 0.8f,
RelativeSizeAxes = Axes.Both,
},
new ModCountText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Shear = -OsuGame.SHEAR,
Font = OsuFont.Torus.With(size: 14f, weight: FontWeight.Bold),
Mods = { BindTarget = Current },
}
}
},
overflowModCountDisplay = new ModCountText { Mods = { BindTarget = Current }, },
}
},
}
@@ -269,17 +249,39 @@ namespace osu.Game.Screens.SelectV2
overflowModCountDisplay.Hide();
}
private partial class ModCountText : OsuSpriteText, IHasCustomTooltip<IReadOnlyList<Mod>>
private partial class ModCountText : CompositeDrawable, IHasCustomTooltip<IReadOnlyList<Mod>>
{
public readonly Bindable<IReadOnlyList<Mod>> Mods = new Bindable<IReadOnlyList<Mod>>();
private OsuSpriteText text = null!;
[Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!;
protected override void LoadComplete()
{
base.LoadComplete();
Mods.BindValueChanged(v => Text = ModSelectOverlayStrings.Mods(v.NewValue.Count).ToUpper(), true);
RelativeSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
new Box
{
Colour = colourProvider.Background3,
Alpha = 0.8f,
RelativeSizeAxes = Axes.Both,
},
text = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.Torus.With(size: 14f, weight: FontWeight.Bold),
Shear = -OsuGame.SHEAR,
}
};
Mods.BindValueChanged(v => text.Text = ModSelectOverlayStrings.Mods(v.NewValue.Count).ToUpper(), true);
}
public ITooltip<IReadOnlyList<Mod>> GetCustomTooltip() => new ModOverflowTooltip(colourProvider);