1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 07:33:20 +08:00

Change rotate tool button to be enabled on single circle.

Inject osu ruleset specific rotate handler instead of generic handler.
This commit is contained in:
Nguyên Minh Hồ 2024-01-25 12:16:35 +07:00
parent e1f8bc9692
commit 601ba9f194
3 changed files with 7 additions and 5 deletions

View File

@ -101,7 +101,10 @@ namespace osu.Game.Rulesets.Osu.Edit
RightToolbox.AddRange(new EditorToolboxGroup[]
{
new TransformToolboxGroup { RotationHandler = BlueprintContainer.SelectionHandler.RotationHandler, },
new TransformToolboxGroup
{
RotationHandler = (OsuSelectionRotationHandler)BlueprintContainer.SelectionHandler.RotationHandler,
},
FreehandlSliderToolboxGroup
}
);

View File

@ -164,7 +164,7 @@ namespace osu.Game.Rulesets.Osu.Edit
if ((reference & Anchor.y0) > 0) scale.Y = -scale.Y;
}
public override SelectionRotationHandler CreateRotationHandler() => new OsuSelectionRotationHandler();
public override OsuSelectionRotationHandler CreateRotationHandler() => new OsuSelectionRotationHandler();
private void scaleSlider(Slider slider, Vector2 scale)
{

View File

@ -11,7 +11,6 @@ using osu.Framework.Input.Events;
using osu.Game.Input.Bindings;
using osu.Game.Rulesets.Edit;
using osu.Game.Screens.Edit.Components;
using osu.Game.Screens.Edit.Compose.Components;
using osuTK;
namespace osu.Game.Rulesets.Osu.Edit
@ -22,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Edit
private EditorToolButton rotateButton = null!;
public SelectionRotationHandler RotationHandler { get; init; } = null!;
public OsuSelectionRotationHandler RotationHandler { get; init; } = null!;
public TransformToolboxGroup()
: base("transform")
@ -53,7 +52,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.CanRotateSelectionOrigin);
canRotate.BindTo(RotationHandler.CanRotatePlayfieldOrigin);
canRotate.BindValueChanged(_ => rotateButton.Enabled.Value = canRotate.Value, true);
}