mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Remove FixedWidth
and add AutoSizeAxes
specs to all usages
This commit is contained in:
@ -28,6 +28,7 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
|||||||
Spacing = new Vector2(0, 10),
|
Spacing = new Vector2(0, 10),
|
||||||
ChildrenEnumerable = Enum.GetValues(typeof(BeatmapSetOnlineStatus)).Cast<BeatmapSetOnlineStatus>().Select(status => new BeatmapSetOnlineStatusPill
|
ChildrenEnumerable = Enum.GetValues(typeof(BeatmapSetOnlineStatus)).Cast<BeatmapSetOnlineStatus>().Select(status => new BeatmapSetOnlineStatusPill
|
||||||
{
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Status = status
|
Status = status
|
||||||
@ -41,8 +42,12 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
|||||||
{
|
{
|
||||||
AddStep("create themed content", () => CreateThemedContent(OverlayColourScheme.Red));
|
AddStep("create themed content", () => CreateThemedContent(OverlayColourScheme.Red));
|
||||||
|
|
||||||
AddStep("set fixed width", () => statusPills.ForEach(pill => pill.FixedWidth = 90));
|
AddStep("set fixed width", () => statusPills.ForEach(pill =>
|
||||||
AddStep("unset fixed width", () => statusPills.ForEach(pill => pill.FixedWidth = null));
|
{
|
||||||
|
pill.AutoSizeAxes = Axes.Y;
|
||||||
|
pill.Width = 90;
|
||||||
|
}));
|
||||||
|
AddStep("unset fixed width", () => statusPills.ForEach(pill => pill.AutoSizeAxes = Axes.Both));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,31 +47,6 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
set => statusText.Padding = value;
|
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 OsuSpriteText statusText;
|
||||||
private readonly Box background;
|
private readonly Box background;
|
||||||
|
|
||||||
@ -83,7 +58,6 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
|
|
||||||
public BeatmapSetOnlineStatusPill()
|
public BeatmapSetOnlineStatusPill()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
|
||||||
Masking = true;
|
Masking = true;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
|
@ -243,6 +243,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
|
|
||||||
statusContainer.Add(new BeatmapSetOnlineStatusPill
|
statusContainer.Add(new BeatmapSetOnlineStatusPill
|
||||||
{
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
TextSize = 12,
|
TextSize = 12,
|
||||||
TextPadding = new MarginPadding { Horizontal = 10, Vertical = 5 },
|
TextPadding = new MarginPadding { Horizontal = 10, Vertical = 5 },
|
||||||
Status = SetInfo.OnlineInfo?.Status ?? BeatmapSetOnlineStatus.None,
|
Status = SetInfo.OnlineInfo?.Status ?? BeatmapSetOnlineStatus.None,
|
||||||
|
@ -257,6 +257,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
|||||||
|
|
||||||
statusContainer.Add(new BeatmapSetOnlineStatusPill
|
statusContainer.Add(new BeatmapSetOnlineStatusPill
|
||||||
{
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
TextSize = 12,
|
TextSize = 12,
|
||||||
TextPadding = new MarginPadding { Horizontal = 10, Vertical = 4 },
|
TextPadding = new MarginPadding { Horizontal = 10, Vertical = 4 },
|
||||||
Status = SetInfo.OnlineInfo?.Status ?? BeatmapSetOnlineStatus.None,
|
Status = SetInfo.OnlineInfo?.Status ?? BeatmapSetOnlineStatus.None,
|
||||||
|
@ -198,6 +198,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
{
|
{
|
||||||
onlineStatusPill = new BeatmapSetOnlineStatusPill
|
onlineStatusPill = new BeatmapSetOnlineStatusPill
|
||||||
{
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
TextSize = 14,
|
TextSize = 14,
|
||||||
|
@ -257,6 +257,7 @@ namespace osu.Game.Screens.Select
|
|||||||
},
|
},
|
||||||
StatusPill = new BeatmapSetOnlineStatusPill
|
StatusPill = new BeatmapSetOnlineStatusPill
|
||||||
{
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
Shear = -wedged_container_shear,
|
Shear = -wedged_container_shear,
|
||||||
|
@ -60,6 +60,7 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
{
|
{
|
||||||
new BeatmapSetOnlineStatusPill
|
new BeatmapSetOnlineStatusPill
|
||||||
{
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Margin = new MarginPadding { Right = 5 },
|
Margin = new MarginPadding { Right = 5 },
|
||||||
|
Reference in New Issue
Block a user