mirror of https://github.com/ppy/osu
Split editor toolbox radio button disabling logic from EditorRadioButton, then add disabling logic for rotate popover
This commit is contained in:
parent
601ba9f194
commit
500bed0121
|
@ -24,6 +24,7 @@ public partial class PreciseRotationPopover : OsuPopover
|
|||
private SliderWithTextBoxInput<float> angleInput = null!;
|
||||
private EditorRadioButtonCollection rotationOrigin = null!;
|
||||
|
||||
private RadioButton selectionCentreButton = null!;
|
||||
public PreciseRotationPopover(SelectionRotationHandler rotationHandler)
|
||||
{
|
||||
this.rotationHandler = rotationHandler;
|
||||
|
@ -59,7 +60,7 @@ private void load()
|
|||
new RadioButton("Playfield centre",
|
||||
() => rotationInfo.Value = rotationInfo.Value with { Origin = RotationOrigin.PlayfieldCentre },
|
||||
() => new SpriteIcon { Icon = FontAwesome.Regular.Square }),
|
||||
new RadioButton("Selection centre",
|
||||
selectionCentreButton = new RadioButton("Selection centre",
|
||||
() => rotationInfo.Value = rotationInfo.Value with { Origin = RotationOrigin.SelectionCentre },
|
||||
() => new SpriteIcon { Icon = FontAwesome.Solid.VectorSquare })
|
||||
}
|
||||
|
@ -76,6 +77,11 @@ protected override void LoadComplete()
|
|||
angleInput.Current.BindValueChanged(angle => rotationInfo.Value = rotationInfo.Value with { Degrees = angle.NewValue });
|
||||
rotationOrigin.Items.First().Select();
|
||||
|
||||
rotationHandler.CanRotateSelectionOrigin.BindValueChanged(e =>
|
||||
{
|
||||
selectionCentreButton.Selected.Disabled = !e.NewValue;
|
||||
}, true);
|
||||
|
||||
rotationInfo.BindValueChanged(rotation =>
|
||||
{
|
||||
rotationHandler.Update(rotation.NewValue.Degrees, rotation.NewValue.Origin == RotationOrigin.PlayfieldCentre ? OsuPlayfield.BASE_SIZE / 2 : null);
|
||||
|
|
|
@ -244,6 +244,14 @@ protected override void LoadComplete()
|
|||
if (!timing.NewValue)
|
||||
setSelectTool();
|
||||
});
|
||||
|
||||
EditorBeatmap.HasTiming.BindValueChanged(hasTiming =>
|
||||
{
|
||||
foreach (var item in toolboxCollection.Items)
|
||||
{
|
||||
item.Selected.Disabled = !hasTiming.NewValue;
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
|
|
@ -76,8 +76,6 @@ protected override void LoadComplete()
|
|||
Selected?.Invoke(Button);
|
||||
};
|
||||
|
||||
editorBeatmap?.HasTiming.BindValueChanged(hasTiming => Button.Selected.Disabled = !hasTiming.NewValue, true);
|
||||
|
||||
Button.Selected.BindDisabledChanged(disabled => Enabled.Value = !disabled, true);
|
||||
updateSelectionState();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue