flabbet 3 лет назад
Родитель
Сommit
700016e640

+ 0 - 1
PixiEditor/Models/DataHolders/Document/Document.Layers.cs

@@ -458,7 +458,6 @@ namespace PixiEditor.Models.DataHolders
             LayerStructure.AssignParent(mergedLayer.LayerGuid, groupParent?.GroupGuid);
 
             RemoveLayer(placeholderLayer, false);
-
             RemoveLayer(layersToMerge[^1], false);
 
             SetMainActiveLayer(Layers.IndexOf(mergedLayer));

+ 9 - 1
PixiEditor/Models/Tools/BitmapOperationTool.cs

@@ -17,6 +17,8 @@ namespace PixiEditor.Models.Tools
 
         public bool UseDefaultUndoMethod { get; set; } = true;
 
+        public bool UseDocumentRectForUndo { get; set; } = false;
+
         private StorageBasedChange _change;
 
         public abstract void Use(Layer activeLayer, Layer previewLayer, IEnumerable<Layer> allLayers, IReadOnlyList<Coordinates> recordedMouseMovement, SKColor color);
@@ -62,8 +64,14 @@ namespace PixiEditor.Models.Tools
 
             if (toolSessionRect.IsEmpty)
             {
-                finalRect = SKRectI.Create(0, 0, doc.ActiveLayer.MaxWidth, doc.ActiveLayer.MaxHeight);
+                finalRect = SKRectI.Create(doc.ActiveLayer.OffsetX, doc.ActiveLayer.OffsetY, doc.ActiveLayer.Width, doc.ActiveLayer.Height);
             }
+
+            if (UseDocumentRectForUndo)
+            {
+                finalRect = SKRectI.Create(0, 0, doc.Width, doc.Height);
+            }
+
             _change = new StorageBasedChange(doc, new[] { new LayerChunk(doc.ActiveLayer, finalRect) });
         }
 

+ 1 - 0
PixiEditor/Models/Tools/Tools/FloodFillTool.cs

@@ -17,6 +17,7 @@ namespace PixiEditor.Models.Tools.Tools
         {
             ActionDisplay = "Press on an area to fill it.";
             BitmapManager = bitmapManager;
+            UseDocumentRectForUndo = true;
         }
 
         public override string Tooltip => "Fills area with color. (G)";