@@ -7,70 +7,114 @@ import { action as actionAddon } from "@storybook/addon-actions"
77import dancingManImage from "../ImageCanvas/dancing-man.story.jpg"
88import Annotator from "./"
99
10+ const dancingManVideo =
11+ "https://s3.us-east-1.amazonaws.com/asset.workaround.online/developer-samples/how-to-dab.mp4"
12+
1013const middlewares = [
1114 ( store ) => ( next ) => ( action ) => {
1215 actionAddon ( action . type ) ( action )
1316 return next ( action )
1417 } ,
1518]
1619
17- storiesOf ( "Annotator (Poses)" , module ) . add ( "Basic" , ( ) => (
18- < Annotator
19- onExit = { actionAddon ( "onExit" ) }
20- middlewares = { middlewares }
21- labelImages
22- enabledTools = { [ "create-keypoints" ] }
23- keypointDefinitions = { {
24- human : {
25- connections : [
26- [ "head" , "sternum" ] ,
27- [ "sternum" , "leftElbow" ] ,
28- [ "sternum" , "rightElbow" ] ,
29- ] ,
30- landmarks : {
31- head : {
32- label : "Head" ,
33- color : "#f00" ,
34- defaultPosition : [ 0 , - 0.05 ] ,
35- } ,
36- sternum : {
37- label : "Torso" ,
38- color : "#0f0" ,
39- defaultPosition : [ 0 , 0 ] ,
40- } ,
41- leftElbow : {
42- label : "Left Elbow" ,
43- color : "#00f" ,
44- defaultPosition : [ - 0.05 , 0 ] ,
45- } ,
46- rightElbow : {
47- label : "Right Elbow" ,
48- color : "#00f" ,
49- defaultPosition : [ 0.05 , 0 ] ,
20+ storiesOf ( "Annotator (Poses)" , module )
21+ . add ( "Image" , ( ) => (
22+ < Annotator
23+ onExit = { actionAddon ( "onExit" ) }
24+ middlewares = { middlewares }
25+ labelImages
26+ enabledTools = { [ "create-keypoints" ] }
27+ keypointDefinitions = { {
28+ human : {
29+ connections : [
30+ [ "head" , "sternum" ] ,
31+ [ "sternum" , "leftElbow" ] ,
32+ [ "sternum" , "rightElbow" ] ,
33+ ] ,
34+ landmarks : {
35+ head : {
36+ label : "Head" ,
37+ color : "#f00" ,
38+ defaultPosition : [ 0 , - 0.05 ] ,
39+ } ,
40+ sternum : {
41+ label : "Torso" ,
42+ color : "#0f0" ,
43+ defaultPosition : [ 0 , 0 ] ,
44+ } ,
45+ leftElbow : {
46+ label : "Left Elbow" ,
47+ color : "#00f" ,
48+ defaultPosition : [ - 0.05 , 0 ] ,
49+ } ,
50+ rightElbow : {
51+ label : "Right Elbow" ,
52+ color : "#00f" ,
53+ defaultPosition : [ 0.05 , 0 ] ,
54+ } ,
5055 } ,
5156 } ,
52- } ,
53- } }
54- images = { [
55- {
56- src : dancingManImage ,
57- name : "Dancing Man" ,
58- regions : [
59- {
60- type : "keypoints" ,
61- id : "keypoints1" ,
62- keypointsDefinitionId : "human" ,
63- highlighted : true ,
64- points : {
65- head : { x : 0.54 , y : 0.2 } ,
66- sternum : { x : 0.57 , y : 0.3 } ,
67- leftElbow : { x : 0.4 , y : 0.39 } ,
68- rightElbow : { x : 0.7 , y : 0.32 } ,
57+ } }
58+ images = { [
59+ {
60+ src : dancingManImage ,
61+ name : "Dancing Man" ,
62+ regions : [
63+ {
64+ type : "keypoints" ,
65+ id : "keypoints1" ,
66+ keypointsDefinitionId : "human" ,
67+ highlighted : true ,
68+ points : {
69+ head : { x : 0.54 , y : 0.2 } ,
70+ sternum : { x : 0.57 , y : 0.3 } ,
71+ leftElbow : { x : 0.4 , y : 0.39 } ,
72+ rightElbow : { x : 0.7 , y : 0.32 } ,
73+ } ,
74+ visible : true ,
75+ } ,
76+ ] ,
77+ } ,
78+ ] }
79+ />
80+ ) )
81+ . add ( "Video" , ( ) => (
82+ < Annotator
83+ onExit = { actionAddon ( "onExit" ) }
84+ middlewares = { middlewares }
85+ labelImages
86+ enabledTools = { [ "create-box" , "create-keypoints" ] }
87+ videoSrc = { dancingManVideo }
88+ keypointDefinitions = { {
89+ human : {
90+ connections : [
91+ [ "head" , "sternum" ] ,
92+ [ "sternum" , "leftElbow" ] ,
93+ [ "sternum" , "rightElbow" ] ,
94+ ] ,
95+ landmarks : {
96+ head : {
97+ label : "Head" ,
98+ color : "#f00" ,
99+ defaultPosition : [ 0 , - 0.05 ] ,
100+ } ,
101+ sternum : {
102+ label : "Torso" ,
103+ color : "#0f0" ,
104+ defaultPosition : [ 0 , 0 ] ,
105+ } ,
106+ leftElbow : {
107+ label : "Left Elbow" ,
108+ color : "#00f" ,
109+ defaultPosition : [ - 0.05 , 0 ] ,
110+ } ,
111+ rightElbow : {
112+ label : "Right Elbow" ,
113+ color : "#00f" ,
114+ defaultPosition : [ 0.05 , 0 ] ,
69115 } ,
70- visible : true ,
71116 } ,
72- ] ,
73- } ,
74- ] }
75- />
76- ) )
117+ } ,
118+ } }
119+ />
120+ ) )
0 commit comments