Browse Source

Improved tight bounds recalc

flabbet 3 years ago
parent
commit
f732cb8771
1 changed files with 4 additions and 2 deletions
  1. 4 2
      PixiEditor/Views/UserControls/PlainLayerView.xaml.cs

+ 4 - 2
PixiEditor/Views/UserControls/PlainLayerView.xaml.cs

@@ -102,7 +102,9 @@ namespace PixiEditor.Views.UserControls
 
         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;
@@ -120,7 +122,7 @@ namespace PixiEditor.Views.UserControls
             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;