mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 09:32:55 +08:00
Apply half margin of tolerance on both sides before text scrolls
This commit is contained in:
parent
d4951a093f
commit
2f075e3247
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user