From 394c301e858e4f0505f96ff80e245f280fc6a883 Mon Sep 17 00:00:00 2001 From: Daniel Cho Date: Fri, 9 Jul 2021 14:53:25 -0400 Subject: [PATCH 1/2] C2LC-414: Add keyboard shortcuts for selecting world characters --- docs/keyboard.md | 18 ++++++++++++------ src/App.js | 9 +++++++++ src/KeyboardInputSchemes.js | 21 +++++++++++++++++++++ 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/docs/keyboard.md b/docs/keyboard.md index 40071a9f..8e2f3965 100644 --- a/docs/keyboard.md +++ b/docs/keyboard.md @@ -1,13 +1,13 @@ # Key Bindings Weavly supports several key binding schemes. These can be configured (or turned -off) using the keyboard input menu, which is displayed by default when the +off) using the keyboard input menu, which is displayed by default when the question mark key is pressed, or when the keyboard icon is clicked. ## Default Key Bindings The default key bindings are as follows: - + | Keys | Command | | ---- | ------- | | Alt + B | addCommandToBeginning | @@ -45,15 +45,18 @@ The default key bindings are as follows: | Alt + X, F, S | focusScene | | Alt + X, F, T | focusAddNodeToggle | | Alt + X, F, W | focusWorldSelector | +| Alt + X, W, 1 | selectRobotCharacter | +| Alt + X, W, 2 | selectRabbitCharacter | +| Alt + X, W, 3 | selectRocketCharacter | | Alt + X, X | toggleFeedbackAnnouncements | - - + + ## NVDA Key Bindings As NVDA makes use of many keys in combination with the alt key, an alternate key binding scheme is provided as well. Those key bindings are as follows. - + | Keys | Command | | ---- | ------- | @@ -92,4 +95,7 @@ key binding scheme is provided as well. Those key bindings are as follows. | Ctrl + Alt + X, F, S | focusScene | | Ctrl + Alt + X, F, T | focusAddNodeToggle | | Ctrl + Alt + X, F, W | focusWorldSelector | -| Ctrl + Alt + X, X | toggleFeedbackAnnouncements | \ No newline at end of file +| Ctrl + Alt + X, W, 1 | selectRobotCharacter | +| Ctrl + Alt + X, W, 2 | selectRabbitCharacter | +| Ctrl + Alt + X, W, 3 | selectRocketCharacter | +| Ctrl + Alt + X, X | toggleFeedbackAnnouncements | diff --git a/src/App.js b/src/App.js index 1227a805..9502d4d8 100644 --- a/src/App.js +++ b/src/App.js @@ -767,6 +767,15 @@ export class App extends React.Component { case("turnCharacterRight"): this.handleChangeCharacterPosition('turnRight'); break; + case("selectRobotCharacter"): + this.setStateSettings({world: "default"}); + break; + case("selectRabbitCharacter"): + this.setStateSettings({world: "forest"}); + break; + case("selectRocketCharacter"): + this.setStateSettings({world: "space"}); + break; default: break; } diff --git a/src/KeyboardInputSchemes.js b/src/KeyboardInputSchemes.js index 342705b8..bc314a6f 100644 --- a/src/KeyboardInputSchemes.js +++ b/src/KeyboardInputSchemes.js @@ -55,6 +55,11 @@ export type ActionName = | "moveCharacterDown" | "turnCharacterLeft" | "turnCharacterRight" + + // Select World Character + | "selectRobotCharacter" + | "selectRabbitCharacter" + | "selectRocketCharacter" ; type ActionKeyStep = { @@ -185,6 +190,22 @@ const ExtendedKeyboardSequences: KeyboardInputScheme = { } }, + selectWorldCharacter: { + keyDef: { code: "KeyW"}, + robotCharacter: { + keyDef: { key: "1"}, + actionName: "selectRobotCharacter" + }, + rabbitCharacter: { + keyDef: { key: "2"}, + actionName: "selectRabbitCharacter" + }, + rocketCharacter: { + keyDef: { key: "3"}, + actionName: "selectRocketCharacter" + } + }, + characterPosition: { keyDef: { code: "KeyC"}, move: { From 5ad964187efe7b877d7ddf02eedac1e55138af8b Mon Sep 17 00:00:00 2001 From: Daniel Cho Date: Fri, 16 Jul 2021 14:48:56 -0400 Subject: [PATCH 2/2] C2LC-414: Add key property in KeyDef of selectWorldCharacter --- src/KeyboardInputSchemes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KeyboardInputSchemes.js b/src/KeyboardInputSchemes.js index a132ea2e..6b059e6a 100644 --- a/src/KeyboardInputSchemes.js +++ b/src/KeyboardInputSchemes.js @@ -206,7 +206,7 @@ const ExtendedKeyboardSequences: KeyboardInputScheme = { }, selectWorldCharacter: { - keyDef: { code: "KeyW"}, + keyDef: { code: "KeyW", key: "w"}, robotCharacter: { keyDef: { key: "1"}, actionName: "selectRobotCharacter"