Skip to content

Commit

Permalink
Fixed issue #2753
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris Sekachev committed Feb 8, 2021
1 parent 77acd7d commit 3c0ad32
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2020-2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand All @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2020-2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand All @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2020-2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand All @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2020-2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand All @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2020-2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand All @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2020-2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand All @@ -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 (
<CustomPopover
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2020-2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand All @@ -17,10 +17,9 @@ interface Props {
isDrawing: boolean;
}

const CustomPopover = withVisibilityHandling(Popover, 'setup-tag');
function SetupTagControl(props: Props): JSX.Element {
const { isDrawing } = props;
const CustomPopover = withVisibilityHandling(Popover, 'setup-tag');

const dynamcPopoverPros = isDrawing ?
{
overlayStyle: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2020-2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -56,6 +56,7 @@ interface DispatchToProps {
}

const core = getCore();
const CustomPopover = withVisibilityHandling(Popover, 'tools-control');

function mapStateToProps(state: CombinedState): StateToProps {
const { annotation } = state;
Expand All @@ -73,7 +74,7 @@ function mapStateToProps(state: CombinedState): StateToProps {
activeLabelID: annotation.drawing.activeLabelID,
labels: annotation.job.labels,
states: annotation.annotations.states,
canvasInstance,
canvasInstance: canvasInstance as Canvas,
jobInstance,
frame,
curZOrder: annotation.annotations.zLayer.cur,
Expand Down Expand Up @@ -303,11 +304,7 @@ export class ToolsControlComponent extends React.PureComponent<Props, State> {

private onTracking = async (e: Event): Promise<void> => {
const {
isActivated,
jobInstance,
frame,
curZOrder,
fetchAnnotations,
isActivated, jobInstance, frame, curZOrder, fetchAnnotations,
} = this.props;

if (!isActivated) {
Expand Down Expand Up @@ -520,8 +517,8 @@ export class ToolsControlComponent extends React.PureComponent<Props, State> {
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,
});
Expand Down Expand Up @@ -659,19 +656,20 @@ export class ToolsControlComponent extends React.PureComponent<Props, State> {
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();
Expand Down Expand Up @@ -722,7 +720,6 @@ export class ToolsControlComponent extends React.PureComponent<Props, State> {
const { fetching, trackingProgress } = this.state;

if (![...interactors, ...detectors, ...trackers].length) return null;
const CustomPopover = withVisibilityHandling(Popover, 'tools-control');

const dynamcPopoverPros = isActivated ?
{
Expand Down

0 comments on commit 3c0ad32

Please sign in to comment.