mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 13:03:21 +08:00
Aggregate two CanRotate bindable for enabling the Rotate button
This commit is contained in:
parent
6f782266b5
commit
b445e27ad6
@ -51,9 +51,17 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
// aggregate two values into canRotate
|
||||
RotationHandler.CanRotatePlayfieldOrigin.BindValueChanged(_ => updateCanRotateAggregate());
|
||||
RotationHandler.CanRotateSelectionOrigin.BindValueChanged(_ => updateCanRotateAggregate());
|
||||
|
||||
void updateCanRotateAggregate()
|
||||
{
|
||||
canRotate.Value = RotationHandler.CanRotatePlayfieldOrigin.Value || RotationHandler.CanRotateSelectionOrigin.Value;
|
||||
}
|
||||
|
||||
// bindings to `Enabled` on the buttons are decoupled on purpose
|
||||
// due to the weird `OsuButton` behaviour of resetting `Enabled` to `false` when `Action` is set.
|
||||
canRotate.BindTo(RotationHandler.CanRotatePlayfieldOrigin);
|
||||
canRotate.BindValueChanged(_ => rotateButton.Enabled.Value = canRotate.Value, true);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user