mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 18:12:56 +08:00
Remove unnecessary field storage of origin reference
This commit is contained in:
parent
34a5b22b79
commit
7d88a19d7f
@ -20,17 +20,9 @@ namespace osu.Game.Skinning.Editor
|
|||||||
{
|
{
|
||||||
public class SkinSelectionHandler : SelectionHandler<ISkinnableDrawable>
|
public class SkinSelectionHandler : SelectionHandler<ISkinnableDrawable>
|
||||||
{
|
{
|
||||||
private Vector2? referenceOrigin;
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private SkinEditor skinEditor { get; set; }
|
private SkinEditor skinEditor { get; set; }
|
||||||
|
|
||||||
protected override void OnOperationEnded()
|
|
||||||
{
|
|
||||||
base.OnOperationEnded();
|
|
||||||
referenceOrigin = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool HandleRotation(float angle)
|
public override bool HandleRotation(float angle)
|
||||||
{
|
{
|
||||||
if (SelectedBlueprints.Count == 1)
|
if (SelectedBlueprints.Count == 1)
|
||||||
@ -42,13 +34,11 @@ namespace osu.Game.Skinning.Editor
|
|||||||
{
|
{
|
||||||
var selectionQuad = getSelectionQuad();
|
var selectionQuad = getSelectionQuad();
|
||||||
|
|
||||||
referenceOrigin ??= selectionQuad.Centre;
|
|
||||||
|
|
||||||
foreach (var b in SelectedBlueprints)
|
foreach (var b in SelectedBlueprints)
|
||||||
{
|
{
|
||||||
var drawableItem = (Drawable)b.Item;
|
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;
|
drawableItem.Rotation += angle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user