From 1cef89fa819fb69e0776ba2e5e4373eaabe0712a Mon Sep 17 00:00:00 2001 From: jahorton Date: Thu, 2 Nov 2023 11:58:26 +0700 Subject: [PATCH] fix(web): app/webview globe-key key-up signalling --- web/src/engine/osk/src/visualKeyboard.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/web/src/engine/osk/src/visualKeyboard.ts b/web/src/engine/osk/src/visualKeyboard.ts index 6dfbfd167b..9814cd7d2a 100644 --- a/web/src/engine/osk/src/visualKeyboard.ts +++ b/web/src/engine/osk/src/visualKeyboard.ts @@ -592,16 +592,20 @@ export default class VisualKeyboard extends EventEmitter implements Ke // Potential long-term idea: only handle the first stage; delegate future stages to // specialized handlers for the remainder of the sequence. // Should work for modipresses, too... I think. - if(gestureStage.matchedId == 'special-key-start' && gestureKey.key.spec.baseKeyID == 'K_BKSP') { - // There shouldn't be a preview host for special keys... but it doesn't hurt to add the check. - existingPreviewHost?.cancel(); + if(gestureStage.matchedId == 'special-key-start') { + if(gestureKey.key.spec.baseKeyID == 'K_BKSP') { + // There shouldn't be a preview host for special keys... but it doesn't hurt to add the check. + existingPreviewHost?.cancel(); - // Possible enhancement: maybe update the held location for the backspace if there's movement? - // But... that seems pretty low-priority. - // - // Merely constructing the instance is enough; it'll link into the sequence's events and - // handle everything that remains for the backspace from here. - handlers = [new HeldRepeater(gestureSequence, () => this.modelKeyClick(gestureKey, coord))]; + // Possible enhancement: maybe update the held location for the backspace if there's movement? + // But... that seems pretty low-priority. + // + // Merely constructing the instance is enough; it'll link into the sequence's events and + // handle everything that remains for the backspace from here. + handlers = [new HeldRepeater(gestureSequence, () => this.modelKeyClick(gestureKey, coord))]; + } else if(gestureKey.key.spec.baseKeyID == "K_LOPT") { + gestureSequence.on('complete', () => this.emit('globekey', gestureKey, false)); + } } else if(gestureStage.matchedId.indexOf('longpress') > -1) { existingPreviewHost?.cancel();