From 4c5ff59bcf17ea1ae98ffbdc04a9c4f0d7a9dc96 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Tue, 24 Feb 2026 15:11:45 +0800 Subject: [PATCH] fix(layout): also scale table with parent width, closes #3284 (#3359) --- apps/readest-app/src/utils/style.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/readest-app/src/utils/style.ts b/apps/readest-app/src/utils/style.ts index 5a8c036f..d9ea2758 100644 --- a/apps/readest-app/src/utils/style.ts +++ b/apps/readest-app/src/utils/style.ts @@ -867,10 +867,16 @@ export const applyTableStyle = (document: Document) => { table.style.width = `calc(min(${computedWidth}, var(--available-width)))`; } } + const parentWidth = window.getComputedStyle(parent as Element).width; + const parentContainerWidth = parseFloat(parentWidth) || 0; if (totalTableWidth > 0) { const scale = `calc(min(1, var(--available-width) / ${totalTableWidth}))`; table.style.transformOrigin = 'left top'; table.style.transform = `scale(${scale})`; + } else if (parentContainerWidth > 0) { + const scale = `calc(min(1, var(--available-width) / ${parentContainerWidth}))`; + table.style.transformOrigin = 'center top'; + table.style.transform = `scale(${scale})`; } }); };