mirror of
https://github.com/ppy/osu
synced 2025-02-18 11:26:57 +00:00
Tidy up logic to correctly expire in cases where expiry is expected
This commit is contained in:
parent
0d8d0d6852
commit
ca0242debe
@ -178,24 +178,29 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
var lastContent = currentContent;
|
var lastContent = currentContent;
|
||||||
|
|
||||||
// "not found" placeholder is reused, only remove without disposing through expire.
|
if (lastContent != null)
|
||||||
if (lastContent == notFoundContent)
|
|
||||||
lastContent.FadeOut(100, Easing.OutQuint).Schedule(() => panelTarget.Remove(lastContent));
|
|
||||||
else if (lastContent != null)
|
|
||||||
{
|
{
|
||||||
lastContent.FadeOut(100, Easing.OutQuint).Expire();
|
var transform = lastContent.FadeOut(100, Easing.OutQuint);
|
||||||
|
|
||||||
|
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.
|
// 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.
|
// 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.
|
// 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.
|
// 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));
|
lastContent.Delay(25).Schedule(() => lastContent.BypassAutoSizeAxes = Axes.Y).Then().Schedule(() => lastContent.Expire());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!content.IsAlive)
|
if (!content.IsAlive)
|
||||||
panelTarget.Add(content);
|
panelTarget.Add(content);
|
||||||
content.FadeInFromZero(200, Easing.OutQuint);
|
|
||||||
|
|
||||||
|
content.FadeInFromZero(200, Easing.OutQuint);
|
||||||
currentContent = content;
|
currentContent = content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user