Skip to content

Commit 1fd6218

Browse files
committed
Add missing annotation color
1 parent 6308e61 commit 1fd6218

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

web_ui/packages/smart-tools/src/edit-bounding-box/edit-bounding-box/edit-bounding-box.component.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,18 @@ export const EditBoundingBox = ({
6868
>
6969
<g id={`canvas-annotation-${annotation.id}`}>
7070
<rect
71-
x={annotation.shape.x}
72-
y={annotation.shape.y}
73-
width={annotation.shape.width}
74-
height={annotation.shape.height}
75-
fill='transparent'
71+
x={shape.x}
72+
y={shape.y}
73+
width={shape.width}
74+
height={shape.height}
75+
fill={annotation.color || 'var(--intel-blue, #0068b5)'}
76+
fillOpacity='var(--annotation-fill-opacity, 0.2)'
77+
stroke={annotation.color || 'var(--intel-blue, #0068b5)'}
78+
strokeWidth={2 / zoom}
79+
strokeOpacity='var(--annotation-border-opacity, 0.8)'
80+
strokeLinecap='round'
81+
strokeDasharray='0'
82+
strokeDashoffset='0'
7683
/>
7784
</g>
7885
</TranslateShape>

web_ui/packages/smart-tools/src/shared/interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,5 @@ export interface Annotation {
6060
readonly isSelected: boolean;
6161
readonly isHidden: boolean;
6262
readonly isLocked: boolean;
63+
readonly color?: string;
6364
}

web_ui/src/pages/annotator/tools/edit-tool/edit-annotation-tool.component.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { useOutsideClick } from '../../../../hooks/outside-click/outside-click.h
1111
import { hasEqualId } from '../../../../shared/utils';
1212
import { isWheelButton } from '../../../buttons-utils';
1313
import { Labels } from '../../annotation/labels/labels.component';
14+
import { getLabelsColor } from '../../annotation/labels/utils';
1415
import { ToolType } from '../../core/annotation-tool-context.interface';
1516
import { useROI } from '../../providers/region-of-interest-provider/region-of-interest-provider.component';
1617
import { getGlobalAnnotations } from '../../providers/task-chain-provider/utils';
@@ -51,6 +52,8 @@ const EditAnnotationToolFactory = ({
5152

5253
switch (annotation.shape.shapeType) {
5354
case ShapeType.Rect: {
55+
const annotationColor = getLabelsColor(annotation.labels, selectedTask);
56+
5457
return (
5558
<EditBoundingBoxTool
5659
roi={roi}
@@ -63,7 +66,11 @@ const EditAnnotationToolFactory = ({
6366
labels: annotation.labels,
6467
});
6568
}}
66-
annotation={annotation as Annotation & { shape: { shapeType: ShapeType.Rect } }}
69+
annotation={
70+
{ ...annotation, color: annotationColor } as Annotation & {
71+
shape: { shapeType: ShapeType.Rect };
72+
}
73+
}
6774
disableTranslation={disableTranslation}
6875
disablePoints={disablePoints}
6976
/>

0 commit comments

Comments
 (0)