mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 14:53:21 +08:00
Remove FixedWidth
and add AutoSizeAxes
specs to all usages
This commit is contained in:
parent
feedd53a53
commit
6802e9ec10
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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[]
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -198,6 +198,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
onlineStatusPill = new BeatmapSetOnlineStatusPill
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
TextSize = 14,
|
||||
|
@ -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,
|
||||
|
@ -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 },
|
||||
|
Loading…
Reference in New Issue
Block a user