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
+4
View File
@@ -401,6 +401,10 @@ body[data-hide-meta] .meta-panel {
background-size: 24px 24px; background-size: 24px 24px;
} }
.viewer-panel.single-page-fits-height {
overflow-y: hidden;
}
.empty-state { .empty-state {
position: absolute; position: absolute;
inset: 0; inset: 0;
+2
View File
@@ -2110,6 +2110,7 @@ function scrollbarWidth() {
function updateFitSpace() { function updateFitSpace() {
const page = currentPageInfo(); const page = currentPageInfo();
if (!page || state.fitMode === "free") { if (!page || state.fitMode === "free") {
el.viewerPanel.classList.remove("single-page-fits-height");
el.pageFrame.style.removeProperty("--fit-space"); el.pageFrame.style.removeProperty("--fit-space");
el.pageFrame.style.removeProperty("--fit-gap"); el.pageFrame.style.removeProperty("--fit-gap");
return; return;
@@ -2117,6 +2118,7 @@ function updateFitSpace() {
const shell = pageShell(state.pageIndex); const shell = pageShell(state.pageIndex);
const height = shell ? shell.getBoundingClientRect().height : Math.max(1, page.height * MM_TO_PX * state.scale); const height = shell ? shell.getBoundingClientRect().height : Math.max(1, page.height * MM_TO_PX * state.scale);
const base = pageSpace(); 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 space = Math.max(base, (el.viewerPanel.clientHeight - height) / 2);
const gap = space > base ? space + 1 : space; const gap = space > base ? space + 1 : space;
el.pageFrame.style.setProperty("--fit-space", `${space}px`); el.pageFrame.style.setProperty("--fit-space", `${space}px`);