From 9a917b4cf1ca38cb2e9defbdf9fcf85f7f576e67 Mon Sep 17 00:00:00 2001 From: m00n620 Date: Sat, 13 May 2023 06:23:32 +0800 Subject: [PATCH] fix PlanarFreehandROITool bugs --- .../planarFreehandROITool/closedContourEditLoop.ts | 2 ++ .../tools/annotation/planarFreehandROITool/drawLoop.ts | 10 ++++++++-- .../planarFreehandROITool/openContourEditLoop.ts | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/tools/src/tools/annotation/planarFreehandROITool/closedContourEditLoop.ts b/packages/tools/src/tools/annotation/planarFreehandROITool/closedContourEditLoop.ts index 1c090fee89..c60732d8b9 100644 --- a/packages/tools/src/tools/annotation/planarFreehandROITool/closedContourEditLoop.ts +++ b/packages/tools/src/tools/annotation/planarFreehandROITool/closedContourEditLoop.ts @@ -444,6 +444,8 @@ function completeClosedContourEdit(element: HTMLDivElement) { annotation.data.polyline = worldPoints; annotation.data.isOpenContour = false; + annotation.invalidated = true; + this.triggerAnnotationModified(annotation, enabledElement); } diff --git a/packages/tools/src/tools/annotation/planarFreehandROITool/drawLoop.ts b/packages/tools/src/tools/annotation/planarFreehandROITool/drawLoop.ts index 6c995e605f..e33a0f9bb0 100644 --- a/packages/tools/src/tools/annotation/planarFreehandROITool/drawLoop.ts +++ b/packages/tools/src/tools/annotation/planarFreehandROITool/drawLoop.ts @@ -229,8 +229,11 @@ function completeDrawClosedContour(element: HTMLDivElement): boolean { annotation.data.polyline = worldPoints; annotation.data.isOpenContour = false; + const { textBox } = annotation.data.handles; - this.triggerAnnotationCompleted(annotation); + if (!textBox.hasMoved) { + this.triggerAnnotationCompleted(annotation); + } this.isDrawing = false; this.drawData = undefined; @@ -296,6 +299,7 @@ function completeDrawOpenContour(element: HTMLDivElement): boolean { annotation.data.polyline = worldPoints; annotation.data.isOpenContour = true; + const { textBox } = annotation.data.handles; // Add the first and last points to the list of handles. These means they // will render handles on mouse hover. @@ -310,7 +314,9 @@ function completeDrawOpenContour(element: HTMLDivElement): boolean { findOpenUShapedContourVectorToPeak(canvasPoints, viewport); } - this.triggerAnnotationCompleted(annotation); + if (!textBox.hasMoved) { + this.triggerAnnotationCompleted(annotation); + } this.isDrawing = false; this.drawData = undefined; diff --git a/packages/tools/src/tools/annotation/planarFreehandROITool/openContourEditLoop.ts b/packages/tools/src/tools/annotation/planarFreehandROITool/openContourEditLoop.ts index 89614a6c3c..e9a69bea62 100644 --- a/packages/tools/src/tools/annotation/planarFreehandROITool/openContourEditLoop.ts +++ b/packages/tools/src/tools/annotation/planarFreehandROITool/openContourEditLoop.ts @@ -563,6 +563,8 @@ function completeOpenContourEdit(element: HTMLDivElement) { findOpenUShapedContourVectorToPeak(fusedCanvasPoints, viewport); } + annotation.invalidated = true; + this.triggerAnnotationModified(annotation, enabledElement); }