2 Commits

Author SHA1 Message Date
26df996f8a Fix card width
All checks were successful
continuous-integration/drone/push Build is passing
2023-08-25 19:17:08 +02:00
b3a19831a4 Adjust settings 2023-08-25 19:15:50 +02:00

View File

@@ -33,7 +33,7 @@ export function ComplexFamilyTree(p: {
store,
svg: view.svg,
card_dim: {
w: 160,
w: 210,
h: 118,
text_x: 5,
text_y: 70,
@@ -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));