Hi there. I was experimenting with rounded orthogonal links but I noticed that after adding more than 6 children to a tree node it started getting messy. Like this:
I could try overriding ComputePoints (and I probably will) but it seems to be a bug that shouldn’t happen in the first place so I guess I’m missing something.
Normally a TreeLayout or a LayeredDigraphLayout will automatically set the Link.fromSpot and Link.toSpot on all of the links so that they route the way that you show in your second screenshot.
You can get the same behavior without using either of those layouts by setting those properties on your link template or on the ports of your nodes.
If I were you I would not use a custom Link class. The standard behaviors do exactly what you are asking for. For example: Family Tree (British) or Tree Layout
This worked form me. For anyone with the asme issue
public computePoints() {
var result = go.Link.prototype.computePoints.call(this);
if (result && this.pointsCount === 6){
var p0 = this.getPoint(0);
var p5 = this.getPoint(5);
this.setPoint(1, new go.Point((p0.x+p5.x)/2, p0.y));
this.setPoint(2, new go.Point((p0.x+p5.x)/2, p0.y));
this.setPoint(3, new go.Point((p0.x+p5.x)/2, p0.y));
this.setPoint(4, new go.Point((p0.x+p5.x)/2, p5.y));
}
}
You probably should not be setting points #1 and #4.
This override conflicts with the code of the custom link class I gave you before, so I don’t see the point of having that class at all.