I saw mention of an undocumented enum go.Link.AvoidsNodesStraight but I’ve been unable to get it to do what I think it should do. If I have two rectangles next to each other but offset vertically with a link between them, I’d like the link to be horizontal if at all possible with no bends. It seems that go.Link.AvoidsNodesStraight is provided for this case, is that correct? When I use it, the link is behaving as if I’d set go.Link.AvoidsNodes
Yes, that is basically correct, but it also requires the fromSpot and toSpot values to be Spot.isSide(). There might be other requirements and assumptions too; I don’t know.
Take a look at http://gojs.net/extras/straight.html.
Remember that that enum value is undocumented for a reason. You can use it if you like, but we might change its behavior or delete it in the future. Once we figure out what to do better.
Thanks, that looks pretty much exactly what I need, there must be something wrong with my own diagram. Are there plans to make this an official part of the API at some point? I would prefer to use a supported method and I’m not sure it works completely just yet (the link between 6 and 7 seems to show a bend when it doesn’t need to)
After much procrastination, I finally started to look at this in more depth. And it seems pretty simple to code this up with a subclassed Link class, overriding the computePoints method. The only thing I have yet to figure out is how to not show a straight line when there is a node between the two linked nodes.