1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 00:02:54 +08:00

Simplify applyClosestAnchor to one line by moving another guard clause

This commit is contained in:
Robin Avery 2021-06-08 10:08:02 -04:00
parent f22cc981d1
commit 2c88e6df8d
No known key found for this signature in database
GPG Key ID: 0496DF10CEF7E226

View File

@ -149,24 +149,20 @@ namespace osu.Game.Skinning.Editor
{
foreach (var c in SelectedBlueprints)
{
var skinnableDrawable = c.Item;
Drawable drawable = (Drawable)skinnableDrawable;
var item = c.Item;
Drawable drawable = (Drawable)item;
drawable.Position += drawable.ScreenSpaceDeltaToParentSpace(moveEvent.ScreenSpaceDelta);
checkAndApplyClosestAnchor(skinnableDrawable);
if (item.UsesFixedAnchor) continue;
applyClosestAnchor(drawable);
}
return true;
}
private static void checkAndApplyClosestAnchor(ISkinnableDrawable item)
{
if (item.UsesFixedAnchor) return;
var drawable = (Drawable)item;
applyAnchor(drawable, getClosestAnchor(drawable));
}
private static void applyClosestAnchor(Drawable drawable) => applyAnchor(drawable, getClosestAnchor(drawable));
protected override void OnSelectionChanged()
{
@ -268,7 +264,7 @@ namespace osu.Game.Skinning.Editor
foreach (var item in SelectedItems)
{
item.UsesFixedAnchor = false;
checkAndApplyClosestAnchor(item);
applyClosestAnchor((Drawable)item);
}
}