1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 00:02:54 +08:00

Remove unnecessary field storage of origin reference

This commit is contained in:
Dean Herbert 2021-05-22 21:03:40 +09:00
parent 34a5b22b79
commit 7d88a19d7f

View File

@ -20,17 +20,9 @@ namespace osu.Game.Skinning.Editor
{
public class SkinSelectionHandler : SelectionHandler<ISkinnableDrawable>
{
private Vector2? referenceOrigin;
[Resolved]
private SkinEditor skinEditor { get; set; }
protected override void OnOperationEnded()
{
base.OnOperationEnded();
referenceOrigin = null;
}
public override bool HandleRotation(float angle)
{
if (SelectedBlueprints.Count == 1)
@ -42,13 +34,11 @@ namespace osu.Game.Skinning.Editor
{
var selectionQuad = getSelectionQuad();
referenceOrigin ??= selectionQuad.Centre;
foreach (var b in SelectedBlueprints)
{
var drawableItem = (Drawable)b.Item;
drawableItem.Position = drawableItem.Parent.ToLocalSpace(RotatePointAroundOrigin(b.ScreenSpaceSelectionPoint, referenceOrigin.Value, angle)) - drawableItem.AnchorPosition;
drawableItem.Position = drawableItem.Parent.ToLocalSpace(RotatePointAroundOrigin(b.ScreenSpaceSelectionPoint, selectionQuad.Centre, angle)) - drawableItem.AnchorPosition;
drawableItem.Rotation += angle;
}
}