My link template has routing: go.Link.AvoidsNodescurve: go.Link.GraduatedfromEndSegmentLength: 10 toEndSegmentLength: 5
When the diagram is rendered, I sometimes see the links are crossing each other, which is not expected. Please check in the diagram below how to avoid this behavior.
Yes, the default routing of orthogonal links has the turning point be midway between the ports. When the distances vary because the node widths vary, that midpoint will vary.
If you want the links to turn at a fixed distance from the node, use the following Link class instead. Of course you can use distances other than 50, as you deem appropriate for your app.
Oh, I think you don’t want to set LayeredDigraphLayout.setsPortSpots to false. But you can try it either way.
class OffsetLink extends go.Link {
constructor(init) {
super();
if (init) Object.assign(this, init);
}
computeMidOrthoPosition(fromX, fromY, toX, toY, vertical) {
if (vertical) return fromY + 50;
return fromX + 50;
}
} // end of OffsetLink