From 3c0ad329aaae77efbe8d5904a8801aeaa046a881 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Mon, 8 Feb 2021 17:32:12 +0300 Subject: [PATCH] Fixed issue #2753 --- .../controls-side-bar/draw-cuboid-control.tsx | 5 +-- .../controls-side-bar/draw-points-control.tsx | 5 +-- .../draw-polygon-control.tsx | 5 +-- .../draw-polyline-control.tsx | 5 +-- .../draw-rectangle-control.tsx | 5 +-- .../controls-side-bar/rotate-control.tsx | 4 +- .../controls-side-bar/setup-tag-control.tsx | 5 +-- .../controls-side-bar/tools-control.tsx | 43 +++++++++---------- 8 files changed, 34 insertions(+), 43 deletions(-) diff --git a/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-cuboid-control.tsx b/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-cuboid-control.tsx index 958b208bba78..0a86df2ebe90 100644 --- a/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-cuboid-control.tsx +++ b/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-cuboid-control.tsx @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // // SPDX-License-Identifier: MIT @@ -19,10 +19,9 @@ interface Props { isDrawing: boolean; } +const CustomPopover = withVisibilityHandling(Popover, 'draw-cuboid'); function DrawPolygonControl(props: Props): JSX.Element { const { canvasInstance, isDrawing } = props; - const CustomPopover = withVisibilityHandling(Popover, 'draw-cuboid'); - const dynamcPopoverPros = isDrawing ? { overlayStyle: { diff --git a/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-points-control.tsx b/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-points-control.tsx index 8127059d4a06..462e78c9d695 100644 --- a/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-points-control.tsx +++ b/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-points-control.tsx @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // // SPDX-License-Identifier: MIT @@ -18,10 +18,9 @@ interface Props { isDrawing: boolean; } +const CustomPopover = withVisibilityHandling(Popover, 'draw-points'); function DrawPointsControl(props: Props): JSX.Element { const { canvasInstance, isDrawing } = props; - const CustomPopover = withVisibilityHandling(Popover, 'draw-points'); - const dynamcPopoverPros = isDrawing ? { overlayStyle: { diff --git a/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-polygon-control.tsx b/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-polygon-control.tsx index 23f5e7549eb7..f07a324d7cf5 100644 --- a/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-polygon-control.tsx +++ b/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-polygon-control.tsx @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // // SPDX-License-Identifier: MIT @@ -18,10 +18,9 @@ interface Props { isDrawing: boolean; } +const CustomPopover = withVisibilityHandling(Popover, 'draw-polygon'); function DrawPolygonControl(props: Props): JSX.Element { const { canvasInstance, isDrawing } = props; - const CustomPopover = withVisibilityHandling(Popover, 'draw-polygon'); - const dynamcPopoverPros = isDrawing ? { overlayStyle: { diff --git a/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-polyline-control.tsx b/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-polyline-control.tsx index 2139ad4dcb9b..a1d3c157b3de 100644 --- a/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-polyline-control.tsx +++ b/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-polyline-control.tsx @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // // SPDX-License-Identifier: MIT @@ -18,10 +18,9 @@ interface Props { isDrawing: boolean; } +const CustomPopover = withVisibilityHandling(Popover, 'draw-polyline'); function DrawPolylineControl(props: Props): JSX.Element { const { canvasInstance, isDrawing } = props; - const CustomPopover = withVisibilityHandling(Popover, 'draw-polyline'); - const dynamcPopoverPros = isDrawing ? { overlayStyle: { diff --git a/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-rectangle-control.tsx b/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-rectangle-control.tsx index 50efd5183f01..0d0462818f5b 100644 --- a/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-rectangle-control.tsx +++ b/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/draw-rectangle-control.tsx @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // // SPDX-License-Identifier: MIT @@ -18,10 +18,9 @@ interface Props { isDrawing: boolean; } +const CustomPopover = withVisibilityHandling(Popover, 'draw-rectangle'); function DrawRectangleControl(props: Props): JSX.Element { const { canvasInstance, isDrawing } = props; - const CustomPopover = withVisibilityHandling(Popover, 'draw-rectangle'); - const dynamcPopoverPros = isDrawing ? { overlayStyle: { diff --git a/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/rotate-control.tsx b/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/rotate-control.tsx index 380e6b55f8a6..3aa537eba7a0 100644 --- a/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/rotate-control.tsx +++ b/cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/rotate-control.tsx @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // // SPDX-License-Identifier: MIT @@ -18,9 +18,9 @@ interface Props { rotateFrame(rotation: Rotation): void; } +const CustomPopover = withVisibilityHandling(Popover, 'rotate-canvas'); function RotateControl(props: Props): JSX.Element { const { anticlockwiseShortcut, clockwiseShortcut, rotateFrame } = props; - const CustomPopover = withVisibilityHandling(Popover, 'rotate-canvas'); return ( { private onTracking = async (e: Event): Promise => { const { - isActivated, - jobInstance, - frame, - curZOrder, - fetchAnnotations, + isActivated, jobInstance, frame, curZOrder, fetchAnnotations, } = this.props; if (!isActivated) { @@ -520,8 +517,8 @@ export class ToolsControlComponent extends React.PureComponent { min={1} precision={0} max={jobInstance.stopFrame - frame} - onChange={(value: number | undefined | string): void => { - if (typeof value !== 'undefined') { + onChange={(value: number | undefined | string | null): void => { + if (typeof value !== 'undefined' && value !== null) { this.setState({ trackingFrames: +value, }); @@ -659,19 +656,20 @@ export class ToolsControlComponent extends React.PureComponent { try { this.setState({ mode: 'detection', fetching: true }); const result = await core.lambda.call(task, model, { ...body, frame }); - const states = result.map((data: any): any => ( - new core.classes.ObjectState({ - shapeType: data.type, - label: task.labels.filter((label: any): boolean => label.name === data.label)[0], - points: data.points, - objectType: ObjectType.SHAPE, - frame, - occluded: false, - source: 'auto', - attributes: {}, - zOrder: curZOrder, - }) - )); + const states = result.map( + (data: any): any => + new core.classes.ObjectState({ + shapeType: data.type, + label: task.labels.filter((label: any): boolean => label.name === data.label)[0], + points: data.points, + objectType: ObjectType.SHAPE, + frame, + occluded: false, + source: 'auto', + attributes: {}, + zOrder: curZOrder, + }), + ); await jobInstance.annotations.put(states); fetchAnnotations(); @@ -722,7 +720,6 @@ export class ToolsControlComponent extends React.PureComponent { const { fetching, trackingProgress } = this.state; if (![...interactors, ...detectors, ...trackers].length) return null; - const CustomPopover = withVisibilityHandling(Popover, 'tools-control'); const dynamcPopoverPros = isActivated ? {