Skip to content

Commit

Permalink
fix: performance issue fixed (part 2) (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
aiAdrian authored Nov 14, 2024
1 parent 985ae28 commit c8eb613
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/services/data/node.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export class NodeService implements OnDestroy {
this.makeLabelIDCounterMap(this.getNodes()),
);
this.filterService.clearDeletetFilterNodeLabels(deletetLabelIds);
this.deleteNodeWithoutUpdate(nodeId);
this.deleteNodeWithoutUpdate(nodeId, enforceUpdate);
if (enforceUpdate) {
this.nodesUpdated();
}
Expand Down Expand Up @@ -1277,12 +1277,13 @@ export class NodeService implements OnDestroy {
return {minCoordX: minX, minCoordY: minY, maxCoordX: maxX, maxCoordY: maxY};
}

private deleteNodeWithoutUpdate(nodeId: number) {
private deleteNodeWithoutUpdate(nodeId: number, enforceUpdate = true) {
const node = this.getNodeFromId(nodeId);
const connectedTrainrunSections = node.getConnectedTrainrunSections();
if (connectedTrainrunSections.length !== 0) {
this.trainrunSectionService.deleteListOfTrainrunSections(
node.getConnectedTrainrunSections(),
enforceUpdate
);
}
this.nodesStore.nodes = this.nodesStore.nodes.filter(
Expand Down
12 changes: 12 additions & 0 deletions src/app/view/editor-main-view/data-views/editor.keyEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,13 @@ export class EditorKeyEvents {
}
}
});

this.trainrunSectionService.trainrunSectionsUpdated();
this.trainrunService.trainrunsUpdated();
this.nodeSerivce.transitionsUpdated();
this.nodeSerivce.connectionsUpdated();
this.nodeSerivce.nodesUpdated();

if (selectedNodeDeleted) {
this.uiInteractionService.closeNodeStammdaten();
}
Expand All @@ -572,7 +578,13 @@ export class EditorKeyEvents {
this.nodeSerivce.deleteNode(n.getId(), false);
}
});

this.trainrunSectionService.trainrunSectionsUpdated();
this.trainrunService.trainrunsUpdated();
this.nodeSerivce.transitionsUpdated();
this.nodeSerivce.connectionsUpdated();
this.nodeSerivce.nodesUpdated();

if (selectedNodeDeleted) {
this.uiInteractionService.closeNodeStammdaten();
}
Expand Down

0 comments on commit c8eb613

Please sign in to comment.