Improve layout a little
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
dbb6724f44
commit
cbaabb34d5
@ -25,7 +25,7 @@ const SPOUSE_SPACING = 10;
|
|||||||
/**
|
/**
|
||||||
* Space between two siblings hierachy
|
* Space between two siblings hierachy
|
||||||
*/
|
*/
|
||||||
const SIBLINGS_SPACING = 20;
|
const SIBLINGS_SPACING = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vertical space between two generations
|
* Vertical space between two generations
|
||||||
@ -111,7 +111,6 @@ function buildSimpleDownTreeNode(
|
|||||||
let levelWidth: number;
|
let levelWidth: number;
|
||||||
if (node.spouse) {
|
if (node.spouse) {
|
||||||
levelWidth =
|
levelWidth =
|
||||||
CARD_SPACING +
|
|
||||||
SPOUSE_SPACING +
|
SPOUSE_SPACING +
|
||||||
2 *
|
2 *
|
||||||
Math.max(
|
Math.max(
|
||||||
@ -119,7 +118,7 @@ function buildSimpleDownTreeNode(
|
|||||||
memberCardWidth(node.spouse.member)
|
memberCardWidth(node.spouse.member)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
levelWidth = memberCardWidth(node.member) + CARD_SPACING;
|
levelWidth = memberCardWidth(node.member);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute down level width
|
// Compute down level width
|
||||||
@ -217,6 +216,10 @@ function NodeArea(p: {
|
|||||||
parent_x_offset + Math.floor(memberCardWidth(p.node.member) / 2);
|
parent_x_offset + Math.floor(memberCardWidth(p.node.member) / 2);
|
||||||
let parentLinkY = p.y;
|
let parentLinkY = p.y;
|
||||||
|
|
||||||
|
// Remove ugly little shifts
|
||||||
|
if (Math.abs(parentLinkX - (p.childrenLinkDestX ?? 0)) < 10)
|
||||||
|
parentLinkX = p.childrenLinkDestX!;
|
||||||
|
|
||||||
let childrenLinkX: number;
|
let childrenLinkX: number;
|
||||||
let childrenLinkY: number;
|
let childrenLinkY: number;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user