1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-23 14:33:22 +08:00

Remove fadeContainer and adjust fade condition

This commit is contained in:
Andrei Zavatski 2020-02-27 15:33:01 +03:00
parent a8c31c31ad
commit f9aa6b9c07

View File

@ -26,7 +26,6 @@ namespace osu.Game.Overlays.Changelog
private readonly APIUpdateStream stream; private readonly APIUpdateStream stream;
private Container fadeContainer;
private FillFlowContainer<SpriteText> text; private FillFlowContainer<SpriteText> text;
private ExpandingBar expandingBar; private ExpandingBar expandingBar;
@ -43,16 +42,10 @@ namespace osu.Game.Overlays.Changelog
Padding = new MarginPadding(5); Padding = new MarginPadding(5);
AddRange(new Drawable[] AddRange(new Drawable[]
{
fadeContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{ {
text = new FillFlowContainer<SpriteText> text = new FillFlowContainer<SpriteText>
{ {
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.Both,
RelativeSizeAxes = Axes.Y,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Margin = new MarginPadding { Top = 6 }, Margin = new MarginPadding { Top = 6 },
Children = new[] Children = new[]
@ -83,8 +76,6 @@ namespace osu.Game.Overlays.Changelog
CollapsedSize = 2, CollapsedSize = 2,
IsCollapsed = true IsCollapsed = true
}, },
}
},
new HoverClickSounds() new HoverClickSounds()
}); });
@ -112,21 +103,23 @@ namespace osu.Game.Overlays.Changelog
// Expand based on the local state // Expand based on the local state
bool shouldExpand = Active.Value || IsHovered; bool shouldExpand = Active.Value || IsHovered;
bool allHighlighted = SelectedTab.Value == null && !externalDimRequested;
// Expand based on whether no build is selected and the badge area is hovered // Expand based on whether no build is selected and the badge area is hovered
shouldExpand |= SelectedTab.Value == null && !externalDimRequested; shouldExpand |= allHighlighted;
if (shouldExpand) if (shouldExpand)
{ {
expandingBar.Expand(); expandingBar.Expand();
fadeContainer.FadeTo(1, transition_duration); expandingBar.FadeTo(1, transition_duration, Easing.OutQuint);
} }
else else
{ {
expandingBar.Collapse(); expandingBar.Collapse();
fadeContainer.FadeTo(0.5f, transition_duration); expandingBar.FadeTo(0.5f, transition_duration, Easing.OutQuint);
} }
text.FadeTo(externalDimRequested && !IsHovered ? 0.5f : 1, transition_duration); text.FadeTo(IsHovered || (Active.Value && !externalDimRequested) || allHighlighted ? 1 : 0.5f, transition_duration, Easing.OutQuint);
} }
private bool externalDimRequested; private bool externalDimRequested;