feat(前端界面): 优化前端展示
build.yaml / build (push) Successful in 36s

This commit is contained in:
2026-07-09 13:02:02 +08:00
parent 64536cd49b
commit 5b8b015bfc
+7 -1
View File
@@ -1293,9 +1293,16 @@ function scrollToPage(index) {
if (state.fitMode !== "height") { if (state.fitMode !== "height") {
el.viewerPanel.scrollTop = Math.max(0, el.viewerPanel.scrollTop - pageBlockSpace()); el.viewerPanel.scrollTop = Math.max(0, el.viewerPanel.scrollTop - pageBlockSpace());
} }
centerPageInline(shell);
} }
} }
function centerPageInline(shell) {
const viewerRect = el.viewerPanel.getBoundingClientRect();
const shellRect = shell.getBoundingClientRect();
el.viewerPanel.scrollLeft += shellRect.left + shellRect.width / 2 - viewerRect.left - el.viewerPanel.clientWidth / 2;
}
function schedulePageSync() { function schedulePageSync() {
if (state.scrollFrame || !state.doc) { if (state.scrollFrame || !state.doc) {
return; return;
@@ -1314,7 +1321,6 @@ function syncCurrentPageFromScroll() {
const nextIndex = Number.parseInt(shell.dataset.pageIndex, 10); const nextIndex = Number.parseInt(shell.dataset.pageIndex, 10);
if (Number.isFinite(nextIndex) && nextIndex !== state.pageIndex) { if (Number.isFinite(nextIndex) && nextIndex !== state.pageIndex) {
setCurrentPage(nextIndex); setCurrentPage(nextIndex);
applyFit(false);
queueNearbyPages(nextIndex); queueNearbyPages(nextIndex);
} }
} }