I'm trying to remove an existing connection(DragConnectionCreatePolicy) between two nodes. I tried two ways, the first using this command:
this.canvas.remove(connection)
but it returns this: EXCEPTION: figure.getCanvas is not a function
The second one
var cmd = new draw2d.CommandDelete(connection);
this.canvas.getCommandStack().execute(cmd)
instead returns EXCEPTION: draw2d.CommandDelete is not a constructor
What am I mistaking?
I'm using draw2d inside an Angular 2 component.
export class sampleDraw implements OnInit {
canvas:any;
createGraph() {
this.canvas = new draw2d.Canvas("canvas-div");
}
ngOnInit(){
this.createGraph()
}
}