So I have this diagram using go.GraphLinksModel that uses two-way binding on “points” for links so that when user changes a link’s Bezier curve, its new shape (via “points”) is persisted. The problem I encounter currently is that - if I modify the node template (e.g, making a font bigger or smaller, changing margins for node) and when the persisted link data is loaded back, those links are no longer at their “correct” positions relative to the nodes they are connecting to (because the nodes have become either larger or smaller). One solution is just to clear out those persisted points. However, I’m also interested in allowing users to select a particular link and perform a “reset” on its position (i.e. let diagram renders the link at its default position). What is the good approach to this? Thanks.
Yes, that’s a potential problem with remembering positions and/or sizes in the model. It’s not just link routes that could become invalid when templates are modified – imagine saving node locations in a model. Then change the node template(s) to be five times as large – it’s likely that nodes might overlap each other.
One way to force a link route to be recomputed is to call Link.invalidateRoute. The route will be recomputed at the end of the transaction.
Thank you very much.