Skip to content

Commit

Permalink
fix: Incorrect marriages line. #53
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikGartner committed May 2, 2017
1 parent f632464 commit 25fd62e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
19 changes: 16 additions & 3 deletions src/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,15 @@ class TreeBuilder {
d.source.y = start[0].y;
d.target.x = end[0].x;
d.target.y = end[0].y;

let marriageId = (start[0].data.marriageNode != null ?
start[0].data.marriageNode.id :
end[0].data.marriageNode.id);
let marriageNode = allNodes.find(function(n) {
return n.data.id == marriageId;
});
d.source.marriageNode = marriageNode;
d.target.marriageNode = marriageNode;
});

}
Expand All @@ -218,10 +227,10 @@ class TreeBuilder {
x: d.source.x + nodeWidth * 6 / 10,
y: ny
}, {
x: d.target.x - nodeWidth * 6 / 10,
x: d.target.marriageNode.x,
y: ny
}, {
x: d.target.x - nodeWidth * 6 / 10,
x: d.target.marriageNode.x,
y: d.target.y
}, {
x: d.target.x,
Expand Down Expand Up @@ -259,7 +268,11 @@ class TreeBuilder {

maxHeight = Math.max(maxHeight, height);
n.cHeight = height;
n.cWidth = width;
if (n.data.hidden) {
n.cWidth = 0;
} else {
n.cWidth = width;
}
});
document.body.removeChild(tmpSvg);

Expand Down
3 changes: 2 additions & 1 deletion src/dtree.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ const dTree = {
children: [],
textClass: sp.textClass ? sp.textClass : opts.styles.text,
class: sp.class ? sp.class : opts.styles.node,
extra: sp.extra
extra: sp.extra,
marriageNode: m
};

parent.children.push(m, spouse);
Expand Down

0 comments on commit 25fd62e

Please sign in to comment.