Key just works on weird keyboard layouts

This commit is contained in:
Gwilym Inzani 2023-04-25 21:30:55 +01:00 committed by Corwin
parent b97280edd4
commit 2106c4cefd
No known key found for this signature in database

View file

@ -78,7 +78,7 @@ export const BindingsControl: FC<{
}> = ({ bindings, setBindings }) => { }> = ({ bindings, setBindings }) => {
const [buttonToChange, setButtonToChange] = useState<GbaKey | null>(null); const [buttonToChange, setButtonToChange] = useState<GbaKey | null>(null);
const setKey = (key: string, code: string) => { const setKey = (key: string) => {
if (buttonToChange === null) return; if (buttonToChange === null) return;
const nextBindings = { const nextBindings = {
@ -87,14 +87,14 @@ export const BindingsControl: FC<{
}; };
nextBindings.Displayed[buttonToChange] = toHumanName(key).toUpperCase(); nextBindings.Displayed[buttonToChange] = toHumanName(key).toUpperCase();
nextBindings.Actual[buttonToChange] = code; nextBindings.Actual[buttonToChange] = key;
setButtonToChange(null); setButtonToChange(null);
setBindings(nextBindings); setBindings(nextBindings);
}; };
return ( return (
<ButtonWrapper onKeyDown={(evt) => setKey(evt.key, evt.code)}> <ButtonWrapper onKeyDown={(evt) => setKey(evt.key)}>
{BindingsOrder.map((x) => ( {BindingsOrder.map((x) => (
<SelectButton <SelectButton
onClick={() => setButtonToChange(x)} onClick={() => setButtonToChange(x)}