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