mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-08-30 12:12:40 +08:00
@@ -1293,9 +1293,16 @@ function scrollToPage(index) {
|
||||
if (state.fitMode !== "height") {
|
||||
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() {
|
||||
if (state.scrollFrame || !state.doc) {
|
||||
return;
|
||||
@@ -1314,7 +1321,6 @@ function syncCurrentPageFromScroll() {
|
||||
const nextIndex = Number.parseInt(shell.dataset.pageIndex, 10);
|
||||
if (Number.isFinite(nextIndex) && nextIndex !== state.pageIndex) {
|
||||
setCurrentPage(nextIndex);
|
||||
applyFit(false);
|
||||
queueNearbyPages(nextIndex);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user