Fix skin blueprint box drawing incorrectly when both scale and rotation are applied

This commit is contained in:
Dean Herbert
2021-05-13 18:54:40 +09:00
parent 9f8e6979dd
commit 07e475cd13

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -112,14 +113,10 @@ namespace osu.Game.Skinning.Editor
drawableQuad = drawable.ScreenSpaceDrawQuad; drawableQuad = drawable.ScreenSpaceDrawQuad;
var quad = ToLocalSpace(drawable.ScreenSpaceDrawQuad); var quad = ToLocalSpace(drawable.ScreenSpaceDrawQuad);
box.Position = new Vector2( box.Position = drawable.ToSpaceOfOtherDrawable(Vector2.Zero, this);
drawable.Scale.X < 0 ? quad.TopRight.X : quad.TopLeft.X,
drawable.Scale.Y < 0 ? quad.BottomLeft.Y : quad.TopLeft.Y
);
box.Size = quad.Size; box.Size = quad.Size;
box.Rotation = drawable.Rotation; 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); public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => drawable.ReceivePositionalInputAt(screenSpacePos);