fix(dees-pdf-viewer): add top scroll offset when navigating to a page in the PDF viewer

This commit is contained in:
2026-04-03 19:58:51 +00:00
parent 3defbba5fd
commit d933c47b49
3 changed files with 9 additions and 3 deletions

View File

@@ -733,8 +733,8 @@ export class DeesPdfViewer extends DeesElement {
const viewerRect = this.viewerMain.getBoundingClientRect();
const currentScrollTop = this.viewerMain.scrollTop;
// Calculate the target scroll position
const targetScrollTop = currentScrollTop + (pageRect.top - viewerRect.top) - this.viewerMain.clientTop;
// Calculate the target scroll position (offset by 16px so page doesn't touch the top edge)
const targetScrollTop = currentScrollTop + (pageRect.top - viewerRect.top) - this.viewerMain.clientTop - 16;
// Scroll to the calculated position
if (smooth) {