feat(前端界面): 重置打开文件状态
build.yaml / build (push) Successful in 33s

This commit is contained in:
2026-07-08 21:49:12 +08:00
parent 7048bf4cb9
commit ffd61d6412
+6 -1
View File
@@ -363,7 +363,7 @@ async function openSelectedOFD() {
try {
state.fileName = file.name || "ofdgo.ofd";
state.ofdBytes = new Uint8Array(await file.arrayBuffer());
await openDocument();
await openDocument({ pageIndex: 0, resetScroll: true });
} catch (err) {
showError(err, true);
setBusy(false);
@@ -878,6 +878,7 @@ async function openDocument(options = {}) {
await openDocument({
pageIndex,
fitMode: state.fitMode,
resetScroll: options.resetScroll,
skipAutoFonts: true,
openSeq,
});
@@ -890,6 +891,10 @@ async function openDocument(options = {}) {
renderPageList();
renderMeta();
renderPageFlow();
if (options.resetScroll) {
el.viewerPanel.scrollLeft = 0;
el.viewerPanel.scrollTop = 0;
}
applyFit(false);
await nextFrame();
await renderPage(pageIndex, { keepBusy: true, scroll: false, openSeq });