Hello Team Northswood,
I’m currently working on Network Plumbing Diagram that implements GoJS. Basically, I have nodes and links layed out in the following manner:
As you could see there are numerous links and nodes at different levels. Users can drag any node freely on the layout. The problem is, sometimes they might drop the node very close to other nodes and in that case I want to apply some correction on the node’s position.
We have set up the binding for node’s position in the nodeTemplate as follows:
new go.Binding(“position”, “loc”, go.Point.parse)
I change the position property of the node programmatically if the user drags the node too close to the other node. I do it inside a transaction. The position coordinate is changed, but the node isn’t displayed at the set position but instead where the user dropped the node. The change happens only when I select the node again and drag it a little. Only THEN, the node jumps to the set coordinates. I’ve observed that changes made to links are shown immediately when transaction is committed but not those of nodes.
I also read a little about layout refresh and how invalidation of a current layout refreshes the diagram. I tried calling out the following method right after setting nodes position:
diag.layout.invalidateLayout();
Kindly, address a solution for this.
Thanks!