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

Remove FixedWidth and add AutoSizeAxes specs to all usages

This commit is contained in:
Bartłomiej Dach 2021-10-25 20:20:40 +02:00
parent feedd53a53
commit 6802e9ec10
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
7 changed files with 12 additions and 28 deletions

View File

@ -28,6 +28,7 @@ namespace osu.Game.Tests.Visual.Beatmaps
Spacing = new Vector2(0, 10),
ChildrenEnumerable = Enum.GetValues(typeof(BeatmapSetOnlineStatus)).Cast<BeatmapSetOnlineStatus>().Select(status => new BeatmapSetOnlineStatusPill
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Status = status
@ -41,8 +42,12 @@ namespace osu.Game.Tests.Visual.Beatmaps
{
AddStep("create themed content", () => CreateThemedContent(OverlayColourScheme.Red));
AddStep("set fixed width", () => statusPills.ForEach(pill => pill.FixedWidth = 90));
AddStep("unset fixed width", () => statusPills.ForEach(pill => pill.FixedWidth = null));
AddStep("set fixed width", () => statusPills.ForEach(pill =>
{
pill.AutoSizeAxes = Axes.Y;
pill.Width = 90;
}));
AddStep("unset fixed width", () => statusPills.ForEach(pill => pill.AutoSizeAxes = Axes.Both));
}
}
}

View File

@ -47,31 +47,6 @@ 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;
@ -83,7 +58,6 @@ namespace osu.Game.Beatmaps.Drawables
public BeatmapSetOnlineStatusPill()
{
AutoSizeAxes = Axes.Both;
Masking = true;
Children = new Drawable[]

View File

@ -243,6 +243,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
statusContainer.Add(new BeatmapSetOnlineStatusPill
{
AutoSizeAxes = Axes.Both,
TextSize = 12,
TextPadding = new MarginPadding { Horizontal = 10, Vertical = 5 },
Status = SetInfo.OnlineInfo?.Status ?? BeatmapSetOnlineStatus.None,

View File

@ -257,6 +257,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
statusContainer.Add(new BeatmapSetOnlineStatusPill
{
AutoSizeAxes = Axes.Both,
TextSize = 12,
TextPadding = new MarginPadding { Horizontal = 10, Vertical = 4 },
Status = SetInfo.OnlineInfo?.Status ?? BeatmapSetOnlineStatus.None,

View File

@ -198,6 +198,7 @@ namespace osu.Game.Overlays.BeatmapSet
{
onlineStatusPill = new BeatmapSetOnlineStatusPill
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
TextSize = 14,

View File

@ -257,6 +257,7 @@ namespace osu.Game.Screens.Select
},
StatusPill = new BeatmapSetOnlineStatusPill
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Shear = -wedged_container_shear,

View File

@ -60,6 +60,7 @@ namespace osu.Game.Screens.Select.Carousel
{
new BeatmapSetOnlineStatusPill
{
AutoSizeAxes = Axes.Both,
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Margin = new MarginPadding { Right = 5 },