Browse Source

Added return to empty canvas for clipping

flabbet 5 years ago
parent
commit
0011a598dd
1 changed files with 4 additions and 1 deletions
  1. 4 1
      PixiEditor/Models/DataHolders/Document.cs

+ 4 - 1
PixiEditor/Models/DataHolders/Document.cs

@@ -143,7 +143,10 @@ namespace PixiEditor.Models.DataHolders
             int biggestX = biggestPixels.Max(x => x.X);
             int biggestY = biggestPixels.Max(x => x.Y);
 
-            int width = biggestX - smallestX + 1;
+            if (smallestX == 0 && smallestY == 0 && biggestX == 0 && biggestY == 0)
+                return;
+
+                int width = biggestX - smallestX + 1;
             int height = biggestY - smallestY + 1;
             Crop(smallestX, smallestY, width, height);
         }