mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-07 22:23:45 +08:00
calling line jump on resize event
triggering resize event on font size change to trigger this event handler closes #3937
This commit is contained in:
parent
6647a81ad1
commit
2abd0e69fe
2 changed files with 14 additions and 6 deletions
|
@ -1611,6 +1611,9 @@ export function setFontSize(fontSize: number, nosave?: boolean): boolean {
|
|||
saveToLocalStorage("fontSize", nosave);
|
||||
ConfigEvent.dispatch("fontSize", config.fontSize);
|
||||
|
||||
// trigger a resize event to update the layout - handled in ui.ts:108
|
||||
$(window).trigger("resize");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,12 +84,17 @@ window.addEventListener("beforeunload", (event) => {
|
|||
|
||||
const debouncedEvent = debounce(250, async () => {
|
||||
Caret.updatePosition();
|
||||
if (
|
||||
Config.tapeMode !== "off" &&
|
||||
getActivePage() === "test" &&
|
||||
!TestUI.resultVisible
|
||||
) {
|
||||
TestUI.scrollTape();
|
||||
if (getActivePage() === "test" && !TestUI.resultVisible) {
|
||||
if (Config.tapeMode !== "off") {
|
||||
TestUI.scrollTape();
|
||||
} else {
|
||||
const currentTop: number = Math.floor(
|
||||
document.querySelectorAll<HTMLElement>("#words .word")[
|
||||
TestUI.currentWordElementIndex - 1
|
||||
].offsetTop
|
||||
);
|
||||
TestUI.lineJump(currentTop);
|
||||
}
|
||||
}
|
||||
setTimeout(() => {
|
||||
Caret.show();
|
||||
|
|
Loading…
Add table
Reference in a new issue