From b89612bdb7505950e547c0dfdabd1a438bb81f4b Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Tue, 6 Jun 2023 12:49:17 +0100 Subject: [PATCH] [fix] Shift key code / nudge (#1537) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix key code when pressing Shift, which fixes nudging. ### Change Type - [x] `patch` — Bug Fix ### Test Plan 1. use the shift key to nudge things ### Release Notes - Fix shift key nudging --- packages/editor/src/lib/app/Editor.ts | 2 ++ .../src/lib/app/tools/SelectTool/children/Crop/children/Idle.ts | 2 +- packages/editor/src/lib/app/tools/SelectTool/children/Idle.ts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/editor/src/lib/app/Editor.ts b/packages/editor/src/lib/app/Editor.ts index 0a475ef63..5d0acb39f 100644 --- a/packages/editor/src/lib/app/Editor.ts +++ b/packages/editor/src/lib/app/Editor.ts @@ -3981,6 +3981,8 @@ export class Editor extends EventEmitter { } case 'keyboard': { // please, please + if (info.key === 'ShiftRight') info.key = 'ShiftLeft' + if (info.key === 'AltRight') info.key = 'AltLeft' if (info.code === 'ControlRight') info.code = 'ControlLeft' switch (info.name) { diff --git a/packages/editor/src/lib/app/tools/SelectTool/children/Crop/children/Idle.ts b/packages/editor/src/lib/app/tools/SelectTool/children/Crop/children/Idle.ts index 169a10497..f87316ef3 100644 --- a/packages/editor/src/lib/app/tools/SelectTool/children/Crop/children/Idle.ts +++ b/packages/editor/src/lib/app/tools/SelectTool/children/Crop/children/Idle.ts @@ -161,7 +161,7 @@ export class Idle extends StateNode { // We want to use the "actual" shift key state, // not the one that's in the editor.inputs.shiftKey, // because that one uses a short timeout on release - const shiftKey = keys.has('Shift') + const shiftKey = keys.has('ShiftLeft') const delta = new Vec2d(0, 0) diff --git a/packages/editor/src/lib/app/tools/SelectTool/children/Idle.ts b/packages/editor/src/lib/app/tools/SelectTool/children/Idle.ts index bc253a7f4..2257ede92 100644 --- a/packages/editor/src/lib/app/tools/SelectTool/children/Idle.ts +++ b/packages/editor/src/lib/app/tools/SelectTool/children/Idle.ts @@ -424,7 +424,7 @@ export class Idle extends StateNode { // We want to use the "actual" shift key state, // not the one that's in the editor.inputs.shiftKey, // because that one uses a short timeout on release - const shiftKey = keys.has('Shift') + const shiftKey = keys.has('ShiftLeft') const delta = new Vec2d(0, 0)