1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-14 06:27:19 +08:00

Bind using local bindables to avoid potentially event pollution

This commit is contained in:
Dean Herbert 2024-04-02 13:04:34 +08:00
parent 1adba68357
commit ed5dd5c8cd
No known key found for this signature in database

View File

@ -22,6 +22,9 @@ namespace osu.Game.Rulesets.Osu.Edit
private EditorToolButton rotateButton = null!;
private Bindable<bool> canRotatePlayfieldOrigin = null!;
private Bindable<bool> canRotateSelectionOrigin = null!;
public SelectionRotationHandler RotationHandler { get; init; } = null!;
public TransformToolboxGroup()
@ -52,8 +55,11 @@ namespace osu.Game.Rulesets.Osu.Edit
base.LoadComplete();
// aggregate two values into canRotate
RotationHandler.CanRotatePlayfieldOrigin.BindValueChanged(_ => updateCanRotateAggregate());
RotationHandler.CanRotateSelectionOrigin.BindValueChanged(_ => updateCanRotateAggregate());
canRotatePlayfieldOrigin = RotationHandler.CanRotatePlayfieldOrigin.GetBoundCopy();
canRotatePlayfieldOrigin.BindValueChanged(_ => updateCanRotateAggregate());
canRotateSelectionOrigin = RotationHandler.CanRotateSelectionOrigin.GetBoundCopy();
canRotateSelectionOrigin.BindValueChanged(_ => updateCanRotateAggregate());
void updateCanRotateAggregate()
{