diff --git a/projects/ng-draw-flow/src/lib/components/scene/scene.component.ts b/projects/ng-draw-flow/src/lib/components/scene/scene.component.ts index f132063..7bec035 100644 --- a/projects/ng-draw-flow/src/lib/components/scene/scene.component.ts +++ b/projects/ng-draw-flow/src/lib/components/scene/scene.component.ts @@ -111,6 +111,8 @@ export class SceneComponent implements ControlValueAccessor, OnInit { target: deletedNode, model: this.model, }); + + this.emitConnectionDeletedByNodeId(key); this.connectionsService.removeConnectionsByNodeId(key); } @@ -161,6 +163,18 @@ export class SceneComponent implements ControlValueAccessor, OnInit { }); } + private emitConnectionDeletedByNodeId(nodeId: string): void { + this.connectionsService.connections$.value + .filter( + (connection) => + connection.source.nodeId === nodeId || + connection.target.nodeId === nodeId, + ) + ?.forEach((connection) => + this.connectionDeleted.emit({target: connection, model: this.model}), + ); + } + // @ts-ignore private onChange: (value: DfDataModel) => void = (_: DfDataModel) => {}; // @ts-ignore