Like several others I have been extending the Genogram sample for our project here. I was working with multiple partners and consanguineous relationships, when I noticed some strange behavior for the parent to child link. It had an unnecessary bend.
Unable to fix, I tried the same data on the Genogram Sample to see what I had done wrong, and I was able to get the same behavior, a strange bend in the line going into Father node:
Here is the data I used:
array = [
{ key: 0, n: "Father", s: "M", m:7, f:8, ux: 4, a: ["C", "F", "K"] },
{ key: 1, n: "Mother", s: "F", m:9, f:10, vir: [0, 5], a: ["B", "H", "K"] },
{ key: 5, n: "Mother's Spouse", s: "M", a: ["C"] },
{ key: 6, n: "Maternal Halfbrother", s: "M", m: 1, f: 5, a: ["C"] },
{ key: 4, n: "Claire", s: "F", m: 1, f: 0, a: ["C"] },
{ key: 12, n: "Baby", s: "F", m: 4, f: 0, a: ["C"] },
{ key: 13, n: "Baby2", s: "F", m: 4, f: 0, a: ["C"] },
// ancestors
{ key: 7, n: "Paternal Grandfather", s: "M", m: -33, f: -32, ux: 8, a: ["A", "S"] },
{ key: 8, n: "Paternal Grandmother", s: "F", a: ["E", "S"] },
]
Some other oddities: If I remove the code block to straighten out positioning of only-child nodes, the bend on the line going into the Father node goes away;
If I specifically comment out this call:
var overlaps = layout.diagram.findObjectsIn(newbnds, function(x) { return x.part; }, function(p) { return p !== v.node; }, true);
the bend goes away.
Side note: while I was playing with the only-child positioning, I noticed that the actual bounds of the mnode changes following that findObjectsIn
call:
-
Before
findObjectsIn
call:mnode.toString(): “Node#1411(-12)”
v.node.toString(): “Node#1297(6)”
mnode.actualBounds.toString(): “Rect(179.5,130.60000000000002,1,1)”
v.node.actualBounds.toString() “Rect(168.5,251.20000000000005,63,70.6)” -
And after:
mnode.toString(): “Node#1411(-12)”
v.node.toString(): “Node#1297(6)”
mnode.actualBounds.toString(): “Rect(241.25,151.10000000000002,1,1)”
v.node.actualBounds.toString(): “Rect(168.5,251.20000000000005,63,70.6)”
Here is a codepen demonstrating the issue (but the same effect can be seen by just using the sample page, breaking at setupDiagram
and setting the array to the above data.
http://codepen.io/pthorson/pen/wzkpQJ