fix: tape mode sometimes showing two cut off lines (for real this time)

This commit is contained in:
Miodec 2024-08-16 11:51:56 +02:00
parent 6657c02d7d
commit 46fa970086

View file

@ -552,9 +552,7 @@ function updateWordsHeight(force = false): void {
finalWrapperHeight = wrapperHeight;
}
$("#words")
.css("height", finalWordsHeight + "px")
.css("overflow", "hidden");
$("#words").css("height", "0px");
if (Config.tapeMode !== "off") {
$("#words").width("200vw");
@ -563,13 +561,18 @@ function updateWordsHeight(force = false): void {
$("#words").css({ marginLeft: "unset", width: "" });
}
$("#wordsWrapper")
.css("height", finalWrapperHeight + "px")
.css("overflow", "hidden");
$(".outOfFocusWarning").css(
"margin-top",
finalWrapperHeight / 2 - Numbers.convertRemToPixels(1) / 2 + "px"
);
setTimeout(() => {
$("#wordsWrapper")
.css("height", finalWrapperHeight + "px")
.css("overflow", "hidden");
$("#words")
.css("height", finalWordsHeight + "px")
.css("overflow", "hidden");
$(".outOfFocusWarning").css(
"margin-top",
finalWrapperHeight / 2 - Numbers.convertRemToPixels(1) / 2 + "px"
);
}, 0);
}
if (Config.mode === "zen") {
@ -918,6 +921,7 @@ export async function updateWordElement(inputOverride?: string): Promise<void> {
}
export function scrollTape(): void {
if (ActivePage.get() !== "test" || resultVisible) return;
const wordsWrapperWidth = (
document.querySelector("#wordsWrapper") as HTMLElement
).offsetWidth;