mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 23:03:21 +08:00
Remove auto-expansion of individual toolbox groups when parent expanding container expands
This commit is contained in:
parent
09139ef9f4
commit
949e30c4b4
@ -135,60 +135,31 @@ namespace osu.Game.Overlays
|
||||
headerText.FadeTo(headerText.DrawWidth < DrawWidth ? 1 : 0, 150, Easing.OutQuint);
|
||||
}
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private IExpandingContainer expandingContainer { get; set; }
|
||||
|
||||
private bool expandedByContainer;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
expandingContainer?.Expanded.BindValueChanged(containerExpanded =>
|
||||
{
|
||||
if (containerExpanded.NewValue && !Expanded.Value)
|
||||
{
|
||||
Expanded.Value = true;
|
||||
expandedByContainer = true;
|
||||
}
|
||||
else if (!containerExpanded.NewValue && expandedByContainer)
|
||||
{
|
||||
Expanded.Value = false;
|
||||
expandedByContainer = false;
|
||||
}
|
||||
|
||||
updateActiveState();
|
||||
}, true);
|
||||
|
||||
Expanded.BindValueChanged(v =>
|
||||
{
|
||||
// clearing transforms can break autosizing, see: https://github.com/ppy/osu-framework/issues/5064
|
||||
if (v.NewValue != v.OldValue)
|
||||
content.ClearTransforms();
|
||||
|
||||
if (v.NewValue)
|
||||
content.AutoSizeAxes = Axes.Y;
|
||||
else
|
||||
{
|
||||
content.AutoSizeAxes = Axes.None;
|
||||
content.ResizeHeightTo(0, transition_duration, Easing.OutQuint);
|
||||
}
|
||||
|
||||
button.FadeColour(Expanded.Value ? expandedColour : Color4.White, 200, Easing.InOutQuint);
|
||||
Scheduler.AddOnce(updateExpandedState);
|
||||
}, true);
|
||||
|
||||
this.Delay(600).Schedule(updateActiveState);
|
||||
this.Delay(600).Schedule(updateFadeState);
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
updateActiveState();
|
||||
updateFadeState();
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
updateActiveState();
|
||||
updateFadeState();
|
||||
base.OnHoverLost(e);
|
||||
}
|
||||
|
||||
@ -198,9 +169,22 @@ namespace osu.Game.Overlays
|
||||
expandedColour = colours.Yellow;
|
||||
}
|
||||
|
||||
private void updateActiveState()
|
||||
private void updateExpandedState()
|
||||
{
|
||||
this.FadeTo(IsHovered || expandingContainer?.Expanded.Value == true ? 1 : inactive_alpha, fade_duration, Easing.OutQuint);
|
||||
if (Expanded.Value)
|
||||
content.AutoSizeAxes = Axes.Y;
|
||||
else
|
||||
{
|
||||
content.AutoSizeAxes = Axes.None;
|
||||
content.ResizeHeightTo(0, transition_duration, Easing.OutQuint);
|
||||
}
|
||||
|
||||
button.FadeColour(Expanded.Value ? expandedColour : Color4.White, 200, Easing.InOutQuint);
|
||||
}
|
||||
|
||||
private void updateFadeState()
|
||||
{
|
||||
this.FadeTo(IsHovered ? 1 : inactive_alpha, fade_duration, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
Loading…
Reference in New Issue
Block a user