Skip to content

Commit

Permalink
Merge pull request #4589 from inception-project/bugfix/4587-Annotatio…
Browse files Browse the repository at this point in the history
…ns-are-misaligned-when-PDF-pages-vary-in-dimensions

#4587 - Annotations are misaligned when PDF pages vary in dimensions
  • Loading branch information
reckart authored Mar 4, 2024
2 parents d943d38 + 4339f94 commit a87fca0
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export function mapToDocumentCoordinates (aRectangles: Rectangle[]): Rectangle[]
const pageTopY = pageContainer.offsetTop / scale + paddingTop + marginBetweenPages
let leftOffset = 0

if (firstPageElement.clientWidth > pageContainer.clientWidth) {
// If the pages are not rendered left-aligned because one is wider than the other, we need
// to adjust the position of the rectangle on the X-axis
if (firstPageElement.clientWidth != pageContainer.clientWidth) {
const firstContainerStyle = getComputedStyle(firstPageElement)
const firstPageLeft = parseInt(firstContainerStyle.marginLeft) + parseInt(firstContainerStyle.borderLeftWidth)
const currentPageStyle = getComputedStyle(pageContainer)
Expand Down

0 comments on commit a87fca0

Please sign in to comment.