1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 03:13:21 +08:00

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 partial class OsuSelectionRotationHandler : SelectionRotationHandler
{ {
public BindableBool CanRotatePlayfieldOrigin { get; private set; } = new();
[Resolved] [Resolved]
private IEditorChangeHandler? changeHandler { get; set; } private IEditorChangeHandler? changeHandler { get; set; }
@ -41,7 +42,8 @@ namespace osu.Game.Rulesets.Osu.Edit
private void updateState() private void updateState()
{ {
var quad = GeometryUtils.GetSurroundingQuad(selectedMovableObjects); 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; private OsuHitObject[]? objectsInRotation;

View File

@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Osu.Edit
// bindings to `Enabled` on the buttons are decoupled on purpose // 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. // 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); canRotate.BindValueChanged(_ => rotateButton.Enabled.Value = canRotate.Value, true);
} }

View File

@ -89,7 +89,7 @@ namespace osu.Game.Tests.Visual.Editing
{ {
this.getTargetContainer = getTargetContainer; this.getTargetContainer = getTargetContainer;
CanRotate.Value = true; CanRotateSelectionOrigin.Value = true;
} }
[CanBeNull] [CanBeNull]

View File

@ -41,7 +41,7 @@ namespace osu.Game.Overlays.SkinEditor
private void updateState() private void updateState()
{ {
CanRotate.Value = selectedItems.Count > 0; CanRotateSelectionOrigin.Value = selectedItems.Count > 0;
} }
private Drawable[]? objectsInRotation; private Drawable[]? objectsInRotation;

View File

@ -174,7 +174,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
private void load() private void load()
{ {
if (rotationHandler != null) if (rotationHandler != null)
canRotate.BindTo(rotationHandler.CanRotate); canRotate.BindTo(rotationHandler.CanRotateSelectionOrigin);
canRotate.BindValueChanged(_ => recreate(), true); canRotate.BindValueChanged(_ => recreate(), true);
} }

View File

@ -13,9 +13,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
public partial class SelectionRotationHandler : Component public partial class SelectionRotationHandler : Component
{ {
/// <summary> /// <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> /// </summary>
public Bindable<bool> CanRotate { get; private set; } = new BindableBool(); public Bindable<bool> CanRotateSelectionOrigin { get; private set; } = new BindableBool();
/// <summary> /// <summary>
/// Performs a single, instant, atomic rotation operation. /// Performs a single, instant, atomic rotation operation.