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
commit ec8362c6fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -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>

View File

@ -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";
}
}