[fix] Shift key code / nudge (#1537)

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
This commit is contained in:
Steve Ruiz 2023-06-06 12:49:17 +01:00 committed by GitHub
parent 66b3de4a03
commit b89612bdb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View file

@ -3981,6 +3981,8 @@ export class Editor extends EventEmitter<TLEventMap> {
} }
case 'keyboard': { case 'keyboard': {
// please, please // please, please
if (info.key === 'ShiftRight') info.key = 'ShiftLeft'
if (info.key === 'AltRight') info.key = 'AltLeft'
if (info.code === 'ControlRight') info.code = 'ControlLeft' if (info.code === 'ControlRight') info.code = 'ControlLeft'
switch (info.name) { switch (info.name) {

View file

@ -161,7 +161,7 @@ export class Idle extends StateNode {
// We want to use the "actual" shift key state, // We want to use the "actual" shift key state,
// not the one that's in the editor.inputs.shiftKey, // not the one that's in the editor.inputs.shiftKey,
// because that one uses a short timeout on release // 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) const delta = new Vec2d(0, 0)

View file

@ -424,7 +424,7 @@ export class Idle extends StateNode {
// We want to use the "actual" shift key state, // We want to use the "actual" shift key state,
// not the one that's in the editor.inputs.shiftKey, // not the one that's in the editor.inputs.shiftKey,
// because that one uses a short timeout on release // 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) const delta = new Vec2d(0, 0)