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