1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-20 06:39:54 +08:00

Merge pull request #23367 from peppy/fix-uo-tooltip

Fix slider bar tooltips potentially showing negative zero
This commit is contained in:
Bartłomiej Dach
2023-05-02 18:03:09 +02:00
committed by GitHub
Unverified
2 changed files with 4 additions and 2 deletions
@@ -97,7 +97,9 @@ namespace osu.Game.Graphics.UserInterface
// Find the number of significant digits (we could have less than 5 after normalize())
int significantDigits = FormatUtils.FindPrecision(decimalPrecision);
return floatValue.ToString($"N{significantDigits}");
string negativeSign = Math.Round(floatValue, significantDigits) < 0 ? "-" : string.Empty;
return $"{negativeSign}{Math.Abs(floatValue).ToString($"N{significantDigits}")}";
}
/// <summary>
@@ -12,6 +12,6 @@ namespace osu.Game.Graphics.UserInterface
/// </summary>
public partial class TimeSlider : RoundedSliderBar<double>
{
public override LocalisableString TooltipText => $"{Current.Value:N0} ms";
public override LocalisableString TooltipText => $"{base.TooltipText} ms";
}
}