Correctly handle anchor/origin changes as undo states

This commit is contained in:
Dean Herbert
2023-02-06 15:05:05 +09:00
parent 778b8a9bf7
commit 4c868372a2

View File

@ -241,6 +241,8 @@ namespace osu.Game.Overlays.SkinEditor
private void applyOrigins(Anchor origin) private void applyOrigins(Anchor origin)
{ {
OnOperationBegan();
foreach (var item in SelectedItems) foreach (var item in SelectedItems)
{ {
var drawable = (Drawable)item; var drawable = (Drawable)item;
@ -255,6 +257,8 @@ namespace osu.Game.Overlays.SkinEditor
ApplyClosestAnchor(drawable); ApplyClosestAnchor(drawable);
} }
OnOperationEnded();
} }
/// <summary> /// <summary>
@ -266,6 +270,8 @@ namespace osu.Game.Overlays.SkinEditor
private void applyFixedAnchors(Anchor anchor) private void applyFixedAnchors(Anchor anchor)
{ {
OnOperationBegan();
foreach (var item in SelectedItems) foreach (var item in SelectedItems)
{ {
var drawable = (Drawable)item; var drawable = (Drawable)item;
@ -273,15 +279,21 @@ namespace osu.Game.Overlays.SkinEditor
item.UsesFixedAnchor = true; item.UsesFixedAnchor = true;
applyAnchor(drawable, anchor); applyAnchor(drawable, anchor);
} }
OnOperationEnded();
} }
private void applyClosestAnchors() private void applyClosestAnchors()
{ {
OnOperationBegan();
foreach (var item in SelectedItems) foreach (var item in SelectedItems)
{ {
item.UsesFixedAnchor = false; item.UsesFixedAnchor = false;
ApplyClosestAnchor((Drawable)item); ApplyClosestAnchor((Drawable)item);
} }
OnOperationEnded();
} }
private static Anchor getClosestAnchor(Drawable drawable) private static Anchor getClosestAnchor(Drawable drawable)