From e4a5c471ee417df91052c12b4dc540793d25c6dd Mon Sep 17 00:00:00 2001 From: MarcinZiabek Date: Sat, 10 Dec 2022 16:45:03 +0100 Subject: [PATCH] Preview: do not collect information about simple containers --- QuestPDF/Drawing/DocumentGenerator.cs | 1 + QuestPDF/Drawing/Proxy/LayoutErrorAnalyzer.cs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/QuestPDF/Drawing/DocumentGenerator.cs b/QuestPDF/Drawing/DocumentGenerator.cs index fa31288..be8d0ac 100644 --- a/QuestPDF/Drawing/DocumentGenerator.cs +++ b/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); diff --git a/QuestPDF/Drawing/Proxy/LayoutErrorAnalyzer.cs b/QuestPDF/Drawing/Proxy/LayoutErrorAnalyzer.cs index 85bf659..dfeb825 100644 --- a/QuestPDF/Drawing/Proxy/LayoutErrorAnalyzer.cs +++ b/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) {