mirror of https://github.com/jetkvm/kvm.git
feat(ui) Fix the CapsLock and Shift key for VirtualKeyboard
This commit is contained in:
parent
5f3dd89d55
commit
28249fcae9
|
@ -25,7 +25,7 @@ function KeyboardWrapper() {
|
|||
const keyboardRef = useRef<HTMLDivElement>(null);
|
||||
const { isAttachedVirtualKeyboardVisible, setAttachedVirtualKeyboardVisibility } =
|
||||
useUiStore();
|
||||
const { keysDownState, isVirtualKeyboardEnabled, setVirtualKeyboardEnabled } =
|
||||
const { keyboardLedState, keysDownState, isVirtualKeyboardEnabled, setVirtualKeyboardEnabled } =
|
||||
useHidStore();
|
||||
const { handleKeyPress, executeMacro } = useKeyboard();
|
||||
const { selectedKeyboard } = useKeyboardLayout();
|
||||
|
@ -46,9 +46,15 @@ function KeyboardWrapper() {
|
|||
return decodeModifiers(keysDownState.modifier);
|
||||
}, [keysDownState]);
|
||||
|
||||
const isCapsLockActive = useMemo(() => {
|
||||
return keyboardLedState?.caps_lock || false;
|
||||
}, [keyboardLedState]);
|
||||
|
||||
const mainLayoutName = useMemo(() => {
|
||||
return isShiftActive ? "shift" : "default";
|
||||
}, [isShiftActive]);
|
||||
// if you have the CapsLock "latched", then the shift state is inverted
|
||||
const effectiveShift = isCapsLockActive ? false === isShiftActive : isShiftActive;
|
||||
return effectiveShift ? "shift" : "default";
|
||||
}, [isCapsLockActive, isShiftActive]);
|
||||
|
||||
const keyNamesForDownKeys = useMemo(() => {
|
||||
const activeModifierMask = keysDownState.modifier || 0;
|
||||
|
|
Loading…
Reference in New Issue