Correct bug of not deleted link

I correct the BUG of the Link doesn't delete when it's not connected to a target port  related on issue #895
This commit is contained in:
Da Silva Rémi
2021-12-21 16:30:35 +01:00
committed by GitHub
parent 3d0521cc93
commit b2fa681494

View File

@ -163,9 +163,11 @@ export class LinkModel<G extends LinkModelGenerics = LinkModelGenerics>
remove() {
if (this.sourcePort) {
this.sourcePort.removeLink(this);
delete sourcePort;
}
if (this.targetPort) {
this.targetPort.removeLink(this);
delete targetPort;
}
super.remove();
}
@ -277,6 +279,7 @@ export class LinkModel<G extends LinkModelGenerics = LinkModelGenerics>
}
removePoint(pointModel: PointModel) {
if (this.isLastPoint(pointModel)) this.remove();
this.points.splice(this.getPointIndex(pointModel), 1);
}