|
@@ -150,30 +150,33 @@ class SVGTree {
|
|
|
const cardDouble = person.partner != null;
|
|
|
|
|
|
// find the highest common mid y level
|
|
|
- const upperRadius = children.reduce((min, child) => Math.min(min, Math.abs(person.y + this.cardHeight - child.y) / 2), 1000);
|
|
|
+ const upperRadius = Math.min(children.reduce((min, child) =>
|
|
|
+ Math.min(min, Math.abs(person.y + this.cardHeight - child.y) / 2), 1000),
|
|
|
+ this.cardWidth * 0.5);
|
|
|
|
|
|
for(const child of children) {
|
|
|
const x1 = person.x + this.cardWidth * (cardDouble ? 1.0 : 0.5);
|
|
|
const y1 = person.y + this.cardHeight;
|
|
|
const x2 = child.x + this.cardWidth * 0.5;
|
|
|
const y2 = child.y;
|
|
|
+ const radius = Math.min(Math.abs(y1 - y2) * 0.5, this.cardWidth * 0.5);
|
|
|
const ym = (y1 + y2) / 2;
|
|
|
- const radius = Math.abs(y1 - y2) * 0.5;
|
|
|
+ const yl = y1 + radius;
|
|
|
const xd = Math.abs(x1 - x2);
|
|
|
const dir = (x1 < x2 ? 1 : -1);
|
|
|
|
|
|
d += ` M${x1} ${y1}`; //move to start
|
|
|
|
|
|
- if(xd <= radius + 5) {
|
|
|
+ if(xd <= Math.abs(y1 - y2) * 0.5 + 5 && radius == upperRadius) {
|
|
|
d += ` C${x1} ${ym}, ${x2} ${ym}, ${x2} ${y2}`; // cubic bezier
|
|
|
} else {
|
|
|
d += ` q0 ${upperRadius}, ${dir*upperRadius} ${upperRadius}`; // 90° quadratic bezier
|
|
|
|
|
|
- if(xd <= 2*radius) {
|
|
|
- d += ` C${x1 + upperRadius*dir} ${ym}, ${x2} ${ym}, ${x2} ${y2}`; // cubic bezier
|
|
|
+ if(xd <= 2*radius && radius == upperRadius) {
|
|
|
+ d += ` C${x1 + upperRadius*dir} ${yl}, ${x2} ${yl}, ${x2} ${y2}`; // cubic bezier
|
|
|
} else {
|
|
|
- d += ` L${x2 - radius*dir} ${y1+upperRadius}`; // line side
|
|
|
- d += ` q${dir*radius} 0, ${dir*radius} ${radius}`; // 90° quadratic bezier
|
|
|
+ d += ` L${x2 - upperRadius*dir} ${y1+upperRadius}`; // line side
|
|
|
+ d += ` q${dir*upperRadius} 0, ${dir*upperRadius} ${upperRadius}`; // 90° quadratic bezier
|
|
|
d += ` L${x2} ${y2}`; // line down
|
|
|
}
|
|
|
}
|