mirror of
https://github.com/ppy/osu.git
synced 2026-06-07 06:23:39 +08:00
Fix status pill animating from zero height
This commit is contained in:
@@ -28,7 +28,6 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
||||
Spacing = new Vector2(0, 10),
|
||||
ChildrenEnumerable = Enum.GetValues(typeof(BeatmapOnlineStatus)).Cast<BeatmapOnlineStatus>().Select(status => new BeatmapSetOnlineStatusPill
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Status = status
|
||||
|
||||
@@ -19,10 +19,6 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
{
|
||||
public partial class BeatmapSetOnlineStatusPill : CircularContainer, IHasTooltip
|
||||
{
|
||||
private const double animation_duration = 400;
|
||||
|
||||
private BeatmapOnlineStatus status;
|
||||
|
||||
public BeatmapOnlineStatus Status
|
||||
{
|
||||
get => status;
|
||||
@@ -34,30 +30,27 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
status = value;
|
||||
|
||||
if (IsLoaded)
|
||||
{
|
||||
AutoSizeDuration = (float)animation_duration;
|
||||
AutoSizeEasing = Easing.OutQuint;
|
||||
|
||||
updateState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private BeatmapOnlineStatus status;
|
||||
|
||||
public float TextSize
|
||||
{
|
||||
get => statusText.Font.Size;
|
||||
set => statusText.Font = statusText.Font.With(size: value);
|
||||
init => statusText.Font = statusText.Font.With(size: value);
|
||||
}
|
||||
|
||||
public MarginPadding TextPadding
|
||||
{
|
||||
get => statusText.Padding;
|
||||
set => statusText.Padding = value;
|
||||
init => statusText.Padding = value;
|
||||
}
|
||||
|
||||
private readonly OsuSpriteText statusText;
|
||||
private readonly Box background;
|
||||
|
||||
private const double animation_duration = 400;
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; } = null!;
|
||||
|
||||
@@ -66,6 +59,7 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
|
||||
public BeatmapSetOnlineStatusPill()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Masking = true;
|
||||
|
||||
Alpha = 0;
|
||||
@@ -105,6 +99,14 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
return;
|
||||
}
|
||||
|
||||
// Only animate resizing if we already have a size.
|
||||
// This avoids animating height from zero.
|
||||
if (Width > 0)
|
||||
{
|
||||
AutoSizeDuration = (float)animation_duration;
|
||||
AutoSizeEasing = Easing.OutQuint;
|
||||
}
|
||||
|
||||
this.FadeIn(animation_duration, Easing.OutQuint);
|
||||
|
||||
Color4 statusTextColour;
|
||||
|
||||
@@ -30,7 +30,6 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
||||
{
|
||||
new BeatmapSetOnlineStatusPill
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Status = beatmapSet.Status,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
|
||||
@@ -177,7 +177,6 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
onlineStatusPill = new BeatmapSetOnlineStatusPill
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
TextSize = 14,
|
||||
|
||||
@@ -263,7 +263,6 @@ namespace osu.Game.Screens.Select
|
||||
},
|
||||
new BeatmapSetOnlineStatusPill
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Shear = -wedged_container_shear,
|
||||
|
||||
@@ -77,7 +77,6 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
},
|
||||
new BeatmapSetOnlineStatusPill
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
TextSize = 11,
|
||||
|
||||
@@ -97,7 +97,6 @@ namespace osu.Game.Screens.SelectV2
|
||||
},
|
||||
statusPill = new BeatmapSetOnlineStatusPill
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
TextSize = 11,
|
||||
|
||||
@@ -117,7 +117,6 @@ namespace osu.Game.Screens.SelectV2
|
||||
},
|
||||
statusPill = new BeatmapSetOnlineStatusPill
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
TextSize = 11,
|
||||
|
||||
Reference in New Issue
Block a user