summaryrefslogtreecommitdiffstatshomepage
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/src/lib/reader/PageView.svelte17
1 files changed, 11 insertions, 6 deletions
diff --git a/frontend/src/lib/reader/PageView.svelte b/frontend/src/lib/reader/PageView.svelte
index 81fbb97..fc45cfa 100644
--- a/frontend/src/lib/reader/PageView.svelte
+++ b/frontend/src/lib/reader/PageView.svelte
@@ -23,19 +23,24 @@
}
function pagesAround(around: number) {
- const peek = (at: number) => {
- if (at < 0 || at >= chunks.length) return [];
+ const pages: PageFragment[] = [];
- const pages: PageFragment[] = [chunks[at].main];
+ const push = (at: number) => {
+ if (at < 0 || at >= chunks.length) return;
+
+ pages.push(chunks[at].main);
if (chunks[at].secondary) {
pages.push(chunks[at].secondary);
}
-
- return pages;
};
- return [...peek(lookup[around] + 1), ...peek(lookup[around] - 1)];
+ for (let i = 1; i <= 2; i++) {
+ push(lookup[around] + i);
+ push(lookup[around] - i);
+ }
+
+ return pages;
}
const next = () => gotoChunk(lookup[reader.page] + 1);