mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-18 03:26:07 +08:00
only scrolling tape if on test screen
This commit is contained in:
parent
15f97c339e
commit
7446649780
1 changed files with 10 additions and 5 deletions
|
@ -6,6 +6,7 @@ import * as TestActive from "./states/test-active";
|
|||
import * as ConfigEvent from "./observables/config-event";
|
||||
import { debounce, throttle } from "throttle-debounce";
|
||||
import * as TestUI from "./test/test-ui";
|
||||
import { get as getActivePage } from "./states/active-page";
|
||||
|
||||
export function updateKeytips(): void {
|
||||
if (Config.swapEscAndTab) {
|
||||
|
@ -77,9 +78,13 @@ window.addEventListener("beforeunload", (event) => {
|
|||
}
|
||||
});
|
||||
|
||||
const debouncedCaretUpdate = debounce(250, async () => {
|
||||
const debouncedEvent = debounce(250, async () => {
|
||||
Caret.updatePosition();
|
||||
if (Config.tapeMode !== "off") {
|
||||
if (
|
||||
Config.tapeMode !== "off" &&
|
||||
getActivePage() === "test" &&
|
||||
!TestUI.resultVisible
|
||||
) {
|
||||
TestUI.scrollTape();
|
||||
}
|
||||
setTimeout(() => {
|
||||
|
@ -87,13 +92,13 @@ const debouncedCaretUpdate = debounce(250, async () => {
|
|||
}, 250);
|
||||
});
|
||||
|
||||
const throttledCaretHide = throttle(250, () => {
|
||||
const throttledEvent = throttle(250, () => {
|
||||
Caret.hide();
|
||||
});
|
||||
|
||||
$(window).on("resize", () => {
|
||||
throttledCaretHide();
|
||||
debouncedCaretUpdate();
|
||||
throttledEvent();
|
||||
debouncedEvent();
|
||||
});
|
||||
|
||||
ConfigEvent.subscribe((eventKey) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue