I have a button in our application which dynamically changes the orientation from vertical to horizontal. I do so by keeping the diagram properties around and when the user clicks the button, I change the layout.direction to 0 (from 90).
The problem is that on the next relayout, the links are not routed cleanly:
Well it does look like that the fromSpot and toSpot are not necessary here. However, removing them does not fix the problem I indicated above: I still need 2 calls to layoutDiagram(true).
I managed to fix this problem by accident: I only discovered the toModel() binding option yesterday (after all these years) and I wanted to try it out.
I had 4 toObject() bindings which were checking properties of the node’s diagram and then returned a Spot by checking a property of an object held by the node’s nodeData --2 of these bindings were alignments for “handles” on the diagram nodes, the other 2 were the from and to spots.
When I replaced these toObject() bindings with toModel() ones by centralizing the information I needed on the model’s modelData, I noticed the problem was not occurring anymore.
It is almost as if transiently, the information was not the same on all nodes (or was changed while doing the routing), leading to an incorrect routing of the links. Using toObject() made everything properly synchronous.
I still do not understand why you have any Binding of fromSpot or toSpot at all – you should be letting the layout determine the routing, including setting the spots on the Links.