Move common functionality out of OsuSelectionHandler and implement flip support

This commit is contained in:
Dean Herbert
2021-05-18 18:34:06 +09:00
parent c80e736712
commit d661e98fa6
3 changed files with 74 additions and 56 deletions

View File

@ -43,10 +43,16 @@ namespace osu.Game.Skinning.Editor
public override bool HandleFlip(Direction direction)
{
// TODO: this is temporary as well.
foreach (var c in SelectedBlueprints)
var selectionQuad = GetSurroundingQuad(SelectedBlueprints.Select(b => b.ScreenSpaceSelectionPoint));
foreach (var b in SelectedBlueprints)
{
((Drawable)c.Item).Scale *= new Vector2(
var drawableItem = (Drawable)b.Item;
drawableItem.Position =
drawableItem.Parent.ToLocalSpace(GetFlippedPosition(direction, selectionQuad, b.ScreenSpaceSelectionPoint)) - drawableItem.AnchorPosition;
drawableItem.Scale *= new Vector2(
direction == Direction.Horizontal ? -1 : 1,
direction == Direction.Vertical ? -1 : 1
);