From e1f8bc96924b104665782aacfd223eb2ba9dafed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=C3=AAn=20Minh=20H=E1=BB=93?= Date: Thu, 25 Jan 2024 12:09:39 +0700 Subject: [PATCH] Rename CanRotate property of SelectionRotationHandler to a more descriptive name --- osu.Game.Rulesets.Osu/Edit/OsuSelectionRotationHandler.cs | 4 +++- osu.Game.Rulesets.Osu/Edit/TransformToolboxGroup.cs | 2 +- osu.Game.Tests/Visual/Editing/TestSceneComposeSelectBox.cs | 2 +- osu.Game/Overlays/SkinEditor/SkinSelectionRotationHandler.cs | 2 +- osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs | 2 +- .../Edit/Compose/Components/SelectionRotationHandler.cs | 5 +++-- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/OsuSelectionRotationHandler.cs b/osu.Game.Rulesets.Osu/Edit/OsuSelectionRotationHandler.cs index 21fb8a67de..0ce78e4f61 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuSelectionRotationHandler.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuSelectionRotationHandler.cs @@ -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 @@ namespace osu.Game.Rulesets.Osu.Edit 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; diff --git a/osu.Game.Rulesets.Osu/Edit/TransformToolboxGroup.cs b/osu.Game.Rulesets.Osu/Edit/TransformToolboxGroup.cs index 3da9f5b69b..291c79e613 100644 --- a/osu.Game.Rulesets.Osu/Edit/TransformToolboxGroup.cs +++ b/osu.Game.Rulesets.Osu/Edit/TransformToolboxGroup.cs @@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Osu.Edit // 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); } diff --git a/osu.Game.Tests/Visual/Editing/TestSceneComposeSelectBox.cs b/osu.Game.Tests/Visual/Editing/TestSceneComposeSelectBox.cs index f6637d0e80..8e4f4a1cfd 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneComposeSelectBox.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneComposeSelectBox.cs @@ -89,7 +89,7 @@ namespace osu.Game.Tests.Visual.Editing { this.getTargetContainer = getTargetContainer; - CanRotate.Value = true; + CanRotateSelectionOrigin.Value = true; } [CanBeNull] diff --git a/osu.Game/Overlays/SkinEditor/SkinSelectionRotationHandler.cs b/osu.Game/Overlays/SkinEditor/SkinSelectionRotationHandler.cs index 60f69000a2..7ecf116b68 100644 --- a/osu.Game/Overlays/SkinEditor/SkinSelectionRotationHandler.cs +++ b/osu.Game/Overlays/SkinEditor/SkinSelectionRotationHandler.cs @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.SkinEditor private void updateState() { - CanRotate.Value = selectedItems.Count > 0; + CanRotateSelectionOrigin.Value = selectedItems.Count > 0; } private Drawable[]? objectsInRotation; diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs index 0b16941bc4..85ea7364e8 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs @@ -174,7 +174,7 @@ namespace osu.Game.Screens.Edit.Compose.Components private void load() { if (rotationHandler != null) - canRotate.BindTo(rotationHandler.CanRotate); + canRotate.BindTo(rotationHandler.CanRotateSelectionOrigin); canRotate.BindValueChanged(_ => recreate(), true); } diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionRotationHandler.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionRotationHandler.cs index 5faa4a108d..749e1aab17 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionRotationHandler.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionRotationHandler.cs @@ -13,9 +13,10 @@ namespace osu.Game.Screens.Edit.Compose.Components public partial class SelectionRotationHandler : Component { /// - /// 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. /// - public Bindable CanRotate { get; private set; } = new BindableBool(); + public Bindable CanRotateSelectionOrigin { get; private set; } = new BindableBool(); /// /// Performs a single, instant, atomic rotation operation.