1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 14:12:55 +08:00

Merge pull request #12766 from peppy/stable-anchor-origin

Keep component positions stable when changing anchor/origin
This commit is contained in:
Dean Herbert 2021-05-13 23:36:40 +09:00 committed by GitHub
commit cef39eb4fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -109,13 +109,25 @@ namespace osu.Game.Skinning.Editor
private void applyOrigin(Anchor anchor)
{
foreach (var item in SelectedItems)
((Drawable)item).Origin = anchor;
{
var drawable = (Drawable)item;
var previousOrigin = drawable.OriginPosition;
drawable.Origin = anchor;
drawable.Position += drawable.OriginPosition - previousOrigin;
}
}
private void applyAnchor(Anchor anchor)
{
foreach (var item in SelectedItems)
((Drawable)item).Anchor = anchor;
{
var drawable = (Drawable)item;
var previousAnchor = drawable.AnchorPosition;
drawable.Anchor = anchor;
drawable.Position -= drawable.AnchorPosition - previousAnchor;
}
}
private static void adjustScaleFromAnchor(ref Vector2 scale, Anchor reference)