Add simple tree graph mode #4

Merged
pierre merged 16 commits from simple_tree into master 2023-08-26 14:00:00 +00:00
Showing only changes of commit cbaabb34d5 - Show all commits

View File

@ -25,7 +25,7 @@ const SPOUSE_SPACING = 10;
/**
* Space between two siblings hierachy
*/
const SIBLINGS_SPACING = 20;
const SIBLINGS_SPACING = 10;
/**
* Vertical space between two generations
@ -111,7 +111,6 @@ function buildSimpleDownTreeNode(
let levelWidth: number;
if (node.spouse) {
levelWidth =
CARD_SPACING +
SPOUSE_SPACING +
2 *
Math.max(
@ -119,7 +118,7 @@ function buildSimpleDownTreeNode(
memberCardWidth(node.spouse.member)
);
} else {
levelWidth = memberCardWidth(node.member) + CARD_SPACING;
levelWidth = memberCardWidth(node.member);
}
// Compute down level width
@ -217,6 +216,10 @@ function NodeArea(p: {
parent_x_offset + Math.floor(memberCardWidth(p.node.member) / 2);
let parentLinkY = p.y;
// Remove ugly little shifts
if (Math.abs(parentLinkX - (p.childrenLinkDestX ?? 0)) < 10)
parentLinkX = p.childrenLinkDestX!;
let childrenLinkX: number;
let childrenLinkY: number;