mirror of
https://github.com/ppy/osu
synced 2025-01-09 07:39:46 +00:00
Keep component positions stable when changing anchor/origin
This commit is contained in:
parent
96d4011de2
commit
05e0c57a6a
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user