mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-28 00:35:25 +08:00
fixed a bug where emulator sync, layout default and opposite shift keymap would cause errors
This commit is contained in:
parent
43a6625fba
commit
53e8902724
1 changed files with 12 additions and 2 deletions
|
@ -51,9 +51,14 @@ function dynamicKeymapLegendStyle(uppercase: boolean): void {
|
|||
async function buildKeymapStrings(): Promise<void> {
|
||||
if (keymapStrings.keymap === Config.keymapLayout) return;
|
||||
|
||||
const layoutName =
|
||||
Config.keymapLayout === "overrideSync"
|
||||
? Config.layout
|
||||
: Config.keymapLayout;
|
||||
|
||||
let layout;
|
||||
try {
|
||||
layout = await Misc.getLayout(Config.keymapLayout);
|
||||
layout = await Misc.getLayout(layoutName);
|
||||
} catch (e) {
|
||||
Notifications.add(
|
||||
Misc.createErrorMessage(e, "Failed to track shift state"),
|
||||
|
@ -194,7 +199,12 @@ export async function isUsingOppositeShift(
|
|||
): Promise<boolean | null> {
|
||||
if (!leftState && !rightState) return null;
|
||||
|
||||
if (Config.oppositeShiftMode === "on") {
|
||||
if (
|
||||
Config.oppositeShiftMode === "on" ||
|
||||
(Config.oppositeShiftMode === "keymap" &&
|
||||
Config.keymapLayout === "overrideSync" &&
|
||||
Config.layout === "default")
|
||||
) {
|
||||
if (
|
||||
!rightSideKeys.includes(event.code) &&
|
||||
!leftSideKeys.includes(event.code)
|
||||
|
|
Loading…
Reference in a new issue