From 96327c14c0e8cff57c2e20beb7573df3b285bdb2 Mon Sep 17 00:00:00 2001 From: Daniel Cho Date: Fri, 30 Jul 2021 13:21:17 -0400 Subject: [PATCH] C2LC-433: Add keyboard shortcut for pen down toggle --- docs/keyboard.md | 2 ++ src/App.js | 4 ++++ src/KeyboardInputSchemes.js | 9 +++++++++ 3 files changed, 15 insertions(+) diff --git a/docs/keyboard.md b/docs/keyboard.md index 058f88bf..47337522 100644 --- a/docs/keyboard.md +++ b/docs/keyboard.md @@ -33,6 +33,7 @@ follows. | Ctrl + Alt + p | playPauseProgram | | Ctrl + Alt + r | refreshScene | | Ctrl + Alt + s | stopProgram | +| Ctrl + Alt + n | penDownToggle | | < | decreaseProgramSpeed | | > | increaseProgramSpeed | | ? | showHide | @@ -82,6 +83,7 @@ with the starting key of a sequence. Those key bindings are as follows: | Alt + p | playPauseProgram | | Alt + r | refreshScene | | Alt + s | stopProgram | +| Alt + n | penDownToggle | | < | decreaseProgramSpeed | | > | increaseProgramSpeed | | ? | showHide | diff --git a/src/App.js b/src/App.js index 8a1da1f6..9afffd5c 100644 --- a/src/App.js +++ b/src/App.js @@ -819,6 +819,10 @@ export class App extends React.Component { this.handleChangeCharacterPosition('turnRight'); } break; + case("penDownToggle"): + const currentPendownState = this.state.drawingEnabled; + this.handleTogglePenDown(!currentPendownState); + break; default: break; } diff --git a/src/KeyboardInputSchemes.js b/src/KeyboardInputSchemes.js index 9e870fef..735ef53c 100644 --- a/src/KeyboardInputSchemes.js +++ b/src/KeyboardInputSchemes.js @@ -19,6 +19,7 @@ export type ActionName = | "announceScene" | "decreaseProgramSpeed" | "increaseProgramSpeed" + | "penDownToggle" | "playPauseProgram" | "refreshScene" | "showHide" @@ -281,6 +282,10 @@ const VoiceOverInputScheme: KeyboardInputScheme = Object.assign({ stopProgram: { keyDef: { code: "KeyS", key: "s", altKey: true}, actionName: "stopProgram" + }, + penDownToggle: { + keyDef: { code: "KeyN", key: "n", altKey: true}, + actionName: "penDownToggle" } }, ExtendedKeyboardSequences); @@ -343,6 +348,10 @@ const NvdaInputScheme = Object.assign({ keyDef: {code: "KeyS", key: "s", altKey: true, ctrlKey: true}, actionName: "stopProgram" }, + penDownToggle: { + keyDef: { code: "KeyN", key: "n", altKey: true, ctrlKey: true}, + actionName: "penDownToggle" + } }, NvdaExtendedKeyboardSequences); export const KeyboardInputSchemes:KeyboardInputSchemesType = {