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

[Editor] Set rotated free highlight at the right position after having changed its thickness (bug 1879108)

This commit is contained in:
Calixte Denizet 2024-02-11 21:06:29 +01:00
parent 5cfaff508c
commit de1985abbb
3 changed files with 112 additions and 1 deletions

View file

@ -184,7 +184,6 @@ class DrawLayer {
const root = this.#mapping.get(id);
const defs = root.firstChild;
const path = defs.firstChild;
this.updateBox(id, line.box);
path.setAttribute("d", line.toSVGPath());
}

View file

@ -135,8 +135,21 @@ class HighlightEditor extends AnnotationEditor {
this.#focusOutlines
);
} else if (this.parent) {
const angle = this.parent.viewport.rotation;
this.parent.drawLayer.updateLine(this.#id, highlightOutlines);
this.parent.drawLayer.updateBox(
this.#id,
HighlightEditor.#rotateBbox(
this.#highlightOutlines.box,
(angle - this.rotation + 360) % 360
)
);
this.parent.drawLayer.updateLine(this.#outlineId, this.#focusOutlines);
this.parent.drawLayer.updateBox(
this.#outlineId,
HighlightEditor.#rotateBbox(this.#focusOutlines.box, angle)
);
}
const { x, y, width, height } = highlightOutlines.box;
switch (this.rotation) {