@@ -14,16 +14,18 @@ import Annotator from "./"
1414
1515import { testRegions } from "../ImageCanvas/index.story"
1616
17+ const middlewares = [
18+ ( store ) => ( next ) => ( action ) => {
19+ actionAddon ( action . type ) ( action )
20+ return next ( action )
21+ } ,
22+ ]
23+
1724storiesOf ( "Annotator" , module )
1825 . add ( "Basic" , ( ) => (
1926 < Annotator
2027 onExit = { actionAddon ( "onExit" ) }
21- middlewares = { [
22- ( store ) => ( next ) => ( action ) => {
23- actionAddon ( action . type ) ( action )
24- return next ( action )
25- } ,
26- ] }
28+ middlewares = { middlewares }
2729 labelImages
2830 regionClsList = { [ "Alpha" , "Beta" , "Charlie" , "Delta" ] }
2931 regionTagList = { [ "tag1" , "tag2" , "tag3" ] }
@@ -112,12 +114,7 @@ storiesOf("Annotator", module)
112114 . add ( "Annotator w/o No Region Labels or Image Labels" , ( ) => (
113115 < Annotator
114116 onExit = { actionAddon ( "onExit" ) }
115- middlewares = { [
116- ( store ) => ( next ) => ( action ) => {
117- actionAddon ( action . type ) ( action )
118- return next ( action )
119- } ,
120- ] }
117+ middlewares = { middlewares }
121118 images = { [
122119 {
123120 src : exampleImage ,
@@ -132,12 +129,7 @@ storiesOf("Annotator", module)
132129 onExit = { actionAddon ( "onExit" ) }
133130 enabledTools = { [ ] }
134131 showTags = { false }
135- middlewares = { [
136- ( store ) => ( next ) => ( action ) => {
137- actionAddon ( action . type ) ( action )
138- return next ( action )
139- } ,
140- ] }
132+ middlewares = { middlewares }
141133 images = { [
142134 {
143135 src : exampleImage ,
@@ -195,12 +187,7 @@ storiesOf("Annotator", module)
195187 . add ( "Car Annotation" , ( ) => (
196188 < Annotator
197189 onExit = { actionAddon ( "onExit" ) }
198- middlewares = { [
199- ( store ) => ( next ) => ( action ) => {
200- actionAddon ( action . type ) ( action )
201- return next ( action )
202- } ,
203- ] }
190+ middlewares = { middlewares }
204191 labelImages
205192 regionClsList = { [ "Car" , "Sign" , "Construction Barrier" ] }
206193 regionTagList = { [ "Moving" , "Stopped" , "Obstacle" ] }
@@ -650,18 +637,30 @@ storiesOf("Annotator", module)
650637 . add ( "CORs Error (Pixel Segmentation)" , ( ) => (
651638 < Annotator
652639 onExit = { actionAddon ( "onExit" ) }
653- middlewares = { [
654- ( store ) => ( next ) => ( action ) => {
655- actionAddon ( action . type ) ( action )
656- return next ( action )
640+ middlewares = { middlewares }
641+ labelImages
642+ fullImageSegmentationMode
643+ regionClsList = { [ "Alpha" , "Beta" , "Charlie" , "Delta" ] }
644+ images = { [
645+ {
646+ src : "https://placebear.com/200/300" ,
647+ name : "Frame 0036" ,
657648 } ,
658649 ] }
650+ />
651+ ) )
652+ . add ( "Modify Allowed Area" , ( ) => (
653+ < Annotator
654+ onExit = { actionAddon ( "onExit" ) }
655+ middlewares = { middlewares }
659656 labelImages
660657 fullImageSegmentationMode
658+ allowedArea = { { x : 0 , y : 0.6 , w : 0.3 , h : 0.3 } }
659+ enabledTools = { [ "modify-allowed-area" ] }
661660 regionClsList = { [ "Alpha" , "Beta" , "Charlie" , "Delta" ] }
662661 images = { [
663662 {
664- src : "https://placebear.com/200/300" ,
663+ src : exampleImage ,
665664 name : "Frame 0036" ,
666665 } ,
667666 ] }
0 commit comments