Skip to content

Commit

Permalink
Fixed crash
Browse files Browse the repository at this point in the history
  • Loading branch information
flabbet committed Feb 21, 2022
1 parent cc512f1 commit 2ba698f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions PixiEditor/Models/DataHolders/Document/Document.Layers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,10 @@ private void MoveOffsets(IList<Layer> layers, IList<Int32Rect> bounds, Coordinat
{
layer.DynamicResizeAbsolute(bound);
}
else
{
layer.ClipCanvas();
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions PixiEditor/Models/DataHolders/Document/Document.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,18 @@ public void CenterContent()
Coordinates moveVector = new Coordinates(documentCenter.X - contentCenter.X, documentCenter.Y - contentCenter.Y);


List<Int32Rect> newBounds = Enumerable.Repeat(Int32Rect.Empty, layersToCenter.Count).ToList();
List<Int32Rect> emptyBounds = Enumerable.Repeat(Int32Rect.Empty, layersToCenter.Count).ToList();

MoveOffsets(layersToCenter, newBounds, moveVector);
MoveOffsets(layersToCenter, emptyBounds, moveVector);


List<Guid> guids = layersToCenter.Select(x => x.GuidValue).ToList();
List < Guid> guids = layersToCenter.Select(x => x.GuidValue).ToList();
UndoManager.AddUndoChange(
new Change(
MoveOffsetsProcess,
new object[] { guids, oldBounds, new Coordinates(-moveVector.X, -moveVector.Y) },
MoveOffsetsProcess,
new object[] { guids, newBounds, moveVector },
new object[] { guids, emptyBounds, moveVector },
"Center content"));
}

Expand Down

0 comments on commit 2ba698f

Please sign in to comment.