Compare commits
2 Commits
e1bc10e299
...
26df996f8a
| Author | SHA1 | Date | |
|---|---|---|---|
| 26df996f8a | |||
| b3a19831a4 |
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user