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 dbb6724f44 - Show all commits

View File

@ -6,12 +6,30 @@ import { getTextWidth } from "../../utils/render_utils";
const FACE_WIDTH = 60; const FACE_WIDTH = 60;
const FACE_HEIGHT = 70; const FACE_HEIGHT = 70;
/**
* Vertical space between faces and text
*/
const FACE_TEXT_SPACING = 2; const FACE_TEXT_SPACING = 2;
/**
* Cards height
*/
const CARD_HEIGHT = 103; const CARD_HEIGHT = 103;
/**
* Space between spouse cards
*/
const SPOUSE_SPACING = 10; const SPOUSE_SPACING = 10;
const CARD_SPACING = 20;
/**
* Space between two siblings hierachy
*/
const SIBLINGS_SPACING = 20; const SIBLINGS_SPACING = 20;
/**
* Vertical space between two generations
*/
const LEVEL_SPACING = 25; const LEVEL_SPACING = 25;
const NAME_FONT = "13px Roboto"; const NAME_FONT = "13px Roboto";
@ -106,7 +124,8 @@ function buildSimpleDownTreeNode(
// Compute down level width // Compute down level width
const downWidth = const downWidth =
SIBLINGS_SPACING * node.down.length + SIBLINGS_SPACING * node.down.length -
SIBLINGS_SPACING +
node.down.reduce((prev, n) => prev + n.width, 0); node.down.reduce((prev, n) => prev + n.width, 0);
node.parentWidth = levelWidth; node.parentWidth = levelWidth;