From c4345420d525a4c3c4c82a07ccbe4848bd4c1259 Mon Sep 17 00:00:00 2001 From: xiaoqidun Date: Sun, 25 Oct 2026 12:58:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=98=85=E8=AF=BB=E6=B8=B2=E6=9F=93):=20?= =?UTF-8?q?=E9=98=85=E8=AF=BB=E7=8A=B6=E6=80=81=E6=8C=89=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E7=8B=AC=E7=AB=8B=E5=B9=B6=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/webui/ofdgo.js | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/assets/webui/ofdgo.js b/assets/webui/ofdgo.js index d98b3b2..b7e1038 100644 --- a/assets/webui/ofdgo.js +++ b/assets/webui/ofdgo.js @@ -2591,7 +2591,7 @@ function advanceDocumentSequence() { } function copyApplicationPreferences(target) { - for (const key of ["pageLayoutPreference", "renderAnnotations", "renderBackend", "renderMode", "renderDPI", "showPages", "showMeta", "exportFormats"]) target[key] = state[key]; + for (const key of ["showPages", "showMeta", "exportFormats"]) target[key] = state[key]; const { fontChoice, ...defaults } = state.textDefaults; target.textDefaults = { ...defaults, ...(target.textDefaults.fontChoice ? {fontChoice: target.textDefaults.fontChoice} : {}) }; } @@ -2735,11 +2735,11 @@ function detachDocumentView() { } function attachDocumentTab(tab) { - tab.configurePending ||= tab.state.renderAnnotations !== state.renderAnnotations; copyApplicationPreferences(tab.state); workspace.active = tab; tab.touched = Date.now(); state = tab.state; + el.imageDPI.value = String(state.renderDPI); for (const face of state.svgFonts.values()) document.fonts.add(face); state.textFontID = undefined; resourceManager = tab.resources; @@ -2768,6 +2768,8 @@ function attachDocumentTab(tab) { canvasEditor.pendingSelection = tab.view?.selection || null; documentDialogs?.setOwner(tab); workspace.resourceView = resourceElements.Panel.open ? resourceManager : null; + setContinuous(state.continuous); + updatePanControl(); trimWorkspaceCaches(); renderDocumentTabs(); } @@ -6019,6 +6021,7 @@ async function refreshPageDisplay(anchor = scaleAnchor(0)) { } async function changeDisplayMode(mode = state.renderMode) { + const tab = documentTab(), state = tab.state; if (document.body.hasAttribute("data-busy")) { el.imageDPI.value = String(state.renderDPI); updateDPIControl(); @@ -6037,11 +6040,13 @@ async function changeDisplayMode(mode = state.renderMode) { } catch (err) { state.renderDPI = previous.dpi; state.renderMode = previous.mode; - el.imageDPI.value = String(previous.dpi); - resetPageLoading(); state.pageCache.clear(); - updateDisplayControls(); - showError(err, false); + if (isForegroundDocument(tab)) { + el.imageDPI.value = String(previous.dpi); + resetPageLoading(); + updateDisplayControls(); + showError(err, false); + } } } @@ -13331,11 +13336,15 @@ function togglePan() { setPan(!state.panMode); } +function updatePanControl() { + el.viewerPanel.classList.toggle("pan-mode", state.panMode); + el.panButton.setAttribute("data-pressed", String(state.panMode)); +} + function setPan(enabled) { endPan(); state.panMode = enabled; - el.viewerPanel.classList.toggle("pan-mode", state.panMode); - el.panButton.setAttribute("data-pressed", String(state.panMode)); + updatePanControl(); updateEditorTools(); } @@ -13624,8 +13633,8 @@ function updateControls() { el.panButton.disabled = !hasDoc; el.continuousButton.disabled = !hasDoc; el.pageLayoutButton.disabled = pageCount < 2 || document.body.hasAttribute("data-busy"); - el.pageLayoutButton.textContent = state.pageLayout === 1 ? "单页" : "双页"; - el.pageLayoutButton.dataset.short = state.pageLayout === 1 ? "单" : "双"; + el.pageLayoutButton.textContent = state.pageLayoutPreference === 1 ? "单页" : "双页"; + el.pageLayoutButton.dataset.short = state.pageLayoutPreference === 1 ? "单" : "双"; el.fitButton.toggleAttribute("data-pressed", hasDoc && state.fitMode === "width"); el.fitHeightButton.toggleAttribute("data-pressed", hasDoc && state.fitMode === "height"); updateAnnotationButton();