Skip to content

Commit 6308e61

Browse files
committed
Fix translate shape style issue
1 parent b496d83 commit 6308e61

File tree

4 files changed

+30
-11
lines changed

4 files changed

+30
-11
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,17 @@ export const EditBoundingBox = ({
6565
annotation={{ ...annotation, shape }}
6666
translateShape={translate}
6767
onComplete={onComplete}
68-
/>
68+
>
69+
<g id={`canvas-annotation-${annotation.id}`}>
70+
<rect
71+
x={annotation.shape.x}
72+
y={annotation.shape.y}
73+
width={annotation.shape.width}
74+
height={annotation.shape.height}
75+
fill='transparent'
76+
/>
77+
</g>
78+
</TranslateShape>
6979
</svg>
7080

7181
{disablePoints === false ? (

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import { ANCHOR_SIZE, ResizeAnchor } from '@geti/smart-tools';
77
import { Vec2 } from '@geti/smart-tools/utils';
88

99
import { TranslateShape } from '../../../../../../packages/smart-tools/src/edit-bounding-box/translate-shape.component';
10-
import { Annotation, RegionOfInterest } from '../../../../../core/annotations/annotation.interface';
10+
import { Annotation as AnnotationType, RegionOfInterest } from '../../../../../core/annotations/annotation.interface';
1111
import { Point } from '../../../../../core/annotations/shapes.interface';
1212
import { ShapeType } from '../../../../../core/annotations/shapetype.enum';
13+
import { Annotation } from '../../../annotation/annotation.component';
1314
import { Labels } from '../../../annotation/labels/labels.component';
1415
import { AnnotationToolContext } from '../../../core/annotation-tool-context.interface';
1516
import { useROI } from '../../../providers/region-of-interest-provider/region-of-interest-provider.component';
@@ -25,7 +26,7 @@ type Circle = { x: number; y: number; r: number };
2526

2627
interface EditCircleProps {
2728
annotationToolContext: AnnotationToolContext;
28-
annotation: Annotation & { shape: { shapeType: ShapeType.Circle } };
29+
annotation: AnnotationType & { shape: { shapeType: ShapeType.Circle } };
2930
disableTranslation?: boolean;
3031
disablePoints?: boolean;
3132
}
@@ -119,7 +120,9 @@ export const EditCircle = ({
119120
annotation={{ ...annotation, shape }}
120121
translateShape={translate}
121122
onComplete={onComplete}
122-
/>
123+
>
124+
<Annotation annotation={annotation} />
125+
</TranslateShape>
123126

124127
<line
125128
x1={shape.x}

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
import { useEffect, useRef, useState } from 'react';
55

66
import { TranslateShape } from '../../../../../../packages/smart-tools/src/edit-bounding-box/translate-shape.component';
7-
import { Annotation } from '../../../../../core/annotations/annotation.interface';
7+
import { Annotation as AnnotationType } from '../../../../../core/annotations/annotation.interface';
88
import { Polygon } from '../../../../../core/annotations/shapes.interface';
99
import { ShapeType } from '../../../../../core/annotations/shapetype.enum';
10+
import { Annotation } from '../../../annotation/annotation.component';
1011
import { Labels } from '../../../annotation/labels/labels.component';
1112
import { AnnotationScene } from '../../../core/annotation-scene.interface';
1213
import { AnnotationToolContext, ToolType } from '../../../core/annotation-tool-context.interface';
@@ -20,12 +21,12 @@ import classes from './../../../annotator-canvas.module.scss';
2021

2122
interface EditPolygonProps {
2223
annotationToolContext: AnnotationToolContext;
23-
annotation: Annotation & { shape: { shapeType: ShapeType.Polygon } };
24+
annotation: AnnotationType & { shape: { shapeType: ShapeType.Polygon } };
2425
disableTranslation?: boolean;
2526
disablePoints?: boolean;
2627
}
2728

28-
const updateOrRemovePolygonAnnotation = (annotation: Annotation, scene: AnnotationScene): void => {
29+
const updateOrRemovePolygonAnnotation = (annotation: AnnotationType, scene: AnnotationScene): void => {
2930
if (isPolygonValid(annotation.shape as Polygon)) {
3031
scene.updateAnnotation({ ...annotation });
3132
} else {
@@ -122,7 +123,9 @@ export const EditPolygon = ({
122123
annotation={{ ...annotation, shape }}
123124
onComplete={() => onComplete(shape)}
124125
disabled={disableTranslation || isBrushSubTool}
125-
/>
126+
>
127+
<Annotation annotation={annotation} />
128+
</TranslateShape>
126129
</svg>
127130

128131
{shape.points.length > 0 && !isBrushSubTool && <Labels annotation={{ ...annotation, shape }} />}

web_ui/src/pages/annotator/tools/edit-tool/edit-rotated-bounding-box/edit-rotated-bounding-box.component.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ import {
1414
} from '@geti/smart-tools/utils';
1515

1616
import { TranslateShape } from '../../../../../../packages/smart-tools/src/edit-bounding-box/translate-shape.component';
17-
import { Annotation } from '../../../../../core/annotations/annotation.interface';
17+
import { Annotation as AnnotationType } from '../../../../../core/annotations/annotation.interface';
1818
import { ShapeType } from '../../../../../core/annotations/shapetype.enum';
19+
import { Annotation } from '../../../annotation/annotation.component';
1920
import { AnnotationToolContext } from '../../../core/annotation-tool-context.interface';
2021
import { useROI } from '../../../providers/region-of-interest-provider/region-of-interest-provider.component';
2122
import { useZoom } from '../../../zoom/zoom-provider.component';
@@ -28,7 +29,7 @@ import classes from './../../../annotator-canvas.module.scss';
2829

2930
interface EditRotatedBoundingBoxProps {
3031
annotationToolContext: AnnotationToolContext;
31-
annotation: Annotation & { shape: { shapeType: ShapeType.RotatedRect } };
32+
annotation: AnnotationType & { shape: { shapeType: ShapeType.RotatedRect } };
3233
disableTranslation?: boolean;
3334
disablePoints?: boolean;
3435
}
@@ -181,7 +182,9 @@ export const EditRotatedBoundingBox = ({
181182
annotation={{ ...annotation, shape }}
182183
translateShape={translate}
183184
onComplete={onComplete}
184-
/>
185+
>
186+
<Annotation annotation={annotation} />
187+
</TranslateShape>
185188
</svg>
186189

187190
{disablePoints === false ? (

0 commit comments

Comments
 (0)