feat(nds): use key codes instead of keys to handle multiple layouts
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { mapKeyToNDS } from "~/utils/input";
|
||||
import { mapCodeToNDS } from "~/utils/input";
|
||||
|
||||
export type KeyDownCallback = (params: {
|
||||
key: string;
|
||||
@@ -8,7 +8,7 @@ export type KeyDownCallback = (params: {
|
||||
|
||||
export const useKeyDown = (callback: KeyDownCallback) => {
|
||||
const handleKeyDown = (event: KeyboardEvent) => {
|
||||
const ndsButton = mapKeyToNDS(event.key);
|
||||
const ndsButton = mapCodeToNDS(event.code);
|
||||
callback({
|
||||
key: ndsButton ? `NDS_${ndsButton}` : event.key,
|
||||
ndsButton,
|
||||
|
||||
Reference in New Issue
Block a user