@@ -24,6 +24,7 @@ const regionTypeToTool = {
24
24
const [ emptyObj , emptyArr ] = [ { } , [ ] ]
25
25
26
26
export default ( {
27
+ sampleIndex : globalSampleIndex ,
27
28
interface : iface ,
28
29
taskData = emptyArr ,
29
30
taskOutput = emptyObj ,
@@ -56,7 +57,7 @@ export default ({
56
57
const multipleRegions =
57
58
iface . multipleRegions || iface . multipleRegions === undefined
58
59
59
- const onExit = useEventCallback ( ( output ) => {
60
+ const onExit = useEventCallback ( ( output , nextAction ) => {
60
61
const regionMat = ( output . images || [ ] )
61
62
. map ( ( img ) => img . regions )
62
63
. map ( ( riaRegions ) => ( riaRegions || [ ] ) . map ( convertFromRIARegionFmt ) )
@@ -68,7 +69,13 @@ export default ({
68
69
onSaveTaskOutputItem ( i , regionMat [ i ] [ 0 ] )
69
70
}
70
71
}
71
- if ( containerProps . onExit ) containerProps . onExit ( )
72
+ if ( containerProps . onExit ) containerProps . onExit ( nextAction )
73
+ } )
74
+ const onNextImage = useEventCallback ( ( output ) => {
75
+ onExit ( output , "go-to-next" )
76
+ } )
77
+ const onPrevImage = useEventCallback ( ( output ) => {
78
+ onExit ( output , "go-to-previous" )
72
79
} )
73
80
74
81
const images = useMemo (
@@ -91,21 +98,16 @@ export default ({
91
98
) ,
92
99
[ regionTypesAllowed ]
93
100
)
94
- console . log ( {
95
- selectedImage : taskData [ selectedIndex ] . imageUrl ,
96
- taskDescription : iface . description ,
97
- ...labelProps ,
98
- enabledTools : enabledTools ,
99
- images,
100
- onExit,
101
- } )
102
101
103
102
return (
104
103
< div style = { { height : "calc(100vh - 70px)" } } >
105
104
< Annotator
105
+ key = { globalSampleIndex }
106
106
selectedImage = { taskData [ selectedIndex ] . imageUrl }
107
107
taskDescription = { iface . description }
108
108
{ ...labelProps }
109
+ onNextImage = { onNextImage }
110
+ onPrevImage = { onPrevImage }
109
111
enabledTools = { enabledTools }
110
112
images = { images }
111
113
onExit = { onExit }
0 commit comments