From eae54c16c16f4fd056eb663022e646d1e7dd2051 Mon Sep 17 00:00:00 2001 From: wadjih-bencheikh18 Date: Wed, 23 Aug 2023 18:01:35 +0100 Subject: [PATCH] refactor: make display and display value independent --- src/components/roi/annotation/ConvexHullAnnotation.tsx | 4 ++-- src/components/roi/annotation/FeretAnnotation.tsx | 6 ++++-- src/components/roi/annotation/MBRAnnotation.tsx | 7 +++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/roi/annotation/ConvexHullAnnotation.tsx b/src/components/roi/annotation/ConvexHullAnnotation.tsx index 24b68fd..801eb99 100644 --- a/src/components/roi/annotation/ConvexHullAnnotation.tsx +++ b/src/components/roi/annotation/ConvexHullAnnotation.tsx @@ -38,11 +38,11 @@ function ConvexHullAnnotation({ roi }: ConvexHullAnnotationProps) { [fontColor, fontSize], ); - if (!enabled) return null; + if (!enabled && !displayValue) return null; return ( - + {enabled && } {displayValue && ( {roi.convexHull.surface} diff --git a/src/components/roi/annotation/FeretAnnotation.tsx b/src/components/roi/annotation/FeretAnnotation.tsx index 67adff2..322cf48 100644 --- a/src/components/roi/annotation/FeretAnnotation.tsx +++ b/src/components/roi/annotation/FeretAnnotation.tsx @@ -53,7 +53,7 @@ function FeretAnnotation({ roi }: FeretAnnotationProps) { [fontColor, fontSize], ); - if (!enabled) return null; + if (!enabled && !displayValue) return null; return ( <> @@ -66,7 +66,9 @@ function FeretAnnotation({ roi }: FeretAnnotationProps) { // eslint-disable-next-line react/no-array-index-key key={`${roi.id}-${index}`} > - + {enabled && ( + + )} {displayValue && ( - + {enabled && } {displayValue && ( {roi.width} x {roi.height} ({roi.surface} pixels)