From 7529c1e3dc3b236918df9cfc74c12f170ef4c847 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Tue, 30 Jan 2024 15:40:33 +0100 Subject: [PATCH] [Editor] Fix the position of the free highlight toolbar --- src/display/editor/highlight.js | 8 ++++++-- src/display/editor/outliner.js | 2 -- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/display/editor/highlight.js b/src/display/editor/highlight.js index 8082e686c..b421c19e0 100644 --- a/src/display/editor/highlight.js +++ b/src/display/editor/highlight.js @@ -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; @@ -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 */ diff --git a/src/display/editor/outliner.js b/src/display/editor/outliner.js index d3b2c57f7..8f985e2fe 100644 --- a/src/display/editor/outliner.js +++ b/src/display/editor/outliner.js @@ -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] }; }