I made this minimal reproducible example of an issue I am facing on a bigger codebase.
When I have a group inside another group, AvoidsNodes doesn’t work as expected, links are crossing one or more nodes of the sub group.
To try it, open the group “SubGroup” and the bug will reproduce. It is also worth mentioning that moving around the nodes you won’t find a position that solves it.
In my use-case the user can’t change parts’ positions though so it wouldn’t be an acceptable workaround.
I tried with the “avoidable” binding but it doesn’t seem to work.
I would be glad if anyone can help me solve this.
The problem is that fromEndSegmentLength and toEndSegmentLength are such large numbers that those end segments of any link must extend so far from the node. When another node is closer than that distance, every link is forced to cross over that node.
Change the value of those two properties to be smaller, such as 10 or 20, or else have the layout so that the nodes are always farther apart. In this case the GridLayout.spacing is only 20x20. The LayeredDigraphLayout spacing is something like that too.
Hello Walter, thank you for your help.
Your suggestion is correct, but if the sub-group appears below the main-group’s node the issue reproduces still:
the link between alpha and delta should go around delta.
Unfortunately on the actual application I can’t do assumptions about the position of nodes because they are dynamic, and they are often appearing also below.
Hmmm. Have you tried setting Group.avoidable to false? By default it is true, and I wonder if that is causing problems with links that connect externally from a group.
Wow that was the issue! I didn’t think that was the issue since it is false by default but apparently if you have a sub group you need to specify that explicitly. Thank you very much for your support.