From 03ab5064d49e9029ba96b459c3a2757c8c61364e Mon Sep 17 00:00:00 2001 From: coomdev Date: Fri, 7 Jan 2022 08:11:37 +0100 Subject: [PATCH] re-enabled minimap --- src/ScrollHighlighter.svelte | 7 +++++-- src/main.ts | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ScrollHighlighter.svelte b/src/ScrollHighlighter.svelte index 122bc62..392cf0d 100644 --- a/src/ScrollHighlighter.svelte +++ b/src/ScrollHighlighter.svelte @@ -34,6 +34,7 @@ const updatePositions = (v: typeof $appState) => { } const updateViewhint = () => { + if (!$settings.sh) return; const [sw, sh] = getViewport(); const fromtop = getDistFromTop(); const containerScrollHeight = document.documentElement.scrollHeight; @@ -77,11 +78,13 @@ onDestroy(() => { {#each $appState.foundPosts as post, i} window.scrollTo(0, positions[i][2])} - style="top: {positions[i][0]}px; height: {positions[i][1]}px; background-color: {positions[i][3]}" + style="top: {positions[i][0]}px; height: {positions[ + i + ][1]}px; background-color: {positions[i][3]}" class="marker" /> {/each} - + {/if} diff --git a/src/main.ts b/src/main.ts index 42c4ecf..cf14971 100644 --- a/src/main.ts +++ b/src/main.ts @@ -248,10 +248,10 @@ const startup = async () => { const appHost = textToElement(`
`); const appInstance = new App({ target: appHost }); document.body.append(appHost); -/* + const scrollHost = textToElement(`
`); new ScrollHighlighter({ target: scrollHost }); - document.body.append(scrollHost);*/ + document.body.append(scrollHost); appState.set({ ...cappState,