From 1a8295e1a211cd9fa2480820832e730127196720 Mon Sep 17 00:00:00 2001 From: Joshua Horton Date: Mon, 12 Jul 2021 05:29:37 +0700 Subject: [PATCH] chore(web): applies PR suggestion Co-authored-by: Marc Durdin --- .../src/keyboards/activeLayout.ts | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/common/core/web/keyboard-processor/src/keyboards/activeLayout.ts b/common/core/web/keyboard-processor/src/keyboards/activeLayout.ts index d7cd3423e7..ece6011cd8 100644 --- a/common/core/web/keyboard-processor/src/keyboards/activeLayout.ts +++ b/common/core/web/keyboard-processor/src/keyboards/activeLayout.ts @@ -219,18 +219,12 @@ namespace com.keyman.keyboards { // If it's a state key modifier, trigger its effects as part of the // keystroke. - let bitmask = 0; - switch(Lkc.kName) { - case 'K_CAPS': - bitmask = text.Codes.stateBitmasks.CAPS; - break; - case 'K_NUMLOCK': - bitmask = text.Codes.stateBitmasks.NUM_LOCK; - break; - case 'K_SCROLL': - bitmask = text.Codes.stateBitmasks.SCROLL_LOCK; - break; - } + const bitmap = { + 'K_CAPS': text.Codes.stateBitmasks.CAPS, + 'K_NUMLOCK': text.Codes.stateBitmasks.NUM_LOCK, + 'K_SCROLL': text.Codes.stateBitmasks.SCROLL_LOCK + }; + const bitmask = bitmap[Lkc.kName]; if(bitmask) { Lkc.Lstates ^= bitmask; @@ -690,4 +684,4 @@ namespace com.keyman.keyboards { return aLayout; } } -} \ No newline at end of file +}