Buggy orthogonal links

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:

In smaller quantities it looks like that:
Zrzut ekranu 2020-12-21 o 16.38.23

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.

Settings for my link:

this.curve = go.Link.None;
this.routing = go.Link.Orthogonal;
this.corner = 2;

What layout are you using?

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.

Im using DoubleTreeLayout so essentially a TreeLayout, but I have set:

setsPortSpot: false, 
setsChildPortSpot: false

because I’m overriding it (I have different link shapes in different layers).
getLinkPoint for this exact situation returns this:

var ox = othernode.location.x;
var tx = node.location.x;
return port.getDocumentPoint((ox < tx) ? go.Spot.Left : go.Spot.Right, result);

so basically the same as TreeLayout would (I think)

If I were you I would not use a custom Link class. The standard behaviors do exactly what you are asking for. For example: https://gojs.net/latest/samples/familyTree.html or https://gojs.net/latest/samples/tLayout.html

Okay. Thanks. Unfortunately I have to but that’s no problem. I can just do it manually

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.

It’s just a part of it. I have many conditions I side co I shortened it here. I’m using both cases