Skip to content

Commit

Permalink
Some progress in terms of groups undo
Browse files Browse the repository at this point in the history
  • Loading branch information
flabbet committed Dec 12, 2021
1 parent aaefba3 commit 018d1f3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion PixiEditor/Models/DataHolders/Document/Document.Layers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void UpdateLayersColor()
}
}

public void MoveLayerInStructure(Guid layerGuid, Guid referenceLayer, bool above = false)
public void MoveLayerInStructure(Guid layerGuid, Guid referenceLayer, bool above = false, bool addToUndo = true)
{
var args = new object[] { layerGuid, referenceLayer, above };

Expand All @@ -151,6 +151,8 @@ public void MoveLayerInStructure(Guid layerGuid, Guid referenceLayer, bool above

AddLayerStructureToUndo(oldLayerStrcutureGroups);

if (!addToUndo) return;

UndoManager.AddUndoChange(new Change(
ReverseMoveLayerInStructureProcess,
new object[] { oldIndex, layerGuid },
Expand Down
2 changes: 2 additions & 0 deletions PixiEditor/Models/Tools/BitmapOperationTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public override void AfterUse()
var document = ViewModels.ViewModelMain.Current.BitmapManager.ActiveDocument;
var args = new object[] { _change.Document };
document.UndoManager.AddUndoChange(_change.ToChange(StorageBasedChange.BasicUndoProcess, args));
document.AddLayerStructureToUndo(document.LayerStructure.Groups);
document.UndoManager.SquashUndoChanges(2);
_change = null;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using PixiEditor.Helpers;
using PixiEditor.Models.Controllers;
using PixiEditor.Models.Layers;
using PixiEditor.Models.Undo;
using PixiEditor.Views.UserControls.Layers;
using System;
using System.Linq;
Expand Down

0 comments on commit 018d1f3

Please sign in to comment.