Parcourir la source

Minor improvement

flabbet il y a 3 ans
Parent
commit
cc512f10de

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

@@ -623,7 +623,7 @@ namespace PixiEditor.Models.DataHolders
                 Int32Rect bound = bounds[i];
                 Thickness offset = layer.Offset;
                 layer.Offset = new Thickness(offset.Left + moveVector.X, offset.Top + moveVector.Y, 0, 0);
-                if (layer.Bounds != bound)
+                if (!bound.IsEmpty && layer.Bounds != bound)
                 {
                     layer.DynamicResizeAbsolute(bound);
                 }

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

@@ -180,9 +180,12 @@ namespace PixiEditor.Models.DataHolders
                 new Coordinates(Width, Height));
             Coordinates moveVector = new Coordinates(documentCenter.X - contentCenter.X, documentCenter.Y - contentCenter.Y);
 
-            List<Int32Rect> newBounds = layersToCenter.Select(x => x.Bounds).ToList();
+
+            List<Int32Rect> newBounds = Enumerable.Repeat(Int32Rect.Empty, layersToCenter.Count).ToList();
 
             MoveOffsets(layersToCenter, newBounds, moveVector);
+
+
             List<Guid> guids = layersToCenter.Select(x => x.GuidValue).ToList();
             UndoManager.AddUndoChange(
                 new Change(