diff --git a/frontend/src/lib/components/reader/epub-reader.svelte b/frontend/src/lib/components/reader/epub-reader.svelte
index bd38bcb..edb0040 100644
--- a/frontend/src/lib/components/reader/epub-reader.svelte
+++ b/frontend/src/lib/components/reader/epub-reader.svelte
@@ -95,8 +95,9 @@
}
function navigateToChapter(href: string) {
+ // Deliberately leaves the sidebar open: picking a chapter is usually part of
+ // browsing several, and closing it each time made that tedious.
void viewer?.goTo(href);
- isSidebarOpen = false;
}
onMount(() => {
@@ -191,18 +192,10 @@
{/if}
-
-
-
-
+
+
+
{#if file}
{/if}
-
-
+
+
+
+
+
{/if}
diff --git a/frontend/src/lib/components/reader/foliate-view.svelte b/frontend/src/lib/components/reader/foliate-view.svelte
index 55e82ff..ef122d8 100644
--- a/frontend/src/lib/components/reader/foliate-view.svelte
+++ b/frontend/src/lib/components/reader/foliate-view.svelte
@@ -48,6 +48,20 @@
// Reactive so the effects below re-run once the book is open — otherwise a
// theme flip while it was still loading would never reach the book.
let ready = $state(false);
+ let hostWidth = $state(0);
+
+ /**
+ * How many columns the paginator will actually lay out.
+ *
+ * It decides this internally and exposes it only as a custom property inside
+ * its shadow root, so the formula is mirrored here to place the spread
+ * divider. Kept in step with paginator.js's `divisor`.
+ */
+ const columns = $derived(
+ settings.flow === 'scrolled' || hostWidth === 0
+ ? 1
+ : Math.min(settings.maxColumnCount, Math.ceil(hostWidth / settings.maxInlineSize))
+ );
/**
* Where to resume from.
@@ -130,6 +144,11 @@
onMount(() => {
let disposed = false;
+ const resizeObserver = new ResizeObserver(([entry]) => {
+ hostWidth = entry.contentRect.width;
+ });
+ if (container) resizeObserver.observe(container);
+
(async () => {
try {
await loadFoliate();
@@ -180,6 +199,7 @@
return () => {
disposed = true;
+ resizeObserver.disconnect();
for (const { doc } of view?.renderer?.getContents?.() ?? []) {
doc.removeEventListener('keydown', onKeydown);
}
@@ -211,9 +231,25 @@
});
-
+
+
-
+