mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 17:33:02 +08:00
Merge pull request #12882 from peppy/fix-flip-logic-discrepancy
Fix skin editor flip logic behaving slightly incorrectly
This commit is contained in:
commit
4828376439
@ -38,7 +38,9 @@ namespace osu.Game.Skinning.Editor
|
|||||||
{
|
{
|
||||||
var drawableItem = (Drawable)b.Item;
|
var drawableItem = (Drawable)b.Item;
|
||||||
|
|
||||||
drawableItem.Position = drawableItem.Parent.ToLocalSpace(RotatePointAroundOrigin(b.ScreenSpaceSelectionPoint, selectionQuad.Centre, angle)) - drawableItem.AnchorPosition;
|
var rotatedPosition = RotatePointAroundOrigin(b.ScreenSpaceSelectionPoint, selectionQuad.Centre, angle);
|
||||||
|
updateDrawablePosition(drawableItem, rotatedPosition);
|
||||||
|
|
||||||
drawableItem.Rotation += angle;
|
drawableItem.Rotation += angle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,7 +113,7 @@ namespace osu.Game.Skinning.Editor
|
|||||||
adjustedRect.TopLeft.Y + adjustedRect.Height * relativePositionInOriginal.Y
|
adjustedRect.TopLeft.Y + adjustedRect.Height * relativePositionInOriginal.Y
|
||||||
);
|
);
|
||||||
|
|
||||||
drawableItem.Position = drawableItem.Parent.ToLocalSpace(newPositionInAdjusted) - drawableItem.AnchorPosition;
|
updateDrawablePosition(drawableItem, newPositionInAdjusted);
|
||||||
drawableItem.Scale *= scaledDelta;
|
drawableItem.Scale *= scaledDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,14 +122,15 @@ namespace osu.Game.Skinning.Editor
|
|||||||
|
|
||||||
public override bool HandleFlip(Direction direction)
|
public override bool HandleFlip(Direction direction)
|
||||||
{
|
{
|
||||||
var selectionQuad = GetSurroundingQuad(SelectedBlueprints.Select(b => b.ScreenSpaceSelectionPoint));
|
var selectionQuad = getSelectionQuad();
|
||||||
|
|
||||||
foreach (var b in SelectedBlueprints)
|
foreach (var b in SelectedBlueprints)
|
||||||
{
|
{
|
||||||
var drawableItem = (Drawable)b.Item;
|
var drawableItem = (Drawable)b.Item;
|
||||||
|
|
||||||
drawableItem.Position =
|
var flippedPosition = GetFlippedPosition(direction, selectionQuad, b.ScreenSpaceSelectionPoint);
|
||||||
drawableItem.Parent.ToLocalSpace(GetFlippedPosition(direction, selectionQuad, b.ScreenSpaceSelectionPoint)) - drawableItem.AnchorPosition;
|
|
||||||
|
updateDrawablePosition(drawableItem, flippedPosition);
|
||||||
|
|
||||||
drawableItem.Scale *= new Vector2(
|
drawableItem.Scale *= new Vector2(
|
||||||
direction == Direction.Horizontal ? -1 : 1,
|
direction == Direction.Horizontal ? -1 : 1,
|
||||||
@ -202,6 +205,12 @@ namespace osu.Game.Skinning.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void updateDrawablePosition(Drawable drawable, Vector2 screenSpacePosition)
|
||||||
|
{
|
||||||
|
drawable.Position =
|
||||||
|
drawable.Parent.ToLocalSpace(screenSpacePosition) - drawable.AnchorPosition;
|
||||||
|
}
|
||||||
|
|
||||||
private void applyOrigin(Anchor anchor)
|
private void applyOrigin(Anchor anchor)
|
||||||
{
|
{
|
||||||
foreach (var item in SelectedItems)
|
foreach (var item in SelectedItems)
|
||||||
|
Loading…
Reference in New Issue
Block a user