mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-12-31 12:28:50 +08:00
fix: backspace always playing error sound
This commit is contained in:
parent
68266101d0
commit
0d9a1d9da5
1 changed files with 18 additions and 11 deletions
|
|
@ -1637,15 +1637,22 @@ export function getActiveWordTopAfterAppend(data: string): number {
|
|||
}
|
||||
|
||||
// this means input, delete or composition
|
||||
function afterAnyTestInput(correctInput: boolean | null): void {
|
||||
if (
|
||||
correctInput === true ||
|
||||
Config.playSoundOnError === "off" ||
|
||||
Config.blindMode
|
||||
) {
|
||||
function afterAnyTestInput(
|
||||
type: "textInput" | "delete" | "compositionUpdate",
|
||||
correctInput: boolean | null
|
||||
): void {
|
||||
if (type === "textInput") {
|
||||
if (
|
||||
correctInput === true ||
|
||||
Config.playSoundOnError === "off" ||
|
||||
Config.blindMode
|
||||
) {
|
||||
void SoundController.playClick();
|
||||
} else {
|
||||
void SoundController.playError();
|
||||
}
|
||||
} else if (type === "delete") {
|
||||
void SoundController.playClick();
|
||||
} else {
|
||||
void SoundController.playError();
|
||||
}
|
||||
|
||||
const acc: number = Numbers.roundTo2(TestStats.calculateAccuracy());
|
||||
|
|
@ -1684,18 +1691,18 @@ export function afterTestTextInput(
|
|||
}
|
||||
}
|
||||
|
||||
afterAnyTestInput(correct);
|
||||
afterAnyTestInput("textInput", correct);
|
||||
}
|
||||
|
||||
export function afterTestCompositionUpdate(): void {
|
||||
void updateActiveWordLetters();
|
||||
// correct needs to be true to get the normal click sound
|
||||
afterAnyTestInput(true);
|
||||
afterAnyTestInput("compositionUpdate", true);
|
||||
}
|
||||
|
||||
export function afterTestDelete(): void {
|
||||
void updateActiveWordLetters();
|
||||
afterAnyTestInput(null);
|
||||
afterAnyTestInput("delete", null);
|
||||
}
|
||||
|
||||
export function beforeTestWordChange(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue