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 SliderWithTextBoxInput<float> angleInput = null!;
|
||||||
private EditorRadioButtonCollection rotationOrigin = null!;
|
private EditorRadioButtonCollection rotationOrigin = null!;
|
||||||
|
|
||||||
|
private RadioButton selectionCentreButton = null!;
|
||||||
public PreciseRotationPopover(SelectionRotationHandler rotationHandler)
|
public PreciseRotationPopover(SelectionRotationHandler rotationHandler)
|
||||||
{
|
{
|
||||||
this.rotationHandler = rotationHandler;
|
this.rotationHandler = rotationHandler;
|
||||||
|
@ -59,7 +60,7 @@ private void load()
|
||||||
new RadioButton("Playfield centre",
|
new RadioButton("Playfield centre",
|
||||||
() => rotationInfo.Value = rotationInfo.Value with { Origin = RotationOrigin.PlayfieldCentre },
|
() => rotationInfo.Value = rotationInfo.Value with { Origin = RotationOrigin.PlayfieldCentre },
|
||||||
() => new SpriteIcon { Icon = FontAwesome.Regular.Square }),
|
() => new SpriteIcon { Icon = FontAwesome.Regular.Square }),
|
||||||
new RadioButton("Selection centre",
|
selectionCentreButton = new RadioButton("Selection centre",
|
||||||
() => rotationInfo.Value = rotationInfo.Value with { Origin = RotationOrigin.SelectionCentre },
|
() => rotationInfo.Value = rotationInfo.Value with { Origin = RotationOrigin.SelectionCentre },
|
||||||
() => new SpriteIcon { Icon = FontAwesome.Solid.VectorSquare })
|
() => 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 });
|
angleInput.Current.BindValueChanged(angle => rotationInfo.Value = rotationInfo.Value with { Degrees = angle.NewValue });
|
||||||
rotationOrigin.Items.First().Select();
|
rotationOrigin.Items.First().Select();
|
||||||
|
|
||||||
|
rotationHandler.CanRotateSelectionOrigin.BindValueChanged(e =>
|
||||||
|
{
|
||||||
|
selectionCentreButton.Selected.Disabled = !e.NewValue;
|
||||||
|
}, true);
|
||||||
|
|
||||||
rotationInfo.BindValueChanged(rotation =>
|
rotationInfo.BindValueChanged(rotation =>
|
||||||
{
|
{
|
||||||
rotationHandler.Update(rotation.NewValue.Degrees, rotation.NewValue.Origin == RotationOrigin.PlayfieldCentre ? OsuPlayfield.BASE_SIZE / 2 : null);
|
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)
|
if (!timing.NewValue)
|
||||||
setSelectTool();
|
setSelectTool();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
EditorBeatmap.HasTiming.BindValueChanged(hasTiming =>
|
||||||
|
{
|
||||||
|
foreach (var item in toolboxCollection.Items)
|
||||||
|
{
|
||||||
|
item.Selected.Disabled = !hasTiming.NewValue;
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
|
|
|
@ -76,8 +76,6 @@ protected override void LoadComplete()
|
||||||
Selected?.Invoke(Button);
|
Selected?.Invoke(Button);
|
||||||
};
|
};
|
||||||
|
|
||||||
editorBeatmap?.HasTiming.BindValueChanged(hasTiming => Button.Selected.Disabled = !hasTiming.NewValue, true);
|
|
||||||
|
|
||||||
Button.Selected.BindDisabledChanged(disabled => Enabled.Value = !disabled, true);
|
Button.Selected.BindDisabledChanged(disabled => Enabled.Value = !disabled, true);
|
||||||
updateSelectionState();
|
updateSelectionState();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue