Rename CanRotate property of SelectionRotationHandler to a more descriptive name

This commit is contained in:
Nguyên Minh Hồ 2024-01-25 12:09:39 +07:00
parent b272d34960
commit e1f8bc9692
6 changed files with 10 additions and 7 deletions

View File

@ -19,6 +19,7 @@ namespace osu.Game.Rulesets.Osu.Edit
{
public partial class OsuSelectionRotationHandler : SelectionRotationHandler
{
public BindableBool CanRotatePlayfieldOrigin { get; private set; } = new();
[Resolved]
private IEditorChangeHandler? changeHandler { get; set; }
@ -41,7 +42,8 @@ protected override void LoadComplete()
private void updateState()
{
var quad = GeometryUtils.GetSurroundingQuad(selectedMovableObjects);
CanRotate.Value = quad.Width > 0 || quad.Height > 0;
CanRotateSelectionOrigin.Value = quad.Width > 0 || quad.Height > 0;
CanRotatePlayfieldOrigin.Value = selectedItems.Any();
}
private OsuHitObject[]? objectsInRotation;

View File

@ -53,7 +53,7 @@ protected override void LoadComplete()
// 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.CanRotate);
canRotate.BindTo(RotationHandler.CanRotateSelectionOrigin);
canRotate.BindValueChanged(_ => rotateButton.Enabled.Value = canRotate.Value, true);
}

View File

@ -89,7 +89,7 @@ public TestSelectionRotationHandler(Func<Container> getTargetContainer)
{
this.getTargetContainer = getTargetContainer;
CanRotate.Value = true;
CanRotateSelectionOrigin.Value = true;
}
[CanBeNull]

View File

@ -41,7 +41,7 @@ protected override void LoadComplete()
private void updateState()
{
CanRotate.Value = selectedItems.Count > 0;
CanRotateSelectionOrigin.Value = selectedItems.Count > 0;
}
private Drawable[]? objectsInRotation;

View File

@ -174,7 +174,7 @@ public string Text
private void load()
{
if (rotationHandler != null)
canRotate.BindTo(rotationHandler.CanRotate);
canRotate.BindTo(rotationHandler.CanRotateSelectionOrigin);
canRotate.BindValueChanged(_ => recreate(), true);
}

View File

@ -13,9 +13,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
public partial class SelectionRotationHandler : Component
{
/// <summary>
/// Whether the rotation can currently be performed.
/// Whether rotation anchored by the selection origin can currently be performed.
/// This is in constrast to rotation anchored by the entire field.
/// </summary>
public Bindable<bool> CanRotate { get; private set; } = new BindableBool();
public Bindable<bool> CanRotateSelectionOrigin { get; private set; } = new BindableBool();
/// <summary>
/// Performs a single, instant, atomic rotation operation.