Skip to content

Commit

Permalink
fix(stage): only cache module nodes if they contain children
Browse files Browse the repository at this point in the history
Otherwise caching will result in an error, so we skip it in cases where
no children are present.

Closes #84

Signed-off-by: Lukas Mertens <[email protected]>

commit-id:30c12ec7
  • Loading branch information
lukas-mertens committed Apr 15, 2024
1 parent 1cd8690 commit bfd811d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/modules/evconf_konva/views/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,14 @@ export default class ModuleView {
ev.normal.forEach((id) => {
this._terminal_views[id].set_appearence("NORMAL");
});
this.group.cache();
if (this.group.children.length > 0) {
this.group.cache();
}
} else if (ev.type === "MODULE_MODEL_UPDATE") {
this._title.setText(this._vm.id);
this.group.cache();
if (this.group.children.length > 0) {
this.group.cache();
}
}
}

Expand Down Expand Up @@ -315,7 +319,9 @@ export default class ModuleView {
const end_align = this._vm.terminal_lookup[view.terminal_id].alignment;

this._recalculate_terminal_position(end_align, this._vm.terminal_dist[end_align]);
this.group.cache();
if (this.group.children.length > 0) {
this.group.cache();
}
}

_recalculate_terminal_position(alignment: TerminalAlignment, terminal_ids: number[], animate = false) {
Expand Down

0 comments on commit bfd811d

Please sign in to comment.