Skip to content

Commit

Permalink
fix: performance opt / refactored (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
aiAdrian authored Nov 14, 2024
1 parent f0969f1 commit f939df6
Showing 1 changed file with 16 additions and 25 deletions.
41 changes: 16 additions & 25 deletions src/app/view/editor-main-view/data-views/editor.keyEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,23 +193,23 @@ export class EditorKeyEvents {
}

private onInsertAllVisibleElementsFromCopyCache(): boolean {
if ( !this.trainrunSectionPreviewLineView.getVariantIsWritable() ) {
if (!this.trainrunSectionPreviewLineView.getVariantIsWritable()) {
return true;
}
this.copyService.insertCopiedNetzgrafik();
return false;
}

private onRevertLastChange(): boolean {
if ( !this.trainrunSectionPreviewLineView.getVariantIsWritable() ) {
if (!this.trainrunSectionPreviewLineView.getVariantIsWritable()) {
return true;
}
this.undoService.undo();
return true;
}

private onDuplicate(): boolean {
if ( !this.trainrunSectionPreviewLineView.getVariantIsWritable() ) {
if (!this.trainrunSectionPreviewLineView.getVariantIsWritable()) {
return true;
}

Expand Down Expand Up @@ -500,7 +500,7 @@ export class EditorKeyEvents {
}

private onKeyPressedInsert(): boolean {
if ( !this.trainrunSectionPreviewLineView.getVariantIsWritable() ) {
if (!this.trainrunSectionPreviewLineView.getVariantIsWritable()) {
return true;
}

Expand Down Expand Up @@ -559,11 +559,7 @@ export class EditorKeyEvents {
}
});

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

if (selectedNodeDeleted) {
this.uiInteractionService.closeNodeStammdaten();
Expand All @@ -579,12 +575,6 @@ 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 @@ -599,7 +589,7 @@ export class EditorKeyEvents {
}

private onKeyPressedDelete(): boolean {
if ( !this.trainrunSectionPreviewLineView.getVariantIsWritable() ) {
if (!this.trainrunSectionPreviewLineView.getVariantIsWritable()) {
return true;
}
const selectedTrainrunSectionId = this.getSelectedTrainSectionId();
Expand Down Expand Up @@ -629,18 +619,10 @@ export class EditorKeyEvents {
/* handle Nodes and Trainruns/TrainrunSections */
if (this.filterService.isAnyFilterActive()) {
this.deleteTrainrunsAndEmptyNodesIfFilteringActive();
this.trainrunSectionService.trainrunSectionsUpdated();
this.trainrunService.trainrunsUpdated();
this.nodeSerivce.transitionsUpdated();
this.nodeSerivce.connectionsUpdated();
this.nodeSerivce.nodesUpdated();
this.noteSerivce.notesUpdated();
} else {
this.removeAllSelectedNodes();
this.nodeSerivce.transitionsUpdated();
this.nodeSerivce.connectionsUpdated();
this.nodeSerivce.nodesUpdated();
}
this.netzgrafikElementsUpdated();

/* handle Notes */
this.removeAllSelectedNotes();
Expand Down Expand Up @@ -677,4 +659,13 @@ export class EditorKeyEvents {

return false;
}


private netzgrafikElementsUpdated() {
this.trainrunSectionService.trainrunSectionsUpdated();
this.trainrunService.trainrunsUpdated();
this.nodeSerivce.transitionsUpdated();
this.nodeSerivce.connectionsUpdated();
this.nodeSerivce.nodesUpdated();
}
}

0 comments on commit f939df6

Please sign in to comment.