Relink to original node/port

Let say we have a link from A to B.
Now I start relinking of the link, but then want to cancel relinking and attach the link back to B.

Currently I cannot drag and drop the mouse onto B in order to cancel the relinking. Instead I need to drag the link somewhere into an empty area and release the mouse. (See this example: GoJS Tools -- Northwoods Software)

Is it possible to just show the originally connected node as one of the targets of the relinking process?

Or hit the ESCape key.

I think the link validity checking is preventing the temporary link to be connected with the original port/node. In other words, during its operation the RelinkingTool is not actually disconnecting one end of the selected link, so unless duplicate links are allowed, a second link cannot be drawn between the two originally linked ports/nodes.

By the way, the same is true for the LinkingTool – no real link is made in the model until the link drawing tool completes successfully.

So here is one thing you could try:

  $(go.Diagram, . . .,
    {
      "relinkingTool.isValidLink": function(fromnode, fromport, tonode, toport) {
        var link = this.originalLink;
        if (link !== null && fromport === link.fromPort && toport === link.toPort) return true;
        return go.RelinkingTool.prototype.isValidLink.call(this, fromnode, fromport, tonode, toport);
      },

Note also that I have heard from customers for which the functionality that you want, i.e. this override, would not be permitted. That doesn’t mean that the default behavior is optimal, but that’s how it is and we don’t want to change that now.

Thank you, that worked!