feat(前端界面): 优化单页适高滚动条
build.yaml / build (push) Successful in 47s

This commit is contained in:
2026-08-24 09:37:21 +08:00
parent 39f4fffeb7
commit 0887ff1a04
2 changed files with 6 additions and 0 deletions
+2
View File
@@ -2110,6 +2110,7 @@ function scrollbarWidth() {
function updateFitSpace() {
const page = currentPageInfo();
if (!page || state.fitMode === "free") {
el.viewerPanel.classList.remove("single-page-fits-height");
el.pageFrame.style.removeProperty("--fit-space");
el.pageFrame.style.removeProperty("--fit-gap");
return;
@@ -2117,6 +2118,7 @@ function updateFitSpace() {
const shell = pageShell(state.pageIndex);
const height = shell ? shell.getBoundingClientRect().height : Math.max(1, page.height * MM_TO_PX * state.scale);
const base = pageSpace();
el.viewerPanel.classList.toggle("single-page-fits-height", state.doc.pageCount === 1 && height <= el.viewerPanel.clientHeight - base * 2);
const space = Math.max(base, (el.viewerPanel.clientHeight - height) / 2);
const gap = space > base ? space + 1 : space;
el.pageFrame.style.setProperty("--fit-space", `${space}px`);