Problems showing correct path of a link to a group

I have problems showing the correct path of a link from or to a group. “Node to node” it works perfectly fine, i can store and restore the points and make changes to the link - everything works as expected. But when there is a group on either side of the link the path of the link seems to be a “default” path. My link-template looks like this

$go(go.Link, {
<span =“Apple-tab-span” style=“white-space:pre”> routing: go.Link.Orthogonal,
<span =“Apple-tab-span” style=“white-space:pre”> corner: 10,
<span =“Apple-tab-span” style=“white-space:pre”> reshapable: true,
<span =“Apple-tab-span” style=“white-space:pre”> resegmentable: true,
<span =“Apple-tab-span” style=“white-space:pre”> curve: go.Link.JumpGap
<span =“Apple-tab-span” style=“white-space:pre”> }, new go.Binding(“points”, “”, function (v) {
var stringArr = v.points.split(",");
var intArr = $.map(stringArr, function (v) {
return parseInt(v);
});
return intArr;
}),
$go(go.Shape, { name: “SHAPE”, strokeWidth: 3, stroke: “#DEDE16” }),
$go(go.Shape,
{ toArrow: “Standard”, stroke: “#DEDE16”, fill: “#DEDE16”, scale: 2 }))

Does your Group template have a Placeholder in it? Then the Group is probably being re-measured while its member Nodes (and Links) are being loaded, causing any links connecting with the group to have their routes recalculated.

I was curious about this, so I modified the FlowChart sample so that all of the data were isGroup: true, all the templates were go.Groups, and it used Diagram.groupTemplateMap instead of nodeTemplateMap. It was able to save and then load customized link routes correctly.

I then even added $(go.Placeholder) to each Group template, and everything still worked. But that’s because there were no member Nodes in any Groups, so no Groups would change size as their member nodes changed size while loading, so there would be no reason to invalidate any connected link routes as the Group.

I suppose you could try loading the routes of links connecting with groups later than the rest. That’s inconvenient, but it ought to work. In other words, keep a copy of the loaded route data separately, and in an “InitialLayoutCompleted” DiagramEvent listener you can reset all of the Link.points properties with the saved link routes.

Hi,

Thanks for the quick reply. Yes, i have a placeholder in the group with member nodes in it. I will give your solution a try even though its a bit inconvenient - got to make this work :-)

One additional question - this is clearly not a convenient solution - will it be “fixed” in a release to come, or should I not expect this to be fixed?

I don’t know what we might do in the future to make this less of a problem for you.
You would get the same loss of routing, without any Groups being involved, when using Nodes whose size depended on Pictures whose images would be loaded asynchronously. That’s another reason we recommend that you set the Picture.desiredSize (or width and height) to real numbers.

Just to clarify, I don’t have any nodes with pictures - only SVG’s with the svg-paths in the js-file itself. The nodes also have fixed width and height, and also position attribute specified - so there is no layout in the group (layout = null)

Those constraints certainly help.
Do you have a TwoWay Binding on the Group.desiredSize? That might help (I haven’t tried it).

No, i don’t have twoway binding on group - just defined fixed height and width on the group - and the problem is still there.

OK, we can try to improve when we invalidate link routes, so that situations like yours are less likely to occur. However it is difficult to cover all possible situations.

I fully understand, but I will be happy with the improvements! I could manage though to get the links right in the way you mentioned first with the InitialLayoutCompleted listener. I didn’t reset the routings, but just added all the links after all the nodes was created. That worked well and I think it was the cleanest approach.