Merge pull request #6021 from overleaf/ae-pdf-preview-horizontal-scroll

[web] Store left offset of PDF position

GitOrigin-RevId: 77d6b52a8485a427bb59618bf42b5f4a300c260a
This commit is contained in:
Miguel Serrano
2021-12-07 10:19:10 +01:00
committed by Copybot
parent e8c645bf28
commit 9ce9b0e8d7

View File

@@ -150,12 +150,13 @@ export default class PDFJSWrapper {
const containerRect = this.container.getBoundingClientRect()
const dy = containerRect.top - pageRect.top
const dx = containerRect.left - pageRect.left
const [left, top] = pageView.viewport.convertToPdfPoint(dx, dy)
const [, , width, height] = pageView.viewport.viewBox
const [, top] = pageView.viewport.convertToPdfPoint(0, dy)
return {
page: pageIndex,
offset: { top, left: 0 },
offset: { top, left },
pageSize: { height, width },
}
}