From 5b981996fd150b0f29c90cedb267caf2ffe9b85e Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sat, 13 May 2023 11:19:56 +0200 Subject: [PATCH] client: keyboard shortcut issues --- CHANGELOG.md | 2 +- src/client/editor/index.js | 9 +++++++++ src/client/ui/context-menu.js | 4 ---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc209d57..1e88baae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ - multixy: doubleTap not working on touch devices - button: `x` and `y` variables not passed to `onValue` when `doubleTap` is true on touch devices - advanced syntax: update issue with clones using their own value in their properties - + - client: minor keyboard shortcut issues ## 1.24.2 diff --git a/src/client/editor/index.js b/src/client/editor/index.js index 8487a502..a24db473 100644 --- a/src/client/editor/index.js +++ b/src/client/editor/index.js @@ -521,7 +521,12 @@ class Editor { leftUiSidePanel.enable() rightUiSidePanel.enable() + + // keyboardJS hack: prevent releaseAllKeys when switching context + var locale = keyboardJS._locale + keyboardJS._locale = null keyboardJS.setContext('editing') + keyboardJS._locale = locale this.oscContainer.addEventListener('mousemove', this.mouveMoveHandler) this.oscContainer.addEventListener('mouseleave', this.mouveLeaveHandler) @@ -538,7 +543,11 @@ class Editor { document.body.classList.add('editor-disabled') document.body.classList.remove('editor-enabled') + // keyboardJS hack: prevent releaseAllKeys when switching context + var locale = keyboardJS._locale + keyboardJS._locale = null keyboardJS.setContext('global') + keyboardJS._locale = locale this.oscContainer.removeEventListener('mousemove', this.mouveMoveHandler) this.oscContainer.removeEventListener('mouseleave', this.mouveLeaveHandler) diff --git a/src/client/ui/context-menu.js b/src/client/ui/context-menu.js index 0ff808e9..fc96bd56 100644 --- a/src/client/ui/context-menu.js +++ b/src/client/ui/context-menu.js @@ -6,10 +6,6 @@ var html = require('nanohtml'), MENU_CONTAINER -// monkey patch keyboardJS to prevent loosing track of pressed keys while -// switching contexts. Works as long as we don't call reset() or pause() -keyboardJS.releaseAllKeys = ()=>{} - class ContextMenu extends UiWidget { constructor(options={}){