Kind regards,
st.
Ah, this isn’t so easy. It requires a “hack”, making use of an override of seemingly unrelated functionality:
// pretend briefly that unconnected links are OK
myDiagram.toolManager.relinkingTool.doMouseUp = function() {
this.isUnconnectedLinkValid = true;
go.RelinkingTool.prototype.doMouseUp.call(this);
this.isUnconnectedLinkValid = false;
};
// but instead of reconnecting an existing link to nothing,
// delete the link instead!
myDiagram.toolManager.relinkingTool.reconnectLink = function(origlink, newnode, newport, forwards) {
if (this.targetPort === null) {
this.diagram.remove(origlink); // delete the link
} else { // do normal reconnection
go.RelinkingTool.prototype.reconnectLink.call(this, origlink, newnode, newport, forwards);
}
};
Awesome!!! Thank you walter.