Add support for setting fixed size of status pill

This commit is contained in:
Bartłomiej Dach
2021-10-17 14:55:52 +02:00
parent 5ab3337a10
commit feedd53a53
2 changed files with 41 additions and 0 deletions

View File

@ -47,6 +47,31 @@ namespace osu.Game.Beatmaps.Drawables
set => statusText.Padding = value;
}
private float? fixedWidth;
/// <summary>
/// When set to a non-<see langword="null"/> value, the pill will be forcibly sized to the given width.
/// When set to a <see langword="null"/> value, the pill will autosize to its contents.
/// </summary>
public float? FixedWidth
{
get => fixedWidth;
set
{
fixedWidth = value;
if (fixedWidth == null)
{
AutoSizeAxes = Axes.Both;
}
else
{
AutoSizeAxes = Axes.Y;
Width = fixedWidth.Value;
}
}
}
private readonly OsuSpriteText statusText;
private readonly Box background;