Merge pull request #17602 from calixteman/editor_free_highlight_lastpoint

[Editor] Fix the position of the free highlight toolbar
This commit is contained in:
calixteman 2024-01-30 20:34:47 +01:00 committed by GitHub
commit 833d7ac830
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -138,8 +138,7 @@ class HighlightEditor extends AnnotationEditor {
this.parent.drawLayer.updateLine(this.#id, highlightOutlines); this.parent.drawLayer.updateLine(this.#id, highlightOutlines);
this.parent.drawLayer.updateLine(this.#outlineId, this.#focusOutlines); this.parent.drawLayer.updateLine(this.#outlineId, this.#focusOutlines);
} }
const { x, y, width, height, lastPoint } = highlightOutlines.box; const { x, y, width, height } = highlightOutlines.box;
this.#lastPoint = lastPoint;
switch (this.rotation) { switch (this.rotation) {
case 0: case 0:
this.x = x; this.x = x;
@ -170,6 +169,11 @@ class HighlightEditor extends AnnotationEditor {
break; break;
} }
} }
const { lastPoint } = this.#focusOutlines.box;
this.#lastPoint = [
(lastPoint[0] - this.x) / this.width,
(lastPoint[1] - this.y) / this.height,
];
} }
/** @inheritdoc */ /** @inheritdoc */

View File

@ -837,8 +837,6 @@ class FreeHighlightOutline extends Outline {
y = minY - this.#innerMargin, y = minY - this.#innerMargin,
width = maxX - minX + 2 * this.#innerMargin, width = maxX - minX + 2 * this.#innerMargin,
height = maxY - minY + 2 * this.#innerMargin; height = maxY - minY + 2 * this.#innerMargin;
lastPointX = (lastPointX - x) / width;
lastPointY = (lastPointY - y) / height;
this.#bbox = { x, y, width, height, lastPoint: [lastPointX, lastPointY] }; this.#bbox = { x, y, width, height, lastPoint: [lastPointX, lastPointY] };
} }