Fix clipboard changes not batching as undo steps

This commit is contained in:
Dean Herbert 2023-02-15 19:35:22 +09:00
parent bcf2555545
commit bc83b0c264

View File

@ -434,7 +434,9 @@ namespace osu.Game.Overlays.SkinEditor
protected void Paste()
{
var drawableInfo = JsonConvert.DeserializeObject<SerialisedDrawableInfo[]>(Clipboard.Content.Value);
changeHandler?.BeginChange();
var drawableInfo = JsonConvert.DeserializeObject<SerialisedDrawableInfo[]>(clipboard.Content.Value);
if (drawableInfo == null)
return;
@ -448,6 +450,8 @@ namespace osu.Game.Overlays.SkinEditor
SelectedComponents.Clear();
SelectedComponents.AddRange(instances);
changeHandler?.EndChange();
}
protected void Undo() => changeHandler?.RestoreState(-1);
@ -491,8 +495,12 @@ namespace osu.Game.Overlays.SkinEditor
public void DeleteItems(ISerialisableDrawable[] items)
{
changeHandler?.BeginChange();
foreach (var item in items)
availableTargets.FirstOrDefault(t => t.Components.Contains(item))?.Remove(item);
changeHandler?.EndChange();
}
#region Drag & drop import handling