From b3a19831a452b294e84ab176bc1dc478e7900fdd Mon Sep 17 00:00:00 2001 From: Pierre Hubert Date: Fri, 25 Aug 2023 19:15:50 +0200 Subject: [PATCH] Adjust settings --- .../src/widgets/complex_family_tree/ComplexFamilyTree.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/geneit_app/src/widgets/complex_family_tree/ComplexFamilyTree.tsx b/geneit_app/src/widgets/complex_family_tree/ComplexFamilyTree.tsx index 3fa07aa..688fca7 100644 --- a/geneit_app/src/widgets/complex_family_tree/ComplexFamilyTree.tsx +++ b/geneit_app/src/widgets/complex_family_tree/ComplexFamilyTree.tsx @@ -77,8 +77,9 @@ export function ComplexFamilyTree(p: { }; const exportPDF = async () => { - const docWidth = treeWidth(p.tree) * 60; - const docHeight = treeHeight(p.tree) * 41; + const docWidth = treeWidth(p.tree) * 65; + const docHeight = treeHeight(p.tree) * 60; + console.info(`Tree w=${treeWidth(p.tree)} h=${treeHeight(p.tree)}`); const doc = new jsPDF({ orientation: "l", @@ -194,7 +195,8 @@ function treeWidth(node: FamilyTreeNode): number { } function treeWidthRecurse(node: FamilyTreeNode, vals: number[], level: number) { - vals[level] += 1 + (node.couples?.length ?? 0) + (node.down ? 1 : 0); + vals[level] += + 1 + (node.couples?.length ?? 0) + ((node.down?.length ?? 0) > 0 ? 1 : 0); node.down?.forEach((n) => treeWidthRecurse(n, vals, level + 1));