2
0
Эх сурвалжийг харах

Increased node preview budget

flabbet 1 жил өмнө
parent
commit
7bc9bef299

+ 13 - 3
src/PixiEditor.AvaloniaUI/Helpers/StructureHelpers.cs

@@ -6,6 +6,7 @@ namespace PixiEditor.AvaloniaUI.Helpers;
 public static class StructureHelpers
 public static class StructureHelpers
 {
 {
     public const int PreviewSize = 48;
     public const int PreviewSize = 48;
+
     /// <summary>
     /// <summary>
     /// Calculates the size of a scaled-down preview for a given size of layer tight bounds.
     /// Calculates the size of a scaled-down preview for a given size of layer tight bounds.
     /// </summary>
     /// </summary>
@@ -13,8 +14,17 @@ public static class StructureHelpers
     {
     {
         double proportions = tightBoundsSize.Y / (double)tightBoundsSize.X;
         double proportions = tightBoundsSize.Y / (double)tightBoundsSize.X;
         const int prSize = PreviewSize;
         const int prSize = PreviewSize;
-        return proportions > 1 ?
-            new VecI(Math.Max((int)Math.Round(prSize / proportions), 1), prSize) :
-            new VecI(prSize, Math.Max((int)Math.Round(prSize * proportions), 1));
+        return proportions > 1
+            ? new VecI(Math.Max((int)Math.Round(prSize / proportions), 1), prSize)
+            : new VecI(prSize, Math.Max((int)Math.Round(prSize * proportions), 1));
+    }
+
+    public static VecI CalculatePreviewSize(VecI tightBoundsSize, int previewSize)
+    {
+        double proportions = tightBoundsSize.Y / (double)tightBoundsSize.X;
+        int prSize = previewSize;
+        return proportions > 1
+            ? new VecI(Math.Max((int)Math.Round(prSize / proportions), 1), prSize)
+            : new VecI(prSize, Math.Max((int)Math.Round(prSize * proportions), 1));
     }
     }
 }
 }

+ 1 - 1
src/PixiEditor.AvaloniaUI/Models/Rendering/MemberPreviewUpdater.cs

@@ -739,7 +739,7 @@ internal class MemberPreviewUpdater
             if (nodeVm.ResultPreview == null)
             if (nodeVm.ResultPreview == null)
             {
             {
                 nodeVm.ResultPreview =
                 nodeVm.ResultPreview =
-                    new Surface(StructureHelpers.CalculatePreviewSize(internals.Tracker.Document.Size));
+                    new Surface(StructureHelpers.CalculatePreviewSize(internals.Tracker.Document.Size, 150));
             }
             }
 
 
             float scalingX = (float)nodeVm.ResultPreview.Size.X / node.CachedResult.Size.X;
             float scalingX = (float)nodeVm.ResultPreview.Size.X / node.CachedResult.Size.X;