1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 09:27:34 +08:00

Use scale instead of rotation in ChevronButton (used in top-right of comments section)

This commit is contained in:
Salman Ahmed 2024-07-08 08:48:07 +03:00
parent dc630ddc9d
commit 4c2ae07eba

View File

@ -24,6 +24,7 @@ namespace osu.Game.Overlays.Comments.Buttons
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(12),
Icon = FontAwesome.Solid.ChevronDown
};
}
@ -38,11 +39,12 @@ namespace osu.Game.Overlays.Comments.Buttons
base.LoadComplete();
Action = Expanded.Toggle;
Expanded.BindValueChanged(onExpandedChanged, true);
FinishTransforms(true);
}
private void onExpandedChanged(ValueChangedEvent<bool> expanded)
{
icon.Icon = expanded.NewValue ? FontAwesome.Solid.ChevronUp : FontAwesome.Solid.ChevronDown;
icon.ScaleTo(expanded.NewValue ? new Vector2(1f, -1f) : Vector2.One, 300, Easing.OutQuint);
}
}
}