[Editor] Try to make the position of an edited FreeText the more accurated as possible

- Take into account the page translation,
- Take into account the correct translation for the editor border,
- Take into account the position of the first glyph in the annotation,
- Take into account the rotation of the editor.

Close #16633.
This commit is contained in:
Calixte Denizet 2023-07-05 19:46:21 +02:00
parent 35202ec0f3
commit 944c68ee85
11 changed files with 424 additions and 59 deletions

View file

@ -304,6 +304,9 @@ class AnnotationElement {
}
setRotation(angle, container = this.container) {
if (!this.data.rect) {
return;
}
const { pageWidth, pageHeight } = this.parent.viewport.rawDims;
const { width, height } = getRectDims(this.data.rect);
@ -2210,6 +2213,7 @@ class FreeTextAnnotationElement extends AnnotationElement {
);
super(parameters, { isRenderable, ignoreBorder: true });
this.textContent = parameters.data.textContent;
this.textPosition = parameters.data.textPosition;
this.annotationEditorType = AnnotationEditorType.FREETEXT;
}