1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 19:22:54 +08:00

Move guard clause from checkAndApplyClosestAnchor to applyAnchor

This commit is contained in:
Robin Avery 2021-06-08 09:51:39 -04:00
parent 529a80871b
commit f22cc981d1
No known key found for this signature in database
GPG Key ID: 0496DF10CEF7E226

View File

@ -165,11 +165,7 @@ namespace osu.Game.Skinning.Editor
var drawable = (Drawable)item;
var closestAnchor = getClosestAnchor(drawable);
if (closestAnchor == drawable.Anchor) return;
applyAnchor(drawable, closestAnchor);
applyAnchor(drawable, getClosestAnchor(drawable));
}
protected override void OnSelectionChanged()
@ -325,6 +321,8 @@ namespace osu.Game.Skinning.Editor
private static void applyAnchor(Drawable drawable, Anchor anchor)
{
if (anchor == drawable.Anchor) return;
var previousAnchor = drawable.AnchorPosition;
drawable.Anchor = anchor;
drawable.Position -= drawable.AnchorPosition - previousAnchor;