Hi Tmzl,
We suspect that you need to remove the connector only if the connection is not established between the nodes while drawing the connector using tools. If yes, please use connectorCollectionChange to achieve your requirement. Also if an existing connector has an connection between the nodes, you can move the connectors and can cancel it in the event(connectorSourceChange and connectorTargetChange) to revert back the connection. You cannot remove it in the event(connectorSourceChange and connectorTargetChange)
Code example:
$("#diagram").ejDiagram({
//define connectorcollectionchange event
connectorCollectionChange:connectorCollectionChange,
});
function connectorCollectionChange(args) {
var diagram = $("#diagram").ejDiagram("instance");
if (args.element.targetNode === null || args.element.sourceNode === null) {
args.cancel = true;
}
}
Regards,
Shyam G