From 2f5ad84ca4e00115c2db49a3cfb23b01472a2cc9 Mon Sep 17 00:00:00 2001 From: Matthias Konitzny <konitzny@ibr.cs.tu-bs.de> Date: Thu, 22 Sep 2022 17:02:36 +0200 Subject: [PATCH] Moved listener --- src/editor/editor.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/editor/editor.tsx b/src/editor/editor.tsx index 4428afe..d651644 100644 --- a/src/editor/editor.tsx +++ b/src/editor/editor.tsx @@ -96,12 +96,14 @@ export class Editor extends React.PureComponent<any, stateTypes> { this.handleRedo = this.handleRedo.bind(this); this.createCheckpoint = this.createCheckpoint.bind(this); + // Subscribe to global events document.addEventListener("keydown", (e) => { this.keyPressed(e.key); }); document.addEventListener("keyup", (e) => { this.keyReleased(e.key); }); + window.addEventListener("resize", () => this.handleResize()); this.rendererRef = React.createRef(); @@ -166,7 +168,7 @@ export class Editor extends React.PureComponent<any, stateTypes> { } /** - * Loads another graph based on the data supplied. Note: Naming currently suggests that this only loads a GRAPH, not a SPACE. Needs further work and implementation to see if that makes sense or not. + * Loads another graph based on the data supplied. * @param data Serialized graph data. * @returns True, if successful. */ @@ -190,13 +192,7 @@ export class Editor extends React.PureComponent<any, stateTypes> { graph: graph, }); - //graph.onChangeCallbacks.push(this.onGraphDataChange); - - // Subscribe to global events - window.addEventListener("resize", () => this.handleResize()); - this.handleResize(); - return true; } -- GitLab