Re positioning nodes changes the shape of link

I have a link between two nodes which is segementable (resegmentable : true) which allows me to change the link in multiple segments.

Now repositioning nodes, changes the shape back again to straight line.

How this can be avoidable ? It should only (apply the routing algorithm to the first segment of link to which node is attached.)

Set Link | GoJS API to go.Link.End.

I suggest that you define a “LinkReshaped” DiagramEvent listener:

      "LinkReshaped": function(e) { e.subject.adjusting = go.Link.End; }

when initializing your Diagram, rather than setting it in your Link template. Add a TwoWay Binding to preserve that property. That way only links that have been reshaped by the user will route in that manner.

Thanks Walter.

But didn’t get what needs to be preserved using twoway binding.
Can you provide a template for same ?

In your link template:

    new go.Binding("adusting").makeTwoWay()

Or something that would be more space efficient in your model.

Yes, Figured out that later after adding the event as you suggested.

Now there is another issue -
When i break the line segment in two parts and then try to re-position the node then the center point remains constant.
But ports (linked position of both nodes of link) of both end of line keeps changing when one of the node moved in circular direction in canvas. When line segment broken in 3 parts , center line segment remains fixed.

How i can indicate not to change the ports when line have multiple segments. ?
FYI : I am also using link port re positioning tool to change the ports.

I don’t understand. This seems to be a different subject. Could you start a new topic and include small screenshots?

Following code should also work ?

In template :

new go.Binding(“adjusting”, “customLink”, current.AdjustEndPoint.bind(current))

And the function is -

ArchitectDiagramManager.prototype.AdjustEndPoint = function (data) {
current = this;
var isCustomLink = data.customLink;
return isCustomLink ? go.Link.End : go.Link.None;
};

And

this.diagram.addDiagramListener("LinkReshaped", function (ev) {
    ev.diagram.startTransaction("Saved Data");
    ev.diagram.model.setDataProperty(ev.subject.data, "customLink", true);
    console.log("Link Reshaped ....");
    ev.diagram.commitTransaction("Saved Data");
    if (updateData) updateData(ev.diagram.model.toJson());
});

sorry. working now. Template applied was different.