mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 15:22:55 +08:00
Merge pull request #22034 from frenzibyte/fix-toolbox-group-animation
Fix settings toolbox group not animating on expansion
This commit is contained in:
commit
0ab1418aa6
@ -55,6 +55,16 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestDisplay()
|
||||||
|
{
|
||||||
|
AddRepeatStep("toggle expanded state", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(group.ChildrenOfType<IconButton>().Single());
|
||||||
|
InputManager.Click(MouseButton.Left);
|
||||||
|
}, 5);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestClickExpandButtonMultipleTimes()
|
public void TestClickExpandButtonMultipleTimes()
|
||||||
{
|
{
|
||||||
|
@ -126,7 +126,8 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
Expanded.BindValueChanged(updateExpandedState, true);
|
Expanded.BindValueChanged(_ => updateExpandedState(true));
|
||||||
|
updateExpandedState(false);
|
||||||
|
|
||||||
this.Delay(600).Schedule(updateFadeState);
|
this.Delay(600).Schedule(updateFadeState);
|
||||||
}
|
}
|
||||||
@ -161,21 +162,25 @@ namespace osu.Game.Overlays
|
|||||||
return base.OnInvalidate(invalidation, source);
|
return base.OnInvalidate(invalidation, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateExpandedState(ValueChangedEvent<bool> expanded)
|
private void updateExpandedState(bool animate)
|
||||||
{
|
{
|
||||||
// clearing transforms is necessary to avoid a previous height transform
|
// clearing transforms is necessary to avoid a previous height transform
|
||||||
// potentially continuing to get processed while content has changed to autosize.
|
// potentially continuing to get processed while content has changed to autosize.
|
||||||
content.ClearTransforms();
|
content.ClearTransforms();
|
||||||
|
|
||||||
if (expanded.NewValue)
|
if (Expanded.Value)
|
||||||
|
{
|
||||||
content.AutoSizeAxes = Axes.Y;
|
content.AutoSizeAxes = Axes.Y;
|
||||||
|
content.AutoSizeDuration = animate ? transition_duration : 0;
|
||||||
|
content.AutoSizeEasing = Easing.OutQuint;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
content.AutoSizeAxes = Axes.None;
|
content.AutoSizeAxes = Axes.None;
|
||||||
content.ResizeHeightTo(0, transition_duration, Easing.OutQuint);
|
content.ResizeHeightTo(0, animate ? transition_duration : 0, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
headerContent.FadeColour(expanded.NewValue ? Color4.White : OsuColour.Gray(0.5f), 200, Easing.OutQuint);
|
headerContent.FadeColour(Expanded.Value ? Color4.White : OsuColour.Gray(0.5f), 200, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFadeState()
|
private void updateFadeState()
|
||||||
|
Loading…
Reference in New Issue
Block a user