From e338e259b518e6e4b42836736479e3a284d2c8ad Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Fri, 16 Feb 2024 11:50:40 +0700 Subject: [PATCH] fix(web): disables modipress for layer-switch keys with subkeys --- web/src/engine/osk/src/input/gestures/specsForLayout.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web/src/engine/osk/src/input/gestures/specsForLayout.ts b/web/src/engine/osk/src/input/gestures/specsForLayout.ts index 551fa74165..c5688e406f 100644 --- a/web/src/engine/osk/src/input/gestures/specsForLayout.ts +++ b/web/src/engine/osk/src/input/gestures/specsForLayout.ts @@ -153,8 +153,16 @@ function buildDistFromKeyCentroidFunctor(key: KeyElement) { export function keySupportsModipress(key: KeyElement) { const keySpec = key.key.spec; + + // A key cannot reasonably support both longpresses and modipresses. + // It'd be quite ugly to overlay the subkey menu over the new layer during a modipress. + if(keySpec.sk) { + return false; + } + const modifierKeyIds = ['K_SHIFT', 'K_ALT', 'K_CTRL', 'K_NUMERALS', 'K_SYMBOLS', 'K_CURRENCIES']; for(const modKeyId of modifierKeyIds) { + if(keySpec.id == modKeyId) { return true; }