Skip to content

C2LC-414: Add keyboard shortcuts to change world. #336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: develop-1.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions docs/keyboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ follows.
| Ctrl + Alt + e | addCommandToEnd |
| Ctrl + Alt + d | deleteCurrentStep |
| Ctrl + Alt + i | announceScene |
| Ctrl + Alt + p | playPauseProgram |
| Ctrl + Alt + r | refreshScene |
| Ctrl + Alt + s | stopProgram |
| < | decreaseProgramSpeed |
| > | increaseProgramSpeed |
| Ctrl + Alt + p | playPauseProgram |
| Ctrl + Alt + r | refreshScene |
| ? | showHide |
| Ctrl + Alt + s | stopProgram |
| Ctrl + Alt + x, a, b, 1 | selectBackward1 |
| Ctrl + Alt + x, a, b, 2 | selectBackward2 |
| Ctrl + Alt + x, a, b, 3 | selectBackward3 |
Expand All @@ -63,14 +63,19 @@ follows.
| Ctrl + Alt + x, f, q | focusProgramSequence |
| Ctrl + Alt + x, f, s | focusScene |
| Ctrl + Alt + x, f, t | focusAddNodeToggle |
| Ctrl + Alt + x, f, w | focusWorldSelector |
| Ctrl + Alt + x, f, x | focusCharacterColumnInput |
| Ctrl + Alt + x, f, y | focusCharacterRowInput |
| Ctrl + Alt + x, f, w | focusWorldSelector |
| Ctrl + Alt + x, t, 1 | changeToDefaultTheme |
| Ctrl + Alt + x, t, 2 | changeToLightTheme |
| Ctrl + Alt + x, t, 3 | changeToDarkTheme |
| Ctrl + Alt + x, t, 4 | changeToGrayscaleTheme |
| Ctrl + Alt + x, t, 5 | changeToHighContrastTheme |
| Ctrl + Alt + x, w, 1 | changeToSketchpadWorld |
| Ctrl + Alt + x, w, 2 | changeToJungleWorld |
| Ctrl + Alt + x, w, 3 | changeToSpaceWorld |
| Ctrl + Alt + x, w, 4 | changeToDeepOceanWorld |
| Ctrl + Alt + x, w, 5 | changeToLandmarksWorld |
| Ctrl + Alt + x, x | toggleFeedbackAnnouncements |

## Alt (Apple: Option) Key Bindings
Expand All @@ -86,12 +91,12 @@ with the starting key of a sequence. Those key bindings are as follows:
| Alt + e | addCommandToEnd |
| Alt + d | deleteCurrentStep |
| Alt + i | announceScene |
| Alt + p | playPauseProgram |
| Alt + r | refreshScene |
| Alt + s | stopProgram |
| < | decreaseProgramSpeed |
| > | increaseProgramSpeed |
| Alt + p | playPauseProgram |
| Alt + r | refreshScene |
| ? | showHide |
| Alt + s | stopProgram |
| Alt + x, a, b, 1 | selectBackward1 |
| Alt + x, a, b, 2 | selectBackward2 |
| Alt + x, a, b, 3 | selectBackward3 |
Expand All @@ -118,12 +123,17 @@ with the starting key of a sequence. Those key bindings are as follows:
| Alt + x, f, q | focusProgramSequence |
| Alt + x, f, s | focusScene |
| Alt + x, f, t | focusAddNodeToggle |
| Alt + x, f, w | focusWorldSelector |
| Alt + x, f, x | focusCharacterColumnInput |
| Alt + x, f, y | focusCharacterRowInput |
| Alt + x, f, w | focusWorldSelector |
| Alt + x, t, 1 | changeToDefaultTheme |
| Alt + x, t, 2 | changeToLightTheme |
| Alt + x, t, 3 | changeToDarkTheme |
| Alt + x, t, 4 | changeToGrayscaleTheme |
| Alt + x, t, 5 | changeToHighContrastTheme |
| Alt + x, w, 1 | changeToSketchpadWorld |
| Alt + x, w, 2 | changeToJungleWorld |
| Alt + x, w, 3 | changeToSpaceWorld |
| Alt + x, w, 4 | changeToDeepOceanWorld |
| Alt + x, w, 5 | changeToLandmarksWorld |
| Alt + x, x | toggleFeedbackAnnouncements |
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "c2lc-coding-environment",
"version": "1.2.0",
"version": "1.3.0",
"private": true,
"dependencies": {
"bootstrap": "4.6.1",
Expand Down
17 changes: 16 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class App extends React.Component<AppProps, AppState> {
constructor(props: any) {
super(props);

this.version = '1.2';
this.version = '1.3';

this.appContext = {
bluetoothApiIsAvailable: FeatureDetection.bluetoothApiIsAvailable()
Expand Down Expand Up @@ -889,6 +889,21 @@ export class App extends React.Component<AppProps, AppState> {
case("changeToHighContrastTheme"):
this.setStateSettings({theme: "contrast"});
break;
case("changeToDeepOceanWorld"):
this.setStateSettings({ world: "DeepOcean"});
break;
case("changeToJungleWorld"):
this.setStateSettings({ world: "Jungle"});
break;
case("changeToLandmarksWorld"):
this.setStateSettings({ world: "Landmarks"});
break;
case("changeToSketchpadWorld"):
this.setStateSettings({ world: "Sketchpad"});
break;
case("changeToSpaceWorld"):
this.setStateSettings({ world: "Space"});
break;
default:
break;
}
Expand Down
31 changes: 31 additions & 0 deletions src/KeyboardInputSchemes.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ export type ActionName =
| "changeToGrayscaleTheme"
| "changeToHighContrastTheme"

// Change World
| "changeToDeepOceanWorld"
| "changeToJungleWorld"
| "changeToLandmarksWorld"
| "changeToSketchpadWorld"
| "changeToSpaceWorld"

// Update Program
| "deleteAll"
;
Expand Down Expand Up @@ -270,6 +277,30 @@ const ExtendedKeyboardSequences: KeyboardInputScheme = {
}
},

changeWorld: {
keyDef: { code: "KeyW", key: "w" },
sketchpad: {
keyDef: { key: "1"},
actionName: "changeToSketchpadWorld"
},
jungle: {
keyDef: { key: "2"},
actionName: "changeToJungleWorld"
},
space: {
keyDef: { key: "3"},
actionName: "changeToSpaceWorld"
},
deepOcean: {
keyDef: { key: "4"},
actionName: "changeToDeepOceanWorld"
},
landmarks: {
keyDef: { key: "5"},
actionName: "changeToLandmarksWorld"
}
},

deleteAll: {
keyDef: { code: "KeyD", key: "d" },
actionName: "deleteAll"
Expand Down