mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-22 13:36:27 +08:00
fix: tape mode not centering words on window resize
closes #6135 closes #6093
This commit is contained in:
parent
799656dcec
commit
a2f6c1f832
1 changed files with 15 additions and 1 deletions
|
|
@ -31,6 +31,7 @@ import {
|
|||
} from "@monkeytype/contracts/schemas/configs";
|
||||
import { convertRemToPixels } from "../utils/numbers";
|
||||
import { getActiveFunboxes } from "./funbox/list";
|
||||
import * as TestState from "./test-state";
|
||||
|
||||
async function gethtml2canvas(): Promise<typeof import("html2canvas").default> {
|
||||
return (await import("html2canvas")).default;
|
||||
|
|
@ -469,7 +470,7 @@ export async function updateWordsInputPosition(initial = false): Promise<void> {
|
|||
|
||||
if (Config.tapeMode !== "off") {
|
||||
el.style.top = targetTop + "px";
|
||||
el.style.left = activeWord.offsetLeft + "px";
|
||||
el.style.left = "50%";
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -938,6 +939,19 @@ export async function updateActiveWordLetters(
|
|||
|
||||
export function scrollTape(): void {
|
||||
if (ActivePage.get() !== "test" || resultVisible) return;
|
||||
|
||||
if (!TestState.isActive) {
|
||||
$("#words")
|
||||
.stop(true, false)
|
||||
.animate(
|
||||
{
|
||||
marginLeft: "50%",
|
||||
},
|
||||
SlowTimer.get() ? 0 : 125
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const wordsWrapperWidth = (
|
||||
document.querySelector("#wordsWrapper") as HTMLElement
|
||||
).offsetWidth;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue