mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-10 07:36:09 +08:00
fix(caret): blind mode not stopping caret in tape mode word
closes #5672
This commit is contained in:
parent
b4fc3da2a6
commit
936aac677f
1 changed files with 1 additions and 22 deletions
|
@ -142,32 +142,11 @@ export async function updatePosition(noAnim = false): Promise<void> {
|
|||
newTop = activeWordEl.offsetTop + letterPosTop - caret.offsetHeight / 2;
|
||||
}
|
||||
|
||||
let newLeft =
|
||||
const newLeft =
|
||||
activeWordEl.offsetLeft +
|
||||
letterPosLeft -
|
||||
(fullWidthCaret ? 0 : caretWidth / 2);
|
||||
|
||||
const wordsWrapperWidth =
|
||||
$(document.querySelector("#wordsWrapper") as HTMLElement).width() ?? 0;
|
||||
|
||||
if (Config.tapeMode === "letter") {
|
||||
newLeft = wordsWrapperWidth / 2 - (fullWidthCaret ? 0 : caretWidth / 2);
|
||||
} else if (Config.tapeMode === "word") {
|
||||
if (inputLen === 0) {
|
||||
newLeft = wordsWrapperWidth / 2 - (fullWidthCaret ? 0 : caretWidth / 2);
|
||||
} else {
|
||||
let inputWidth = 0;
|
||||
for (let i = 0; i < inputLen; i++) {
|
||||
inputWidth += $(currentWordNodeList[i] as HTMLElement).outerWidth(
|
||||
true
|
||||
) as number;
|
||||
}
|
||||
newLeft =
|
||||
wordsWrapperWidth / 2 +
|
||||
inputWidth -
|
||||
(fullWidthCaret ? 0 : caretWidth / 2);
|
||||
}
|
||||
}
|
||||
const newWidth = fullWidthCaret ? (letterWidth ?? 0) + "px" : "";
|
||||
|
||||
let smoothlinescroll = $("#words .smoothScroller").height();
|
||||
|
|
Loading…
Add table
Reference in a new issue