1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 18:47:27 +08:00

Remove convoluted autosize logic in MonthSection

This commit is contained in:
Andrei Zavatski 2021-05-18 22:30:36 +03:00
parent 24af86689f
commit d70d37b7f4

View File

@ -139,24 +139,23 @@ namespace osu.Game.Overlays.News.Sidebar
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
AutoSizeDuration = animation_duration;
AutoSizeEasing = Easing.Out;
InternalChild = content = new FillFlowContainer InternalChild = content = new FillFlowContainer
{ {
Margin = new MarginPadding { Top = 5 }, Margin = new MarginPadding { Top = 5 },
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 5) Spacing = new Vector2(0, 5),
Alpha = 0
}; };
} }
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
IsOpen.BindValueChanged(_ => updateState(), true); IsOpen.BindValueChanged(_ => updateState(), true);
// First state change should be instant.
FinishTransforms(true);
} }
private void updateState() private void updateState()
@ -176,22 +175,6 @@ namespace osu.Game.Overlays.News.Sidebar
content.FadeOut(animation_duration, Easing.OutQuint); content.FadeOut(animation_duration, Easing.OutQuint);
} }
} }
private bool autoSizeTransitionApplied;
// Workaround to allow the dropdown to be opened immediately since FinishTransforms doesn't work for AutoSize{Duration,Easing}.
protected override void UpdateAfterAutoSize()
{
base.UpdateAfterAutoSize();
if (!autoSizeTransitionApplied)
{
AutoSizeDuration = animation_duration;
AutoSizeEasing = Easing.OutQuint;
autoSizeTransitionApplied = true;
}
}
} }
} }
} }