feat(nds): use key codes instead of keys to handle multiple layouts

This commit is contained in:
2026-02-16 13:57:26 +01:00
parent 639e454732
commit d38b7c624d
3 changed files with 12 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
import { mapKeyToNDS } from "~/utils/input";
import { mapCodeToNDS } from "~/utils/input";
export type KeyUpCallback = (params: {
key: string;
@@ -7,7 +7,7 @@ export type KeyUpCallback = (params: {
export const useKeyUp = (callback: KeyUpCallback) => {
const handleKeyUp = (event: KeyboardEvent) => {
const ndsButton = mapKeyToNDS(event.key);
const ndsButton = mapCodeToNDS(event.code);
callback({
key: ndsButton ? `NDS_${ndsButton}` : event.key,
ndsButton,