Browse Source

Fixed undo cache

flabbet 1 year ago
parent
commit
73f5af6b0f

+ 2 - 0
src/ChunkyImageLib/ChunkyImage.cs

@@ -65,6 +65,8 @@ public class ChunkyImage : IReadOnlyChunkyImage, IDisposable, ICloneable
     private static Paint SmoothReplacingPaint { get; } = new Paint() { BlendMode = BlendMode.Src, FilterQuality = FilterQuality.Medium };
     private static Paint AddingPaint { get; } = new Paint() { BlendMode = BlendMode.Plus };
     private readonly Paint blendModePaint = new Paint() { BlendMode = BlendMode.Src };
+    
+    public int CommitCounter => commitCounter;
 
     public VecI CommittedSize { get; private set; }
     public VecI LatestSize { get; private set; }

+ 4 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/ImageLayerNode.cs

@@ -263,15 +263,18 @@ class ImageFrame
     public int Duration { get; set; }
     public ChunkyImage Image { get; set; }
     
+    private int lastCommitCounter = 0;
+    
     public bool RequiresUpdate
     {
         get
         {
-            return Image.QueueLength != lastQueueLength;
+            return Image.QueueLength != lastQueueLength || Image.CommitCounter != lastCommitCounter;
         }
         set
         {
             lastQueueLength = Image.QueueLength;
+            lastCommitCounter = Image.CommitCounter;
         }
     }