Skip to content

Commit efda6e8

Browse files
committed
Move translate shape
1 parent a73a084 commit efda6e8

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

web_ui/src/pages/annotator/tools/edit-tool/translate-shape.component.tsx renamed to web_ui/packages/smart-tools/src/edit-bounding-box/translate-shape.component.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@
33

44
import { PointerEvent, ReactNode, useState } from 'react';
55

6-
import { Annotation as AnnotationInterface } from '../../../../core/annotations/annotation.interface';
7-
import { Point } from '../../../../core/annotations/shapes.interface';
8-
import { isLeftButton } from '../../../buttons-utils';
9-
import { Annotation } from '../../annotation/annotation.component';
10-
import { PointerType } from '../tools.interface';
11-
import { allowPanning } from '../utils';
6+
import { Annotation as AnnotationInterface, Point } from '../shared/interfaces';
7+
import { allowPanning, isLeftButton } from '../utils/mouse-utils';
128

139
const STROKE_WIDTH = 2;
1410

@@ -27,7 +23,7 @@ export const TranslateShape = ({
2723
annotation,
2824
onComplete,
2925
translateShape,
30-
children = <Annotation annotation={annotation} />,
26+
children,
3127
}: TranslateShapeProps): JSX.Element => {
3228
const [dragFromPoint, setDragFromPoint] = useState<null | Point>(null);
3329

@@ -36,7 +32,7 @@ export const TranslateShape = ({
3632
return;
3733
}
3834

39-
if (event.pointerType === PointerType.Touch || !isLeftButton(event)) {
35+
if (event.pointerType === 'touch' || !isLeftButton(event)) {
4036
return;
4137
}
4238

@@ -67,7 +63,9 @@ export const TranslateShape = ({
6763
if (dragFromPoint === null) {
6864
return;
6965
}
66+
7067
event.preventDefault();
68+
7169
setDragFromPoint(null);
7270
event.currentTarget.releasePointerCapture(event.pointerId);
7371
onComplete();

0 commit comments

Comments
 (0)