diff --git a/osu.Game/Skinning/Editor/SkinBlueprint.cs b/osu.Game/Skinning/Editor/SkinBlueprint.cs index 9e98856abf..37659093e5 100644 --- a/osu.Game/Skinning/Editor/SkinBlueprint.cs +++ b/osu.Game/Skinning/Editor/SkinBlueprint.cs @@ -116,9 +116,10 @@ namespace osu.Game.Skinning.Editor drawableQuad = drawable.ScreenSpaceDrawQuad; var quad = ToLocalSpace(drawable.ScreenSpaceDrawQuad); - box.Position = quad.TopLeft; + box.Position = drawable.ToSpaceOfOtherDrawable(Vector2.Zero, this); box.Size = quad.Size; box.Rotation = drawable.Rotation; + box.Scale = new Vector2(MathF.Sign(drawable.Scale.X), MathF.Sign(drawable.Scale.Y)); } public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => drawable.ReceivePositionalInputAt(screenSpacePos); diff --git a/osu.Game/Skinning/Editor/SkinSelectionHandler.cs b/osu.Game/Skinning/Editor/SkinSelectionHandler.cs index 79dd45c07c..9bcdc6e08b 100644 --- a/osu.Game/Skinning/Editor/SkinSelectionHandler.cs +++ b/osu.Game/Skinning/Editor/SkinSelectionHandler.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; using osu.Game.Extensions; @@ -36,6 +37,20 @@ namespace osu.Game.Skinning.Editor return true; } + public override bool HandleFlip(Direction direction) + { + // TODO: this is temporary as well. + foreach (var c in SelectedBlueprints) + { + ((Drawable)c.Item).Scale *= new Vector2( + direction == Direction.Horizontal ? -1 : 1, + direction == Direction.Vertical ? -1 : 1 + ); + } + + return true; + } + public override bool HandleMovement(MoveSelectionEvent moveEvent) { foreach (var c in SelectedBlueprints) @@ -139,6 +154,13 @@ namespace osu.Game.Skinning.Editor // reverse the scale direction if dragging from top or left. if ((reference & Anchor.x0) > 0) scale.X = -scale.X; if ((reference & Anchor.y0) > 0) scale.Y = -scale.Y; + + // for now aspect lock scale adjustments that occur at corners. + if (!reference.HasFlagFast(Anchor.x1) && !reference.HasFlagFast(Anchor.y1)) + { + // TODO: temporary implementation - only dragging the corner handles across the X axis changes size. + scale.Y = scale.X; + } } public class AnchorMenuItem : TernaryStateMenuItem