mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-08-30 12:12:40 +08:00
@@ -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;
|
||||||
|
|||||||
@@ -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`);
|
||||||
|
|||||||
Reference in New Issue
Block a user