mirror of
https://github.com/projectstorm/react-diagrams.git
synced 2025-08-26 07:51:10 +08:00
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:
@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user