1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

[Editor] Take into account the page translation when computing the quadpoints when saving an highlight

It fixes #18360.
This commit is contained in:
Calixte Denizet 2024-07-01 23:59:37 +02:00
parent c280c520ee
commit 576aaf7cc1
4 changed files with 39 additions and 2 deletions

View file

@ -671,12 +671,13 @@ class HighlightEditor extends AnnotationEditor {
return null;
}
const [pageWidth, pageHeight] = this.pageDimensions;
const [pageX, pageY] = this.pageTranslation;
const boxes = this.#boxes;
const quadPoints = new Float32Array(boxes.length * 8);
let i = 0;
for (const { x, y, width, height } of boxes) {
const sx = x * pageWidth;
const sy = (1 - y - height) * pageHeight;
const sx = x * pageWidth + pageX;
const sy = (1 - y - height) * pageHeight + pageY;
// The specifications say that the rectangle should start from the bottom
// left corner and go counter-clockwise.
// But when opening the file in Adobe Acrobat it appears that this isn't