Search code examples
javascriptdraw2d-js

How to delete connection in draw2d.js?


I want to delete a connection between two objects in draw2d.js. I am trying to find direct method that delete a connection but i did not found it. So please tell me if any way or is there any method available that delete or disconnect connection. Thanks In advance!


Solution

  • Without CommandStack support:

    canvas.remove(connection);
    

    With CommandStack Support (undo/redo):

    var cmd =  new draw2d.command.CommandDelete(connection);
    canvas.getCommandStack().execute(cmd);