fix(caret): incorrect placement in tape mode

This commit is contained in:
Miodec 2024-07-31 15:43:20 +02:00
parent 9858d93dc2
commit 981f9668c9

View file

@ -142,11 +142,18 @@ export async function updatePosition(noAnim = false): Promise<void> {
newTop = activeWordEl.offsetTop + letterPosTop - caret.offsetHeight / 2;
}
const newLeft =
let 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);
}
const newWidth = fullWidthCaret ? (letterWidth ?? 0) + "px" : "";
let smoothlinescroll = $("#words .smoothScroller").height();