Skip to content
Snippets Groups Projects
Commit 614e2081 authored by Maximilian Giller's avatar Maximilian Giller :squid:
Browse files

Adds some shortcuts

parent 917ec8e7
No related branches found
No related tags found
1 merge request!2Implemented editor in the react framework
Pipeline #56894 passed
......@@ -126,6 +126,13 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
this.setState({
keys: keys,
});
// Key events
if (key === "Escape") {
this.selectNode(undefined);
} else if (key === "Delete" && this.state.selectedNode !== undefined) {
this.state.selectedNode.delete();
}
}
private handleKeyUp(event: KeyboardEvent) {
......@@ -153,7 +160,6 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
const nearestNode =
this.state.graph.getClosestOtherNode(placeholderNode);
if (nearestNode !== undefined && nearestNode.distance < 4) {
console.log("Saved node click event");
this.handleNodeClick(nearestNode.node);
return;
}
......@@ -443,6 +449,8 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
) : (
""
)}
<li>DELETE to delete selected node</li>
<li>ESCAPE to unselect</li>
</ul>
<hr />
<NodeDetails
......
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