Merge pull request #11604 from frenzibyte/fix-beatmap-listing

Fix beatmap listing placeholder potentially getting disposed
This commit is contained in:
Dean Herbert 2021-01-26 17:56:19 +09:00 committed by GitHub
commit fcf4d4ee18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -180,19 +180,27 @@ namespace osu.Game.Overlays
if (lastContent != null)
{
lastContent.FadeOut(100, Easing.OutQuint).Expire();
var transform = lastContent.FadeOut(100, Easing.OutQuint);
// 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));
if (lastContent == notFoundContent)
{
// not found display may be used multiple times, so don't expire/dispose it.
transform.Schedule(() => panelTarget.Remove(lastContent));
}
else
{
// 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(() => lastContent.Expire());
}
}
if (!content.IsAlive)
panelTarget.Add(content);
content.FadeIn(200, Easing.OutQuint);
content.FadeInFromZero(200, Easing.OutQuint);
currentContent = content;
}