mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
Key just works on weird keyboard layouts
This commit is contained in:
parent
b97280edd4
commit
2106c4cefd
|
@ -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)}
|
||||||
|
|
Loading…
Reference in a new issue