1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 17:27:24 +08:00

Apply half margin of tolerance on both sides before text scrolls

This commit is contained in:
Joseph Madamba 2024-05-02 17:01:40 -07:00
parent d4951a093f
commit 2f075e3247
2 changed files with 20 additions and 6 deletions

View File

@ -45,16 +45,28 @@ namespace osu.Game.Tests.Visual.UserInterface
[Test]
public void TestLongMetadata()
{
AddStep(@"set beatmap", () => Beatmap.Value = CreateWorkingBeatmap(new Beatmap
AddStep(@"set metadata within tolerance", () => Beatmap.Value = CreateWorkingBeatmap(new Beatmap
{
Metadata =
{
Artist = "very very very very very very very very very very very long artist",
ArtistUnicode = "very very very very very very very very very very very long artist",
Title = "very very very very very very very very very very very long title",
TitleUnicode = "very very very very very very very very very very very long title",
Artist = "very very very very very very very very very very verry long artist",
ArtistUnicode = "very very very very very very very very very very verry long artist",
Title = "very very very very very verry long title",
TitleUnicode = "very very very very very verry long title",
}
}));
AddStep(@"set metadata outside bounds", () => Beatmap.Value = CreateWorkingBeatmap(new Beatmap
{
Metadata =
{
Artist = "very very very very very very very very very very verrry long artist",
ArtistUnicode = "very very very very very very very very very very verrry long artist",
Title = "very very very very very verrry long title",
TitleUnicode = "very very very very very verrry long title",
}
}));
AddStep(@"show", () => nowPlayingOverlay.Show());
}
}

View File

@ -9,6 +9,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
@ -533,7 +534,8 @@ namespace osu.Game.Overlays
float textOverflowWidth = mainSpriteText.Width - player_width;
if (textOverflowWidth > 0)
// apply half margin of tolerance on both sides before the text scrolls
if (textOverflowWidth > margin)
{
fillerSpriteText.Alpha = 1;
fillerSpriteText.Text = text;