Fix strafing doesn't work (#216)

This commit is contained in:
redphx 2024-01-13 15:15:50 +07:00
parent 58f8f6e762
commit 89a5bbdd2e

View File

@ -4321,7 +4321,7 @@ class MkbHandler {
value = (buttonIndex === GamepadKey.RS_LEFT || buttonIndex === GamepadKey.RS_UP) ? -1 : 1;
}
virtualGamepad.axes[axisIndex] = pressed ? value : 0;
virtualGamepad.axes[axisIndex] += pressed ? value : - value;
} else {
virtualGamepad.buttons[buttonIndex].pressed = pressed;
virtualGamepad.buttons[buttonIndex].value = pressed ? 1 : 0;
@ -4345,6 +4345,11 @@ class MkbHandler {
return;
}
// Ignore repeating keys
if (e.repeat) {
return;
}
e.preventDefault();
this.#pressButton(buttonIndex, isKeyDown);
}