Skip to content

Commit

Permalink
Improved tight bounds recalc
Browse files Browse the repository at this point in the history
  • Loading branch information
flabbet committed Feb 21, 2022
1 parent 04feefc commit f732cb8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions PixiEditor/Views/UserControls/PlainLayerView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ private void ResizeWithOptimized(Size newSize)

private void OnLayerBitmapChanged(object sender, Int32Rect e)
{
if (TargetLayer.Width != prevLayerWidth || TargetLayer.Height != prevLayerHeight)
if (TargetLayer.Width != prevLayerWidth || TargetLayer.Height != prevLayerHeight
|| TargetLayer.OffsetX != _cachedTightBounds.X
|| TargetLayer.OffsetY != _cachedTightBounds.Y)
{
ResizeWithOptimized(RenderSize);
prevLayerWidth = TargetLayer.Width;
Expand All @@ -120,7 +122,7 @@ private static Int32Rect GetTightBounds(Layer targetLayer)
var tightBounds = targetLayer.TightBounds;
if (tightBounds.IsEmpty)
{
tightBounds = new Int32Rect(0, 0, 1, 1);
tightBounds = new Int32Rect(0, 0, targetLayer.Width, targetLayer.Height);
}

return tightBounds;
Expand Down

0 comments on commit f732cb8

Please sign in to comment.