From a3fdf7e57d3b3dbb5205b38c56e10dfaf99d3a88 Mon Sep 17 00:00:00 2001 From: xiaoqidun Date: Tue, 8 Sep 2026 22:42:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=89=8D=E7=AB=AF=E7=95=8C=E9=9D=A2):=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=BB=98=E8=AE=A4=E9=98=85=E8=AF=BB=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=EF=BC=8C=E5=AE=BD=E5=B1=8F=E5=8D=95=E9=A1=B5=E9=80=82?= =?UTF-8?q?=E9=AB=98=EF=BC=8C=E5=B0=8F=E5=B1=8F=E8=BF=9E=E7=BB=AD=E9=80=82?= =?UTF-8?q?=E5=AE=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/webui/ofdgo.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/assets/webui/ofdgo.js b/assets/webui/ofdgo.js index 5d0c678..09b0003 100644 --- a/assets/webui/ofdgo.js +++ b/assets/webui/ofdgo.js @@ -1250,7 +1250,10 @@ async function openDocument(options = {}) { state.doc = doc; state.pageIndex = pageIndex; state.scale = options.scale || 1; - state.fitMode = options.fitMode || "width"; + if (!options.fitMode) { + setContinuous(window.matchMedia("(max-width: 640px)").matches); + } + state.fitMode = options.fitMode || (!state.continuous && pageCount === 1 ? "height" : "width"); if (!options.skipAutoFonts && await autoLoadDocumentLocalFonts(openSeq)) { if (openSeq !== state.openSeq) { return; @@ -2406,11 +2409,15 @@ function fontMeta(font) { return parts.join(" ยท "); } -function toggleContinuous() { - const anchor = state.fitMode === "free" ? scaleAnchor() : null; - state.continuous = !state.continuous; +function setContinuous(continuous) { + state.continuous = continuous; el.pageFrame.classList.toggle("continuous", state.continuous); el.continuousButton.setAttribute("aria-pressed", String(state.continuous)); +} + +function toggleContinuous() { + const anchor = state.fitMode === "free" ? scaleAnchor() : null; + setContinuous(!state.continuous); clearStampHighlights(); if (state.fitMode === "free") { restoreScaleAnchor(anchor);