@@ -4,51 +4,91 @@ import React, { useState } from "react"
44
55import { storiesOf } from "@storybook/react"
66import { action } from "@storybook/addon-actions"
7+ import { HotKeys } from "react-hotkeys"
78
89import DatasetEditor from "./"
910
1011const Controller = ( props ) => {
11- const [ dataset , changeOHA ] = useState ( props . initialOHA )
12+ const [ dataset , changeDataset ] = useState ( props . initialDataset )
1213 return (
1314 < DatasetEditor
1415 dataset = { dataset }
1516 onChangeDataset = { ( ...props ) => {
16- changeOHA ( ...props )
17+ changeDataset ( ...props )
1718 action ( "onChangeDataset" ) ( ...props )
1819 } }
1920 { ...props }
2021 />
2122 )
2223}
2324
24- storiesOf ( "DatasetEditor" , module ) . add ( "Basic" , ( ) => (
25- < Controller
26- initialOHA = { {
27- interface : {
28- type : "image_segmentation" ,
29- labels : [ "valid" , "invalid" ] ,
30- regionTypesAllowed : [ "bounding-box" , "polygon" , "point" ] ,
31- } ,
32- samples : [
33- {
34- imageUrl :
35- "https://s3.amazonaws.com/asset.workaround.online/example-jobs/sticky-notes/image1.jpg" ,
25+ storiesOf ( "DatasetEditor" , module )
26+ . add ( "Basic" , ( ) => (
27+ < Controller
28+ initialDataset = { {
29+ interface : {
30+ type : "image_segmentation" ,
31+ labels : [ "valid" , "invalid" ] ,
32+ regionTypesAllowed : [ "bounding-box" , "polygon" , "point" ] ,
3633 } ,
37- {
38- imageUrl :
39- "https://s3.amazonaws.com/asset.workaround.online/example-jobs/sticky-notes/image2.jpg" ,
40- } ,
41- ] ,
42- taskOutput : [
43- {
44- regionType : "bounding-box" ,
45- centerX : 0.5 ,
46- centerY : 0.5 ,
47- width : 0.25 ,
48- height : 0.25 ,
49- } ,
50- ] ,
51- } }
52- onChangeFileName = { action ( "onChangeFileName" ) }
53- />
54- ) )
34+ samples : [
35+ {
36+ imageUrl :
37+ "https://s3.amazonaws.com/asset.workaround.online/example-jobs/sticky-notes/image1.jpg" ,
38+ } ,
39+ {
40+ imageUrl :
41+ "https://s3.amazonaws.com/asset.workaround.online/example-jobs/sticky-notes/image2.jpg" ,
42+ } ,
43+ ] ,
44+ taskOutput : [
45+ {
46+ regionType : "bounding-box" ,
47+ centerX : 0.5 ,
48+ centerY : 0.5 ,
49+ width : 0.25 ,
50+ height : 0.25 ,
51+ } ,
52+ ] ,
53+ } }
54+ onChangeFileName = { action ( "onChangeFileName" ) }
55+ />
56+ ) )
57+ . add ( "Basic with Hotkeys" , ( ) => (
58+ < HotKeys
59+ keyMap = { {
60+ zoom_tool : "z" ,
61+ pan_tool : "p" ,
62+ } }
63+ >
64+ < Controller
65+ initialDataset = { {
66+ interface : {
67+ type : "image_segmentation" ,
68+ labels : [ "valid" , "invalid" ] ,
69+ regionTypesAllowed : [ "bounding-box" , "polygon" , "point" ] ,
70+ } ,
71+ samples : [
72+ {
73+ imageUrl :
74+ "https://s3.amazonaws.com/asset.workaround.online/example-jobs/sticky-notes/image1.jpg" ,
75+ } ,
76+ {
77+ imageUrl :
78+ "https://s3.amazonaws.com/asset.workaround.online/example-jobs/sticky-notes/image2.jpg" ,
79+ } ,
80+ ] ,
81+ taskOutput : [
82+ {
83+ regionType : "bounding-box" ,
84+ centerX : 0.5 ,
85+ centerY : 0.5 ,
86+ width : 0.25 ,
87+ height : 0.25 ,
88+ } ,
89+ ] ,
90+ } }
91+ onChangeFileName = { action ( "onChangeFileName" ) }
92+ />
93+ </ HotKeys >
94+ ) )
0 commit comments