Browse Source

Preview: do not collect information about simple containers

MarcinZiabek 3 years ago
parent
commit
e4a5c471ee

+ 1 - 0
QuestPDF/Drawing/DocumentGenerator.cs

@@ -148,6 +148,7 @@ namespace QuestPDF.Drawing
                               $"Please analyze your documents structure to detect this element and fix its size constraints.";
 
                 content.RemoveExistingProxies();
+                content.RemoveExistingContainers();
                 content.ApplyLayoutDebugging();
                 content.Measure(Size.Max);
                 

+ 8 - 0
QuestPDF/Drawing/Proxy/LayoutErrorAnalyzer.cs

@@ -23,6 +23,14 @@ namespace QuestPDF.Drawing.Proxy
                 x.CreateProxy(y => y is ElementProxy proxy ? proxy.Child : y);
             });
         }
+        
+        public static void RemoveExistingContainers(this Container content)
+        {
+            content.VisitChildren(x =>
+            {
+                x.CreateProxy(y => y is Container container ? container.Child : y);
+            });
+        }
 
         public static LayoutErrorTrace CollectLayoutErrorTrace(this Container content)
         {