Skip to content
Snippets Groups Projects
Commit 2f5ad84c authored by Matthias Konitzny's avatar Matthias Konitzny :fire:
Browse files

Moved listener

parent 12b0c0c4
No related branches found
No related tags found
No related merge requests found
...@@ -96,12 +96,14 @@ export class Editor extends React.PureComponent<any, stateTypes> { ...@@ -96,12 +96,14 @@ export class Editor extends React.PureComponent<any, stateTypes> {
this.handleRedo = this.handleRedo.bind(this); this.handleRedo = this.handleRedo.bind(this);
this.createCheckpoint = this.createCheckpoint.bind(this); this.createCheckpoint = this.createCheckpoint.bind(this);
// Subscribe to global events
document.addEventListener("keydown", (e) => { document.addEventListener("keydown", (e) => {
this.keyPressed(e.key); this.keyPressed(e.key);
}); });
document.addEventListener("keyup", (e) => { document.addEventListener("keyup", (e) => {
this.keyReleased(e.key); this.keyReleased(e.key);
}); });
window.addEventListener("resize", () => this.handleResize());
this.rendererRef = React.createRef(); this.rendererRef = React.createRef();
...@@ -166,7 +168,7 @@ export class Editor extends React.PureComponent<any, stateTypes> { ...@@ -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. * @param data Serialized graph data.
* @returns True, if successful. * @returns True, if successful.
*/ */
...@@ -190,13 +192,7 @@ export class Editor extends React.PureComponent<any, stateTypes> { ...@@ -190,13 +192,7 @@ export class Editor extends React.PureComponent<any, stateTypes> {
graph: graph, graph: graph,
}); });
//graph.onChangeCallbacks.push(this.onGraphDataChange);
// Subscribe to global events
window.addEventListener("resize", () => this.handleResize());
this.handleResize(); this.handleResize();
return true; return true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment