Fix undo history not being batched correctly for depth change operations

This commit is contained in:
Dean Herbert
2023-02-23 20:03:36 +09:00
parent 32a9c066df
commit c48aceb055

View File

@ -566,6 +566,8 @@ namespace osu.Game.Overlays.SkinEditor
if (getTarget(selectedTarget.Value) is not SkinComponentsContainer target) if (getTarget(selectedTarget.Value) is not SkinComponentsContainer target)
return; return;
changeHandler?.BeginChange();
// Iterating by target components order ensures we maintain the same order across selected components, regardless // Iterating by target components order ensures we maintain the same order across selected components, regardless
// of the order they were selected in. // of the order they were selected in.
foreach (var d in target.Components.ToArray()) foreach (var d in target.Components.ToArray())
@ -579,6 +581,8 @@ namespace osu.Game.Overlays.SkinEditor
SelectedComponents.Add(d); SelectedComponents.Add(d);
target.Add(d); target.Add(d);
} }
changeHandler?.EndChange();
} }
public void SendSelectionToBack() public void SendSelectionToBack()
@ -586,6 +590,8 @@ namespace osu.Game.Overlays.SkinEditor
if (getTarget(selectedTarget.Value) is not SkinComponentsContainer target) if (getTarget(selectedTarget.Value) is not SkinComponentsContainer target)
return; return;
changeHandler?.BeginChange();
foreach (var d in target.Components.ToArray()) foreach (var d in target.Components.ToArray())
{ {
if (SelectedComponents.Contains(d)) if (SelectedComponents.Contains(d))
@ -594,6 +600,8 @@ namespace osu.Game.Overlays.SkinEditor
target.Remove(d, false); target.Remove(d, false);
target.Add(d); target.Add(d);
} }
changeHandler?.EndChange();
} }
#region Drag & drop import handling #region Drag & drop import handling