Skip to content

Commit

Permalink
Merge pull request #17602 from calixteman/editor_free_highlight_lastp…
Browse files Browse the repository at this point in the history
…oint

[Editor] Fix the position of the free highlight toolbar
  • Loading branch information
calixteman authored Jan 30, 2024
2 parents 245fd02 + 7529c1e commit 833d7ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/display/editor/highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ class HighlightEditor extends AnnotationEditor {
this.parent.drawLayer.updateLine(this.#id, highlightOutlines);
this.parent.drawLayer.updateLine(this.#outlineId, this.#focusOutlines);
}
const { x, y, width, height, lastPoint } = highlightOutlines.box;
this.#lastPoint = lastPoint;
const { x, y, width, height } = highlightOutlines.box;
switch (this.rotation) {
case 0:
this.x = x;
Expand Down Expand Up @@ -170,6 +169,11 @@ class HighlightEditor extends AnnotationEditor {
break;
}
}
const { lastPoint } = this.#focusOutlines.box;
this.#lastPoint = [
(lastPoint[0] - this.x) / this.width,
(lastPoint[1] - this.y) / this.height,
];
}

/** @inheritdoc */
Expand Down
2 changes: 0 additions & 2 deletions src/display/editor/outliner.js
Original file line number Diff line number Diff line change
Expand Up @@ -837,8 +837,6 @@ class FreeHighlightOutline extends Outline {
y = minY - this.#innerMargin,
width = maxX - minX + 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] };
}

Expand Down

0 comments on commit 833d7ac

Please sign in to comment.