mirror of
https://github.com/ppy/osu.git
synced 2025-01-19 04:22:55 +08:00
Rotate popover rotates around grid center
This commit is contained in:
parent
e803b0215f
commit
078fe5a78c
@ -104,7 +104,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
RightToolbox.AddRange(new EditorToolboxGroup[]
|
||||
{
|
||||
OsuGridToolboxGroup,
|
||||
new TransformToolboxGroup { RotationHandler = BlueprintContainer.SelectionHandler.RotationHandler, },
|
||||
new TransformToolboxGroup { RotationHandler = BlueprintContainer.SelectionHandler.RotationHandler, GridToolbox = OsuGridToolboxGroup },
|
||||
FreehandlSliderToolboxGroup
|
||||
}
|
||||
);
|
||||
|
@ -8,7 +8,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
using osu.Game.Rulesets.Osu.UI;
|
||||
using osu.Game.Screens.Edit.Components.RadioButtons;
|
||||
using osu.Game.Screens.Edit.Compose.Components;
|
||||
using osuTK;
|
||||
@ -19,14 +18,17 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
{
|
||||
private readonly SelectionRotationHandler rotationHandler;
|
||||
|
||||
private readonly OsuGridToolboxGroup gridToolbox;
|
||||
|
||||
private readonly Bindable<PreciseRotationInfo> rotationInfo = new Bindable<PreciseRotationInfo>(new PreciseRotationInfo(0, RotationOrigin.PlayfieldCentre));
|
||||
|
||||
private SliderWithTextBoxInput<float> angleInput = null!;
|
||||
private EditorRadioButtonCollection rotationOrigin = null!;
|
||||
|
||||
public PreciseRotationPopover(SelectionRotationHandler rotationHandler)
|
||||
public PreciseRotationPopover(SelectionRotationHandler rotationHandler, OsuGridToolboxGroup gridToolbox)
|
||||
{
|
||||
this.rotationHandler = rotationHandler;
|
||||
this.gridToolbox = gridToolbox;
|
||||
|
||||
AllowableAnchors = new[] { Anchor.CentreLeft, Anchor.CentreRight };
|
||||
}
|
||||
@ -78,7 +80,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
|
||||
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 ? gridToolbox.StartPosition.Value : null);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,8 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
|
||||
public SelectionRotationHandler RotationHandler { get; init; } = null!;
|
||||
|
||||
public OsuGridToolboxGroup GridToolbox { get; init; } = null!;
|
||||
|
||||
public TransformToolboxGroup()
|
||||
: base("transform")
|
||||
{
|
||||
@ -41,7 +43,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
{
|
||||
rotateButton = new EditorToolButton("Rotate",
|
||||
() => new SpriteIcon { Icon = FontAwesome.Solid.Undo },
|
||||
() => new PreciseRotationPopover(RotationHandler)),
|
||||
() => new PreciseRotationPopover(RotationHandler, GridToolbox)),
|
||||
// TODO: scale
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user