1
- // Copyright (C) 2020 Intel Corporation
1
+ // Copyright (C) 2020-2021 Intel Corporation
2
2
//
3
3
// SPDX-License-Identifier: MIT
4
4
@@ -56,6 +56,7 @@ interface DispatchToProps {
56
56
}
57
57
58
58
const core = getCore ( ) ;
59
+ const CustomPopover = withVisibilityHandling ( Popover , 'tools-control' ) ;
59
60
60
61
function mapStateToProps ( state : CombinedState ) : StateToProps {
61
62
const { annotation } = state ;
@@ -73,7 +74,7 @@ function mapStateToProps(state: CombinedState): StateToProps {
73
74
activeLabelID : annotation . drawing . activeLabelID ,
74
75
labels : annotation . job . labels ,
75
76
states : annotation . annotations . states ,
76
- canvasInstance,
77
+ canvasInstance : canvasInstance as Canvas ,
77
78
jobInstance,
78
79
frame,
79
80
curZOrder : annotation . annotations . zLayer . cur ,
@@ -303,11 +304,7 @@ export class ToolsControlComponent extends React.PureComponent<Props, State> {
303
304
304
305
private onTracking = async ( e : Event ) : Promise < void > => {
305
306
const {
306
- isActivated,
307
- jobInstance,
308
- frame,
309
- curZOrder,
310
- fetchAnnotations,
307
+ isActivated, jobInstance, frame, curZOrder, fetchAnnotations,
311
308
} = this . props ;
312
309
313
310
if ( ! isActivated ) {
@@ -520,8 +517,8 @@ export class ToolsControlComponent extends React.PureComponent<Props, State> {
520
517
min = { 1 }
521
518
precision = { 0 }
522
519
max = { jobInstance . stopFrame - frame }
523
- onChange = { ( value : number | undefined | string ) : void => {
524
- if ( typeof value !== 'undefined' ) {
520
+ onChange = { ( value : number | undefined | string | null ) : void => {
521
+ if ( typeof value !== 'undefined' && value !== null ) {
525
522
this . setState ( {
526
523
trackingFrames : + value ,
527
524
} ) ;
@@ -659,19 +656,20 @@ export class ToolsControlComponent extends React.PureComponent<Props, State> {
659
656
try {
660
657
this . setState ( { mode : 'detection' , fetching : true } ) ;
661
658
const result = await core . lambda . call ( task , model , { ...body , frame } ) ;
662
- const states = result . map ( ( data : any ) : any => (
663
- new core . classes . ObjectState ( {
664
- shapeType : data . type ,
665
- label : task . labels . filter ( ( label : any ) : boolean => label . name === data . label ) [ 0 ] ,
666
- points : data . points ,
667
- objectType : ObjectType . SHAPE ,
668
- frame,
669
- occluded : false ,
670
- source : 'auto' ,
671
- attributes : { } ,
672
- zOrder : curZOrder ,
673
- } )
674
- ) ) ;
659
+ const states = result . map (
660
+ ( data : any ) : any =>
661
+ new core . classes . ObjectState ( {
662
+ shapeType : data . type ,
663
+ label : task . labels . filter ( ( label : any ) : boolean => label . name === data . label ) [ 0 ] ,
664
+ points : data . points ,
665
+ objectType : ObjectType . SHAPE ,
666
+ frame,
667
+ occluded : false ,
668
+ source : 'auto' ,
669
+ attributes : { } ,
670
+ zOrder : curZOrder ,
671
+ } ) ,
672
+ ) ;
675
673
676
674
await jobInstance . annotations . put ( states ) ;
677
675
fetchAnnotations ( ) ;
@@ -722,7 +720,6 @@ export class ToolsControlComponent extends React.PureComponent<Props, State> {
722
720
const { fetching, trackingProgress } = this . state ;
723
721
724
722
if ( ! [ ...interactors , ...detectors , ...trackers ] . length ) return null ;
725
- const CustomPopover = withVisibilityHandling ( Popover , 'tools-control' ) ;
726
723
727
724
const dynamcPopoverPros = isActivated ?
728
725
{
0 commit comments