1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 15:43:22 +08:00

Apply alternative way of fixing

This commit is contained in:
Salman Ahmed 2021-01-26 01:03:29 +03:00
parent 75d6dbdbb7
commit 0d8d0d6852

View File

@ -178,21 +178,18 @@ namespace osu.Game.Overlays
var lastContent = currentContent;
if (lastContent != null)
// "not found" placeholder is reused, only remove without disposing through expire.
if (lastContent == notFoundContent)
lastContent.FadeOut(100, Easing.OutQuint).Schedule(() => panelTarget.Remove(lastContent));
else if (lastContent != null)
{
lastContent.FadeOut(100, Easing.OutQuint);
lastContent.FadeOut(100, Easing.OutQuint).Expire();
// Consider the case when the new content is smaller than the last content.
// If the auto-size computation is delayed until fade out completes, the background remain high for too long making the resulting transition to the smaller height look weird.
// At the same time, if the last content's height is bypassed immediately, there is a period where the new content is at Alpha = 0 when the auto-sized height will be 0.
// To resolve both of these issues, the bypass is delayed until a point when the content transitions (fade-in and fade-out) overlap and it looks good to do so.
lastContent.Delay(25).Schedule(() => lastContent.BypassAutoSizeAxes = Axes.Y).Then().Schedule(() =>
{
panelTarget.Remove(lastContent);
// the content may be reused again (e.g. notFoundContent), clear Y-axis bypass for displaying back properly.
lastContent.BypassAutoSizeAxes = Axes.None;
});
lastContent.Delay(25).Schedule(() => lastContent.BypassAutoSizeAxes = Axes.Y).Then().Schedule(() => panelTarget.Remove(lastContent));
}
if (!content.IsAlive)