@searpent/react-image-annotate 2.3.4 → 2.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/Annotator/examplePhotos.js +28 -28
  2. package/Annotator/examplePhotos_repr.js +28 -28
  3. package/Annotator/index.js +38 -31
  4. package/Annotator/index.story_bugdemo_15_1.js +895 -773
  5. package/Annotator/index.story_repr.js +1048 -933
  6. package/Annotator/reducers/convert-expanding-line-to-polygon.js +15 -16
  7. package/ClassSelectionMenu/index.js +55 -35
  8. package/Crosshairs/index.js +30 -23
  9. package/DebugSidebarBox/index.js +40 -9
  10. package/DemoSite/Editor.js +124 -79
  11. package/DemoSite/ErrorBoundaryDialog.js +19 -6
  12. package/DemoSite/index.js +26 -17
  13. package/Editor/index.js +70 -36
  14. package/Editor/index_bugdemo_15_1.js +68 -35
  15. package/Editor/readOnly.js +178 -127
  16. package/Errorer/index.js +8 -3
  17. package/FullImageSegmentationAnnotator/index.js +6 -3
  18. package/GroupSelectorSidebarBox/index.js +48 -32
  19. package/GroupsEditorSidebarBox/index.js +75 -40
  20. package/HelpSidebarBox/index.js +24 -13
  21. package/HighlightBox/index.js +37 -30
  22. package/HistorySidebarBox/index.js +51 -29
  23. package/ImageCanvas/index.js +165 -130
  24. package/ImageMask/index.js +9 -6
  25. package/ImageSelectorSidebarBox/index.js +44 -26
  26. package/KeyframeTimeline/index.js +65 -45
  27. package/KeyframesSelectorSidebarBox/index.js +76 -54
  28. package/LandingPage/index.js +76 -38
  29. package/Locker/index.js +8 -3
  30. package/MainLayout/RightSidebarItemsWrapper.js +7 -4
  31. package/MainLayout/icon-dictionary.js +99 -66
  32. package/MainLayout/index.js +256 -196
  33. package/MainLayout/index_bugdemo_15_1.js +253 -195
  34. package/MetadataEditorSidebarBox/index.js +152 -102
  35. package/MetadataEditorSidebarBox/index_14_01_25.js +152 -102
  36. package/MetadataEditorSidebarBox/index_repr.js +183 -128
  37. package/PageSelector/UpdatedBySemaphore.js +54 -0
  38. package/PageSelector/index.js +172 -96
  39. package/PageSelector/page-selector.css +126 -2
  40. package/PointDistances/index.js +45 -33
  41. package/PreventScrollToParents/index.js +16 -9
  42. package/RegionLabel/index.js +217 -165
  43. package/RegionSelectAndTransformBoxes/index.js +131 -105
  44. package/RegionSelectorSidebarBox/index.js +243 -165
  45. package/RegionShapes/index.js +213 -153
  46. package/RegionTags/index.js +83 -69
  47. package/SettingsDialog/index.js +50 -37
  48. package/SettingsProvider/index.js +8 -5
  49. package/Shortcuts/ShortcutField.js +21 -14
  50. package/Shortcuts/index.js +18 -12
  51. package/ShortcutsManager/index.js +7 -4
  52. package/Sidebar/index.js +46 -29
  53. package/SidebarBoxContainer/index.js +14 -7
  54. package/SmallToolButton/index.js +23 -16
  55. package/TagsSidebarBox/index.js +41 -28
  56. package/TaskDescriptionSidebarBox/index.js +24 -13
  57. package/Theme/index.js +8 -3
  58. package/VideoOrImageCanvasBackground/index.js +30 -17
  59. package/package.json +1 -1
  60. package/utils/spellcheck-nspell.js +2 -2
@@ -25,29 +25,32 @@ var middlewares = [function (store) {
25
25
  };
26
26
  }];
27
27
  storiesOf("Annotator", module).add("Basic", function () {
28
- return React.createElement(Annotator, {
29
- onExit: actionAddon("onExit"),
30
- middlewares: middlewares,
31
- labelImages: true,
32
- regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
33
- regionTagList: ["tag1", "tag2", "tag3"],
34
- imageClsList: ["Alpha", "Beta", "Charlie", "Delta"],
35
- imageTagList: ["tag1", "tag2", "tag3"],
36
- images: [{
37
- src: exampleImage,
38
- name: "Seve's Desk",
39
- regions: testRegions
40
- }, {
41
- src: "https://loremflickr.com/100/100/cars?lock=1",
42
- name: "Frame 0036"
43
- }, {
44
- src: "https://loremflickr.com/100/100/cars?lock=2",
45
- name: "Frame 0037"
46
- }, {
47
- src: "https://loremflickr.com/100/100/cars?lock=3",
48
- name: "Frame 0038"
49
- }]
50
- });
28
+ return (
29
+ /*#__PURE__*/
30
+ React.createElement(Annotator, {
31
+ onExit: actionAddon("onExit"),
32
+ middlewares: middlewares,
33
+ labelImages: true,
34
+ regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
35
+ regionTagList: ["tag1", "tag2", "tag3"],
36
+ imageClsList: ["Alpha", "Beta", "Charlie", "Delta"],
37
+ imageTagList: ["tag1", "tag2", "tag3"],
38
+ images: [{
39
+ src: exampleImage,
40
+ name: "Seve's Desk",
41
+ regions: testRegions
42
+ }, {
43
+ src: "https://loremflickr.com/100/100/cars?lock=1",
44
+ name: "Frame 0036"
45
+ }, {
46
+ src: "https://loremflickr.com/100/100/cars?lock=2",
47
+ name: "Frame 0037"
48
+ }, {
49
+ src: "https://loremflickr.com/100/100/cars?lock=3",
50
+ name: "Frame 0038"
51
+ }]
52
+ })
53
+ );
51
54
  }).add("Basic with onImagesChange", function () {
52
55
  // Use exampleImages which has regions with groupId to reproduce the MainLayout bug
53
56
  // The bug: when selectedGroupId is null but regions have groupId, filtering returns empty blocks
@@ -65,639 +68,716 @@ storiesOf("Annotator", module).add("Basic", function () {
65
68
  selectedGroupId: null
66
69
  });
67
70
  }) : photosToImages([examplePhotos[0]]);
68
- return React.createElement(HotKeys, {
69
- keyMap: defaultKeyMap
70
- }, React.createElement("div", null, React.createElement("div", {
71
- style: {
72
- padding: "10px",
73
- backgroundColor: "#fff3cd",
74
- marginBottom: "10px",
75
- border: "1px solid #ffc107"
76
- }
77
- }, React.createElement("strong", null, "\u26A0\uFE0F Bug Reproduction Test:"), React.createElement("br", null), "Images have regions with ", React.createElement("code", null, "groupId=\"0\""), ", but ", React.createElement("code", null, "selectedGroupId"), " may be null.", React.createElement("br", null), React.createElement("strong", null, "To see the bug:"), " Toggle \"Edit mode\" ON. If text disappears, the bug is present.", React.createElement("br", null), React.createElement("strong", null, "Expected after fix:"), " Text should remain visible because MainLayout now shows all blocks when selectedGroupId is null."), React.createElement("div", null, React.createElement(Annotator, {
78
- middlewares: middlewares,
79
- labelImages: true,
80
- regionClsList: ["author", "appendix", "photo_author", "photo_caption", "advertisement", "other_graphics", "unknown", "title", "about_author", "image", "subtitle", "interview", "table", "text", "continuation_ref", "cover_clip", "page_id", "continuation_mark", "follow_up_mark", "article_termination_mark", "page_splitting_stripe", "column_id_stripe", "prev_page_reference", "section_subcategory"],
81
- help: "# Tools\n\n**E** - select tool\n\n**D** - frame tool\n\n**Ctrl** + **click frame** - edit frame\n\n**1**- **9** - change class",
82
- onImagesChange: function onImagesChange(images) {
83
- return console.log("[images changed to]:", images);
71
+ return (
72
+ /*#__PURE__*/
73
+ React.createElement(HotKeys, {
74
+ keyMap: defaultKeyMap
84
75
  },
85
- images: imagesToUse,
86
- clsColors: {
87
- title: "#f70202",
88
- subtitle: "#ffb405",
89
- text: "#14deef",
90
- author: "#f8d51e",
91
- appendix: "#bfede2",
92
- photo_author: "#9a17bb",
93
- photo_caption: "#ff84f6",
94
- advertisement: "#ffb201",
95
- other_graphics: "#ff5400",
96
- unknown: "#bfede2",
97
- about_author: "#9a17bb",
98
- image: "#14deef",
99
- interview: "#23b20f",
100
- table: "#02b4ba",
101
- continuation_ref: '#FF33CC',
102
- cover_clip: '#669966',
103
- page_id: '#4433AA',
104
- continuation_mark: '#660066',
105
- follow_up_mark: '#873e23',
106
- article_termination_mark: '#873e23',
107
- page_splitting_stripe: '#873e23',
108
- column_id_stripe: '#873e23',
109
- prev_page_reference: '#f3a864',
110
- section_subcategory: '#442c55'
111
- } // groupColors={[
112
- // "#3853F1",
113
- // "#F6E54C",
114
- // "#39D33C",
115
- // "#CF24CF",
116
- // "#22E3ED",
117
- // "#EF3029",
118
- // ]}
119
- ,
120
- enabledTools: [],
121
- groupColors: ['#343434', '#989898', '#dcdcdc'],
122
- onGroupSelect: function onGroupSelect(groupId) {
123
- return console.log('selected groupid:', groupId);
76
+ /*#__PURE__*/
77
+ React.createElement("div", null,
78
+ /*#__PURE__*/
79
+ React.createElement("div", {
80
+ style: {
81
+ padding: "10px",
82
+ backgroundColor: "#fff3cd",
83
+ marginBottom: "10px",
84
+ border: "1px solid #ffc107"
85
+ }
124
86
  },
125
- hideHeader: true,
126
- hideHistory: true,
127
- hideNotEditingLabel: true,
128
- showEditor: true,
129
- showPageSelector: true,
130
- albumMetadata: [{
131
- key: "issueNumber",
132
- value: "12"
133
- }, {
134
- key: "issueType",
135
- value: "news"
136
- }],
137
- metadataConfigs: [{
138
- key: "issueNumber",
139
- level: "album",
140
- options: []
141
- }, {
142
- key: "issueType",
143
- level: "album",
144
- options: ['news', 'magazine', 'q&a']
145
- }, {
146
- key: "mutation",
147
- level: "photo",
148
- options: ['Morava', 'Slezsko', 'Cechy']
149
- }, {
150
- key: "previousArticleId",
151
- level: "photo_metadata-engine",
152
- options: [{
153
- value: "alpha",
154
- label: "0 - alpha"
87
+ /*#__PURE__*/
88
+ React.createElement("strong", null, "\u26A0\uFE0F Bug Reproduction Test:"),
89
+ /*#__PURE__*/
90
+ React.createElement("br", null), "Images have regions with ",
91
+ /*#__PURE__*/
92
+ React.createElement("code", null, "groupId=\"0\""), ", but ",
93
+ /*#__PURE__*/
94
+ React.createElement("code", null, "selectedGroupId"), " may be null.",
95
+ /*#__PURE__*/
96
+ React.createElement("br", null),
97
+ /*#__PURE__*/
98
+ React.createElement("strong", null, "To see the bug:"), " Toggle \"Edit mode\" ON. If text disappears, the bug is present.",
99
+ /*#__PURE__*/
100
+ React.createElement("br", null),
101
+ /*#__PURE__*/
102
+ React.createElement("strong", null, "Expected after fix:"), " Text should remain visible because MainLayout now shows all blocks when selectedGroupId is null."),
103
+ /*#__PURE__*/
104
+ React.createElement("div", null,
105
+ /*#__PURE__*/
106
+ React.createElement(Annotator, {
107
+ middlewares: middlewares,
108
+ labelImages: true,
109
+ regionClsList: ["author", "appendix", "photo_author", "photo_caption", "advertisement", "other_graphics", "unknown", "title", "about_author", "image", "subtitle", "interview", "table", "text", "continuation_ref", "cover_clip", "page_id", "continuation_mark", "follow_up_mark", "article_termination_mark", "page_splitting_stripe", "column_id_stripe", "prev_page_reference", "section_subcategory"],
110
+ help: "# Tools\n\n**E** - select tool\n\n**D** - frame tool\n\n**Ctrl** + **click frame** - edit frame\n\n**1**- **9** - change class",
111
+ onImagesChange: function onImagesChange(images) {
112
+ return console.log("[images changed to]:", images);
113
+ },
114
+ images: imagesToUse,
115
+ clsColors: {
116
+ title: "#f70202",
117
+ subtitle: "#ffb405",
118
+ text: "#14deef",
119
+ author: "#f8d51e",
120
+ appendix: "#bfede2",
121
+ photo_author: "#9a17bb",
122
+ photo_caption: "#ff84f6",
123
+ advertisement: "#ffb201",
124
+ other_graphics: "#ff5400",
125
+ unknown: "#bfede2",
126
+ about_author: "#9a17bb",
127
+ image: "#14deef",
128
+ interview: "#23b20f",
129
+ table: "#02b4ba",
130
+ continuation_ref: '#FF33CC',
131
+ cover_clip: '#669966',
132
+ page_id: '#4433AA',
133
+ continuation_mark: '#660066',
134
+ follow_up_mark: '#873e23',
135
+ article_termination_mark: '#873e23',
136
+ page_splitting_stripe: '#873e23',
137
+ column_id_stripe: '#873e23',
138
+ prev_page_reference: '#f3a864',
139
+ section_subcategory: '#442c55'
140
+ } // groupColors={[
141
+ // "#3853F1",
142
+ // "#F6E54C",
143
+ // "#39D33C",
144
+ // "#CF24CF",
145
+ // "#22E3ED",
146
+ // "#EF3029",
147
+ // ]}
148
+ ,
149
+ enabledTools: [],
150
+ groupColors: ['#343434', '#989898', '#dcdcdc'],
151
+ onGroupSelect: function onGroupSelect(groupId) {
152
+ return console.log('selected groupid:', groupId);
153
+ },
154
+ hideHeader: true,
155
+ hideHistory: true,
156
+ hideNotEditingLabel: true,
157
+ showEditor: true,
158
+ showPageSelector: true,
159
+ albumMetadata: [{
160
+ key: "issueNumber",
161
+ value: "12"
155
162
  }, {
156
- value: "beta",
157
- label: "1 - beta"
163
+ key: "issueType",
164
+ value: "news"
165
+ }],
166
+ metadataConfigs: [{
167
+ key: "issueNumber",
168
+ level: "album",
169
+ options: []
158
170
  }, {
159
- value: "gamma",
160
- label: "2 - gamma"
161
- }]
162
- }, {
163
- key: "pageNumber",
164
- level: "photo",
165
- options: []
166
- }, {
167
- key: "articleType",
168
- level: "photo_metadata-engine",
169
- // options: ['news', 'ads', 'interview']
170
- selectable: true,
171
- options: [{
172
- value: "alpha",
173
- label: "0 - alpha"
171
+ key: "issueType",
172
+ level: "album",
173
+ options: ['news', 'magazine', 'q&a']
174
174
  }, {
175
- value: "beta",
176
- label: "1 - beta"
175
+ key: "mutation",
176
+ level: "photo",
177
+ options: ['Morava', 'Slezsko', 'Cechy']
177
178
  }, {
178
- value: "gamma",
179
- label: "2 - gamma"
180
- }]
181
- }, {
182
- key: "section",
183
- level: "photo_metadata-engine",
184
- options: ['editorial', 'article', 'last page']
185
- }],
186
- onSelectedImageChange: function onSelectedImageChange(d) {
187
- return console.log("[onSelectedImageChange] triggered:", d);
188
- },
189
- onExit: function onExit(s) {
190
- return console.log('[onExit] triggered:', s);
191
- },
192
- save:
193
- /*#__PURE__*/
194
- function () {
195
- var _ref2 = _asyncToGenerator(
179
+ key: "previousArticleId",
180
+ level: "photo_metadata-engine",
181
+ options: [{
182
+ value: "alpha",
183
+ label: "0 - alpha"
184
+ }, {
185
+ value: "beta",
186
+ label: "1 - beta"
187
+ }, {
188
+ value: "gamma",
189
+ label: "2 - gamma"
190
+ }]
191
+ }, {
192
+ key: "pageNumber",
193
+ level: "photo",
194
+ options: []
195
+ }, {
196
+ key: "articleType",
197
+ level: "photo_metadata-engine",
198
+ // options: ['news', 'ads', 'interview']
199
+ selectable: true,
200
+ options: [{
201
+ value: "alpha",
202
+ label: "0 - alpha"
203
+ }, {
204
+ value: "beta",
205
+ label: "1 - beta"
206
+ }, {
207
+ value: "gamma",
208
+ label: "2 - gamma"
209
+ }]
210
+ }, {
211
+ key: "section",
212
+ level: "photo_metadata-engine",
213
+ options: ['editorial', 'article', 'last page']
214
+ }],
215
+ onSelectedImageChange: function onSelectedImageChange(d) {
216
+ return console.log("[onSelectedImageChange] triggered:", d);
217
+ },
218
+ onExit: function onExit(s) {
219
+ return console.log('[onExit] triggered:', s);
220
+ },
221
+ save:
196
222
  /*#__PURE__*/
197
- _regeneratorRuntime.mark(function _callee(_ref) {
198
- var image, triggerRecalc, albumMetadata;
199
- return _regeneratorRuntime.wrap(function _callee$(_context) {
200
- while (1) {
201
- switch (_context.prev = _context.next) {
202
- case 0:
203
- image = _ref.image, triggerRecalc = _ref.triggerRecalc, albumMetadata = _ref.albumMetadata;
204
- console.log("[SYNC] image ".concat(image.id, " saving... recalc: ").concat(triggerRecalc, " albumMetadata: ").concat(albumMetadata.length));
205
- return _context.abrupt("return", new Promise(function (resolve, reject) {
206
- setTimeout(function () {
207
- var lockedUntil = null;
223
+ function () {
224
+ var _ref2 = _asyncToGenerator(
225
+ /*#__PURE__*/
226
+ _regeneratorRuntime.mark(function _callee(_ref) {
227
+ var image, triggerRecalc, albumMetadata;
228
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
229
+ while (1) {
230
+ switch (_context.prev = _context.next) {
231
+ case 0:
232
+ image = _ref.image, triggerRecalc = _ref.triggerRecalc, albumMetadata = _ref.albumMetadata;
233
+ console.log("[SYNC] image ".concat(image.id, " saving... recalc: ").concat(triggerRecalc, " albumMetadata: ").concat(albumMetadata.length));
234
+ return _context.abrupt("return", new Promise(function (resolve, reject) {
235
+ setTimeout(function () {
236
+ var lockedUntil = null;
208
237
 
209
- if (triggerRecalc) {
210
- var now = new Date();
211
- now.setSeconds(now.getSeconds() + 60);
212
- lockedUntil = now;
213
- }
238
+ if (triggerRecalc) {
239
+ var now = new Date();
240
+ now.setSeconds(now.getSeconds() + 60);
241
+ lockedUntil = now;
242
+ }
214
243
 
215
- resolve({
216
- lockedUntil: lockedUntil
217
- });
218
- }, 3000);
219
- }));
244
+ resolve({
245
+ lockedUntil: lockedUntil
246
+ });
247
+ }, 3000);
248
+ }));
220
249
 
221
- case 3:
222
- case "end":
223
- return _context.stop();
250
+ case 3:
251
+ case "end":
252
+ return _context.stop();
253
+ }
224
254
  }
225
- }
226
- }, _callee);
227
- }));
255
+ }, _callee);
256
+ }));
228
257
 
229
- return function (_x) {
230
- return _ref2.apply(this, arguments);
231
- };
232
- }(),
233
- fetchImage:
234
- /*#__PURE__*/
235
- function () {
236
- var _ref4 = _asyncToGenerator(
258
+ return function (_x) {
259
+ return _ref2.apply(this, arguments);
260
+ };
261
+ }(),
262
+ fetchImage:
237
263
  /*#__PURE__*/
238
- _regeneratorRuntime.mark(function _callee2(_ref3) {
239
- var imageId;
240
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
241
- while (1) {
242
- switch (_context2.prev = _context2.next) {
243
- case 0:
244
- imageId = _ref3.imageId;
245
- console.log("[SYNC] image ".concat(imageId, " fetching..."));
246
- return _context2.abrupt("return", new Promise(function (resolve, reject) {
247
- setTimeout(function () {
248
- console.log("[SYNC] image ".concat(imageId, " fetched")); // resolve({
249
- // image: { ...exampleImages[0], lockedUntil: new Date().toISOString(), id: imageId }
250
- // })
264
+ function () {
265
+ var _ref4 = _asyncToGenerator(
266
+ /*#__PURE__*/
267
+ _regeneratorRuntime.mark(function _callee2(_ref3) {
268
+ var imageId;
269
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
270
+ while (1) {
271
+ switch (_context2.prev = _context2.next) {
272
+ case 0:
273
+ imageId = _ref3.imageId;
274
+ console.log("[SYNC] image ".concat(imageId, " fetching..."));
275
+ return _context2.abrupt("return", new Promise(function (resolve, reject) {
276
+ setTimeout(function () {
277
+ console.log("[SYNC] image ".concat(imageId, " fetched")); // resolve({
278
+ // image: { ...exampleImages[0], lockedUntil: new Date().toISOString(), id: imageId }
279
+ // })
251
280
 
252
- resolve({
253
- image: _objectSpread({}, exampleImages[0], {
254
- lockedUntil: null,
255
- id: imageId
256
- })
257
- });
258
- }, 5000);
259
- }));
281
+ resolve({
282
+ image: _objectSpread({}, exampleImages[0], {
283
+ lockedUntil: null,
284
+ id: imageId
285
+ })
286
+ });
287
+ }, 5000);
288
+ }));
260
289
 
261
- case 3:
262
- case "end":
263
- return _context2.stop();
290
+ case 3:
291
+ case "end":
292
+ return _context2.stop();
293
+ }
264
294
  }
265
- }
266
- }, _callee2);
267
- }));
295
+ }, _callee2);
296
+ }));
268
297
 
269
- return function (_x2) {
270
- return _ref4.apply(this, arguments);
271
- };
272
- }()
273
- }))));
298
+ return function (_x2) {
299
+ return _ref4.apply(this, arguments);
300
+ };
301
+ }()
302
+ }))))
303
+ );
274
304
  }).add("Basic - Allow Comments", function () {
275
- return React.createElement(Annotator, {
276
- onExit: actionAddon("onExit"),
277
- middlewares: middlewares,
278
- labelImages: true,
279
- regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
280
- regionTagList: ["tag1", "tag2", "tag3"],
281
- imageClsList: ["Alpha", "Beta", "Charlie", "Delta"],
282
- imageTagList: ["tag1", "tag2", "tag3"],
283
- images: [{
284
- src: exampleImage,
285
- name: "Seve's Desk",
286
- regions: testRegions
287
- }, {
288
- src: "https://loremflickr.com/100/100/cars?lock=1",
289
- name: "Frame 0036"
290
- }, {
291
- src: "https://loremflickr.com/100/100/cars?lock=2",
292
- name: "Frame 0037"
293
- }, {
294
- src: "https://loremflickr.com/100/100/cars?lock=3",
295
- name: "Frame 0038"
296
- }],
297
- allowComments: true
298
- });
305
+ return (
306
+ /*#__PURE__*/
307
+ React.createElement(Annotator, {
308
+ onExit: actionAddon("onExit"),
309
+ middlewares: middlewares,
310
+ labelImages: true,
311
+ regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
312
+ regionTagList: ["tag1", "tag2", "tag3"],
313
+ imageClsList: ["Alpha", "Beta", "Charlie", "Delta"],
314
+ imageTagList: ["tag1", "tag2", "tag3"],
315
+ images: [{
316
+ src: exampleImage,
317
+ name: "Seve's Desk",
318
+ regions: testRegions
319
+ }, {
320
+ src: "https://loremflickr.com/100/100/cars?lock=1",
321
+ name: "Frame 0036"
322
+ }, {
323
+ src: "https://loremflickr.com/100/100/cars?lock=2",
324
+ name: "Frame 0037"
325
+ }, {
326
+ src: "https://loremflickr.com/100/100/cars?lock=3",
327
+ name: "Frame 0038"
328
+ }],
329
+ allowComments: true
330
+ })
331
+ );
299
332
  }).add("Fixed Size Container", function () {
300
- return React.createElement("div", {
301
- style: {
302
- width: 500,
303
- height: 500
304
- }
305
- }, React.createElement(Annotator, {
306
- onExit: actionAddon("onExit"),
307
- middlewares: [function (store) {
308
- return function (next) {
309
- return function (action) {
310
- actionAddon(action.type)(action);
311
- return next(action);
333
+ return (
334
+ /*#__PURE__*/
335
+ React.createElement("div", {
336
+ style: {
337
+ width: 500,
338
+ height: 500
339
+ }
340
+ },
341
+ /*#__PURE__*/
342
+ React.createElement(Annotator, {
343
+ onExit: actionAddon("onExit"),
344
+ middlewares: [function (store) {
345
+ return function (next) {
346
+ return function (action) {
347
+ actionAddon(action.type)(action);
348
+ return next(action);
349
+ };
312
350
  };
313
- };
314
- }],
315
- labelImages: true,
316
- regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
317
- regionTagList: ["tag1", "tag2", "tag3"],
318
- imageClsList: ["Alpha", "Beta", "Charlie", "Delta"],
319
- imageTagList: ["tag1", "tag2", "tag3"],
320
- images: [{
321
- src: exampleImage,
322
- name: "Seve's Desk",
323
- regions: testRegions
324
- }, {
325
- src: "https://loremflickr.com/100/100/cars?lock=1",
326
- name: "Frame 0036"
327
- }, {
328
- src: "https://loremflickr.com/100/100/cars?lock=2",
329
- name: "Frame 0037"
330
- }, {
331
- src: "https://loremflickr.com/100/100/cars?lock=3",
332
- name: "Frame 0038"
333
- }]
334
- }));
351
+ }],
352
+ labelImages: true,
353
+ regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
354
+ regionTagList: ["tag1", "tag2", "tag3"],
355
+ imageClsList: ["Alpha", "Beta", "Charlie", "Delta"],
356
+ imageTagList: ["tag1", "tag2", "tag3"],
357
+ images: [{
358
+ src: exampleImage,
359
+ name: "Seve's Desk",
360
+ regions: testRegions
361
+ }, {
362
+ src: "https://loremflickr.com/100/100/cars?lock=1",
363
+ name: "Frame 0036"
364
+ }, {
365
+ src: "https://loremflickr.com/100/100/cars?lock=2",
366
+ name: "Frame 0037"
367
+ }, {
368
+ src: "https://loremflickr.com/100/100/cars?lock=3",
369
+ name: "Frame 0038"
370
+ }]
371
+ }))
372
+ );
335
373
  }).add("Shrunk Annotator (Test Fullscreen)", function () {
336
- return React.createElement("div", {
337
- style: {
338
- padding: 100
339
- }
340
- }, React.createElement(Annotator, {
341
- onExit: actionAddon("onExit"),
342
- regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
343
- regionTagList: ["tag1", "tag2", "tag3"],
344
- middlewares: [function (store) {
345
- return function (next) {
346
- return function (action) {
347
- actionAddon(action.type)(action);
348
- return next(action);
374
+ return (
375
+ /*#__PURE__*/
376
+ React.createElement("div", {
377
+ style: {
378
+ padding: 100
379
+ }
380
+ },
381
+ /*#__PURE__*/
382
+ React.createElement(Annotator, {
383
+ onExit: actionAddon("onExit"),
384
+ regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
385
+ regionTagList: ["tag1", "tag2", "tag3"],
386
+ middlewares: [function (store) {
387
+ return function (next) {
388
+ return function (action) {
389
+ actionAddon(action.type)(action);
390
+ return next(action);
391
+ };
349
392
  };
350
- };
351
- }],
352
- images: [{
353
- src: exampleImage,
354
- name: "Seve's Desk",
355
- regions: testRegions
356
- }]
357
- }));
393
+ }],
394
+ images: [{
395
+ src: exampleImage,
396
+ name: "Seve's Desk",
397
+ regions: testRegions
398
+ }]
399
+ }))
400
+ );
358
401
  }).add("Annotator w/o No Region Labels or Image Labels", function () {
359
- return React.createElement(Annotator, {
360
- onExit: actionAddon("onExit"),
361
- middlewares: middlewares,
362
- images: [{
363
- src: exampleImage,
364
- name: "Seve's Desk",
365
- regions: testRegions
366
- }]
367
- });
402
+ return (
403
+ /*#__PURE__*/
404
+ React.createElement(Annotator, {
405
+ onExit: actionAddon("onExit"),
406
+ middlewares: middlewares,
407
+ images: [{
408
+ src: exampleImage,
409
+ name: "Seve's Desk",
410
+ regions: testRegions
411
+ }]
412
+ })
413
+ );
368
414
  }).add("Annotator with no enabled tools", function () {
369
- return React.createElement(Annotator, {
370
- onExit: actionAddon("onExit"),
371
- enabledTools: [],
372
- showTags: false,
373
- middlewares: middlewares,
374
- images: [{
375
- src: exampleImage,
376
- name: "Seve's Desk",
377
- regions: testRegions
378
- }]
379
- });
415
+ return (
416
+ /*#__PURE__*/
417
+ React.createElement(Annotator, {
418
+ onExit: actionAddon("onExit"),
419
+ enabledTools: [],
420
+ showTags: false,
421
+ middlewares: middlewares,
422
+ images: [{
423
+ src: exampleImage,
424
+ name: "Seve's Desk",
425
+ regions: testRegions
426
+ }]
427
+ })
428
+ );
380
429
  }).add("Bounding Box Annotator with output to console.log", function () {
381
- return React.createElement(Annotator, {
382
- onExit: function onExit(out) {
383
- window.lastOutput = out;
384
- console.log(out);
385
- },
386
- taskDescription: "## Annotate Hands\nDraw a bounding box around each hand.",
387
- enabledTools: ["select", "create-box"],
388
- regionClsList: ["Hand", "Face"],
389
- regionTagList: ["Open Pinch", "Closed Pinch", "In Frame"],
390
- showTags: false,
391
- images: [{
392
- src: "https://s3.amazonaws.com/jobstorage.workaround.online/Atheer/video-frames/VID_20190111_161054.mp4_frame017.png",
393
- name: "Bounding Box Test",
394
- regions: []
395
- }, {
396
- src: "https://s3.amazonaws.com/jobstorage.workaround.online/Atheer/video-frames/VID_20190111_161054.mp4_frame001.png",
397
- name: "Bounding Box Test",
398
- regions: []
399
- }]
400
- });
401
- }).add("Bounding Box Annotator with allowed area", function () {
402
- return React.createElement(Annotator, {
403
- taskDescription: "## Annotate Hands\nDraw a bounding box around each hand.",
404
- enabledTools: ["select", "create-box"],
405
- regionClsList: ["Hand", "Face"],
406
- regionTagList: ["Open Pinch", "Closed Pinch", "In Frame"],
407
- showTags: false,
408
- allowedArea: {
409
- x: 0,
410
- y: 0.6,
411
- w: 0.3,
412
- h: 0.3
413
- },
414
- images: [{
415
- src: "https://s3.amazonaws.com/jobstorage.workaround.online/Atheer/video-frames/VID_20190111_161054.mp4_frame017.png",
416
- name: "Bounding Box Test",
417
- regions: []
418
- }]
419
- });
420
- }).add("Car Annotation", function () {
421
- return React.createElement(Annotator, _defineProperty({
422
- onExit: actionAddon("onExit"),
423
- middlewares: middlewares,
424
- labelImages: true,
425
- regionClsList: ["Car", "Sign", "Construction Barrier"],
426
- regionTagList: ["Moving", "Stopped", "Obstacle"],
427
- imageClsList: ["On Street", "Sidewalk", "Other"] // imageTagList={["tag1", "tag2", "tag3"]}
428
- ,
429
- images: [{
430
- src: bikeImg1,
431
- name: "Frame 03021",
432
- regions: [{
433
- cls: "Car",
434
- color: "hsl(82,100%,50%)",
435
- h: 0.45921666772960146,
436
- w: 0.3932156342484836,
437
- x: 0.6302148980776354,
438
- y: 0.5559504689545722,
439
- type: "box",
440
- id: "8776160642957009",
441
- tags: ["Stopped"],
442
- highlighted: false,
443
- editingLabels: false
444
- }, {
445
- cls: "Car",
446
- color: "hsl(264,100%,50%)",
447
- type: "box",
448
- id: "885140028730734",
449
- tags: ["Moving"],
450
- w: 0.2627711048576583,
451
- x: 0.20751775748638238,
452
- y: 0.5566583219431673,
453
- h: 0.268717618171478,
454
- highlighted: false,
455
- editingLabels: false
456
- }, {
457
- cls: "Car",
458
- color: "hsl(127,100%,50%)",
459
- w: 0.033016094117647055,
460
- x: 0.5051247779336334,
461
- y: 0.5396378545840628,
462
- h: 0.03423999999999994,
463
- type: "box",
464
- id: "5952553512262024",
465
- tags: ["Stopped"],
466
- highlighted: false,
467
- editingLabels: false
430
+ return (
431
+ /*#__PURE__*/
432
+ React.createElement(Annotator, {
433
+ onExit: function onExit(out) {
434
+ window.lastOutput = out;
435
+ console.log(out);
436
+ },
437
+ taskDescription: "## Annotate Hands\nDraw a bounding box around each hand.",
438
+ enabledTools: ["select", "create-box"],
439
+ regionClsList: ["Hand", "Face"],
440
+ regionTagList: ["Open Pinch", "Closed Pinch", "In Frame"],
441
+ showTags: false,
442
+ images: [{
443
+ src: "https://s3.amazonaws.com/jobstorage.workaround.online/Atheer/video-frames/VID_20190111_161054.mp4_frame017.png",
444
+ name: "Bounding Box Test",
445
+ regions: []
468
446
  }, {
469
- type: "box",
470
- x: 0.7847296794208894,
471
- y: 0.3635007199404308,
472
- w: 0.04871147880041349,
473
- h: 0.10995961095800888,
474
- highlighted: true,
475
- editingLabels: false,
476
- color: "hsl(268,100%,50%)",
477
- id: "5647593040225252",
478
- cls: "Sign"
447
+ src: "https://s3.amazonaws.com/jobstorage.workaround.online/Atheer/video-frames/VID_20190111_161054.mp4_frame001.png",
448
+ name: "Bounding Box Test",
449
+ regions: []
479
450
  }]
480
- }, {
481
- src: bikeImg2,
482
- name: "Frame 03022",
483
- regions: [{
484
- type: "box",
485
- x: 0.12226982552783494,
486
- y: 0.5578947368421052,
487
- w: 0.3301518695958121,
488
- h: 0.33562583001232194,
489
- highlighted: false,
490
- editingLabels: false,
491
- color: "hsl(171,100%,50%)",
492
- id: "014393439034159128",
493
- cls: "Car",
494
- tags: ["Stopped"]
495
- }, {
496
- type: "box",
497
- x: 0.5018477698901193,
498
- y: 0.5954194079501558,
499
- w: 0.07194249496837657,
500
- h: 0.06826906557009338,
501
- highlighted: false,
502
- editingLabels: false,
503
- color: "hsl(17,100%,50%)",
504
- id: "02954614542034717",
505
- cls: "Car",
506
- tags: ["Moving"]
507
- }, {
508
- type: "box",
509
- x: 0.6483083881082046,
510
- y: 0.6217109311709718,
511
- w: 0.08786544324705947,
512
- h: 0.20450608002345438,
513
- highlighted: true,
514
- editingLabels: true,
515
- color: "hsl(337,100%,50%)",
516
- id: "9124138360972984",
517
- cls: "Construction Barrier",
518
- tags: ["Obstacle"]
519
- }, {
520
- type: "box",
521
- x: 0.7628671305695606,
522
- y: 0.6299511028935285,
523
- w: 0.12734928166820647,
524
- h: 0.2689292407634438,
525
- highlighted: false,
526
- editingLabels: false,
527
- color: "hsl(89,100%,50%)",
528
- id: "5960600741979638",
529
- cls: "Construction Barrier"
530
- }, {
531
- type: "box",
532
- x: 0.5871362440754417,
533
- y: 0.6232091442114366,
534
- w: 0.06562102723514573,
535
- h: 0.15281773012741662,
536
- highlighted: false,
537
- editingLabels: false,
538
- color: "hsl(326,100%,50%)",
539
- id: "7955287536996538",
540
- cls: "Construction Barrier"
541
- }, {
542
- type: "box",
543
- x: 0.42943330004934643,
544
- y: 0.6054718359824862,
545
- w: 0.053210066743122564,
546
- h: 0.054984658299147116,
547
- highlighted: false,
548
- editingLabels: false,
549
- color: "hsl(66,100%,50%)",
550
- id: "49573139861381166",
551
- cls: "Car",
552
- tags: ["Stopped"]
451
+ })
452
+ );
453
+ }).add("Bounding Box Annotator with allowed area", function () {
454
+ return (
455
+ /*#__PURE__*/
456
+ React.createElement(Annotator, {
457
+ taskDescription: "## Annotate Hands\nDraw a bounding box around each hand.",
458
+ enabledTools: ["select", "create-box"],
459
+ regionClsList: ["Hand", "Face"],
460
+ regionTagList: ["Open Pinch", "Closed Pinch", "In Frame"],
461
+ showTags: false,
462
+ allowedArea: {
463
+ x: 0,
464
+ y: 0.6,
465
+ w: 0.3,
466
+ h: 0.3
467
+ },
468
+ images: [{
469
+ src: "https://s3.amazonaws.com/jobstorage.workaround.online/Atheer/video-frames/VID_20190111_161054.mp4_frame017.png",
470
+ name: "Bounding Box Test",
471
+ regions: []
553
472
  }]
554
- }]
555
- }, "onExit", function onExit(out) {
556
- window.lastOutput = out;
557
- console.log(JSON.stringify(out.images));
558
- }));
559
- }).add("Annotator blocks scroll from propagating", function () {
560
- return React.createElement("div", {
561
- style: {
562
- height: "200vh"
563
- }
564
- }, React.createElement(Annotator, {
565
- onExit: actionAddon("onExit"),
566
- showTags: false,
567
- middlewares: [function (store) {
568
- return function (next) {
569
- return function (action) {
570
- actionAddon(action.type)(action);
571
- return next(action);
572
- };
573
- };
574
- }],
575
- images: [{
576
- src: exampleImage,
577
- name: "Seve's Desk",
578
- regions: testRegions
579
- }]
580
- }), React.createElement("div", {
581
- style: {
582
- color: "red"
583
- }
584
- }, "You shouldn't be able to see this"));
585
- }).add("Annotator should not expand beyond parent", function () {
586
- return React.createElement("div", {
587
- style: {
588
- width: "100vw",
589
- height: "100vh",
590
- padding: 100,
591
- boxSizing: "border-box"
592
- }
593
- }, React.createElement(Annotator, {
594
- onExit: actionAddon("onExit"),
595
- showTags: false,
596
- middlewares: [function (store) {
597
- return function (next) {
598
- return function (action) {
599
- actionAddon(action.type)(action);
600
- return next(action);
601
- };
602
- };
603
- }],
604
- images: [{
605
- src: exampleImage,
606
- name: "Seve's Desk",
607
- regions: testRegions
608
- }]
609
- }));
610
- }).add("Video with frames as each image", function () {
611
- return React.createElement("div", {
612
- style: {
613
- width: "100vw",
614
- height: "100vh",
615
- boxSizing: "border-box"
616
- }
617
- }, React.createElement(Annotator, {
618
- onExit: actionAddon("onExit"),
619
- showTags: false,
620
- middlewares: [function (store) {
621
- return function (next) {
622
- return function (action) {
623
- actionAddon(action.type)(action);
624
- return next(action);
625
- };
626
- };
627
- }],
628
- images: [{
629
- src: "https://s3.amazonaws.com/asset.workaround.online/SampleVideo_1280x720_1mb.mp4",
630
- frameTime: 0,
631
- name: "Frame 1"
632
- }, {
633
- src: "https://s3.amazonaws.com/asset.workaround.online/SampleVideo_1280x720_1mb.mp4",
634
- frameTime: 4500,
635
- name: "Frame 2"
636
- }]
637
- }));
638
- }).add("Keyframe video", function () {
639
- return React.createElement("div", {
640
- style: {
641
- width: "100vw",
642
- height: "100vh",
643
- boxSizing: "border-box"
644
- }
645
- }, React.createElement(Annotator, {
646
- onExit: function onExit() {
647
- var _console;
648
-
649
- (_console = console).log.apply(_console, arguments);
650
-
651
- actionAddon("onExit").apply(void 0, arguments);
652
- },
653
- showTags: true,
654
- videoSrc: "https://s3.amazonaws.com/asset.workaround.online/SampleVideo_1280x720_1mb.mp4",
655
- videoTime: 1000,
656
- keyframes: {
657
- 0: {
473
+ })
474
+ );
475
+ }).add("Car Annotation", function () {
476
+ return (
477
+ /*#__PURE__*/
478
+ React.createElement(Annotator, _defineProperty({
479
+ onExit: actionAddon("onExit"),
480
+ middlewares: middlewares,
481
+ labelImages: true,
482
+ regionClsList: ["Car", "Sign", "Construction Barrier"],
483
+ regionTagList: ["Moving", "Stopped", "Obstacle"],
484
+ imageClsList: ["On Street", "Sidewalk", "Other"] // imageTagList={["tag1", "tag2", "tag3"]}
485
+ ,
486
+ images: [{
487
+ src: bikeImg1,
488
+ name: "Frame 03021",
658
489
  regions: [{
659
- type: "point",
660
- x: 0.1608187134502924,
661
- y: 0.5769980506822612,
662
- highlighted: true,
663
- editingLabels: false,
664
- color: "hsl(238,100%,50%)",
665
- id: "9995495728521284"
490
+ cls: "Car",
491
+ color: "hsl(82,100%,50%)",
492
+ h: 0.45921666772960146,
493
+ w: 0.3932156342484836,
494
+ x: 0.6302148980776354,
495
+ y: 0.5559504689545722,
496
+ type: "box",
497
+ id: "8776160642957009",
498
+ tags: ["Stopped"],
499
+ highlighted: false,
500
+ editingLabels: false
501
+ }, {
502
+ cls: "Car",
503
+ color: "hsl(264,100%,50%)",
504
+ type: "box",
505
+ id: "885140028730734",
506
+ tags: ["Moving"],
507
+ w: 0.2627711048576583,
508
+ x: 0.20751775748638238,
509
+ y: 0.5566583219431673,
510
+ h: 0.268717618171478,
511
+ highlighted: false,
512
+ editingLabels: false
666
513
  }, {
514
+ cls: "Car",
515
+ color: "hsl(127,100%,50%)",
516
+ w: 0.033016094117647055,
517
+ x: 0.5051247779336334,
518
+ y: 0.5396378545840628,
519
+ h: 0.03423999999999994,
667
520
  type: "box",
668
- x: 0.089171974522293,
669
- y: 0.36801132342533616,
670
- w: 0.30573248407643316,
671
- h: 0.4170794998820476,
521
+ id: "5952553512262024",
522
+ tags: ["Stopped"],
523
+ highlighted: false,
524
+ editingLabels: false
525
+ }, {
526
+ type: "box",
527
+ x: 0.7847296794208894,
528
+ y: 0.3635007199404308,
529
+ w: 0.04871147880041349,
530
+ h: 0.10995961095800888,
672
531
  highlighted: true,
673
532
  editingLabels: false,
674
- color: "hsl(263,100%,50%)",
675
- id: "04858393322065635"
533
+ color: "hsl(268,100%,50%)",
534
+ id: "5647593040225252",
535
+ cls: "Sign"
676
536
  }]
677
- },
678
- 3333: {
537
+ }, {
538
+ src: bikeImg2,
539
+ name: "Frame 03022",
679
540
  regions: [{
680
- type: "point",
681
- x: 0.1608187134502924,
682
- y: 0.5769980506822612,
683
- highlighted: true,
541
+ type: "box",
542
+ x: 0.12226982552783494,
543
+ y: 0.5578947368421052,
544
+ w: 0.3301518695958121,
545
+ h: 0.33562583001232194,
546
+ highlighted: false,
684
547
  editingLabels: false,
685
- color: "hsl(238,100%,50%)",
686
- id: "9995495728521284"
548
+ color: "hsl(171,100%,50%)",
549
+ id: "014393439034159128",
550
+ cls: "Car",
551
+ tags: ["Stopped"]
687
552
  }, {
688
553
  type: "box",
689
- x: 0.14861995753715496,
690
- y: 0.0934182590233546,
691
- w: 0.3163481953290871,
692
- h: 0.7596131163010142,
554
+ x: 0.5018477698901193,
555
+ y: 0.5954194079501558,
556
+ w: 0.07194249496837657,
557
+ h: 0.06826906557009338,
558
+ highlighted: false,
559
+ editingLabels: false,
560
+ color: "hsl(17,100%,50%)",
561
+ id: "02954614542034717",
562
+ cls: "Car",
563
+ tags: ["Moving"]
564
+ }, {
565
+ type: "box",
566
+ x: 0.6483083881082046,
567
+ y: 0.6217109311709718,
568
+ w: 0.08786544324705947,
569
+ h: 0.20450608002345438,
693
570
  highlighted: true,
571
+ editingLabels: true,
572
+ color: "hsl(337,100%,50%)",
573
+ id: "9124138360972984",
574
+ cls: "Construction Barrier",
575
+ tags: ["Obstacle"]
576
+ }, {
577
+ type: "box",
578
+ x: 0.7628671305695606,
579
+ y: 0.6299511028935285,
580
+ w: 0.12734928166820647,
581
+ h: 0.2689292407634438,
582
+ highlighted: false,
694
583
  editingLabels: false,
695
- color: "hsl(263,100%,50%)",
696
- id: "04858393322065635"
584
+ color: "hsl(89,100%,50%)",
585
+ id: "5960600741979638",
586
+ cls: "Construction Barrier"
587
+ }, {
588
+ type: "box",
589
+ x: 0.5871362440754417,
590
+ y: 0.6232091442114366,
591
+ w: 0.06562102723514573,
592
+ h: 0.15281773012741662,
593
+ highlighted: false,
594
+ editingLabels: false,
595
+ color: "hsl(326,100%,50%)",
596
+ id: "7955287536996538",
597
+ cls: "Construction Barrier"
598
+ }, {
599
+ type: "box",
600
+ x: 0.42943330004934643,
601
+ y: 0.6054718359824862,
602
+ w: 0.053210066743122564,
603
+ h: 0.054984658299147116,
604
+ highlighted: false,
605
+ editingLabels: false,
606
+ color: "hsl(66,100%,50%)",
607
+ id: "49573139861381166",
608
+ cls: "Car",
609
+ tags: ["Stopped"]
697
610
  }]
611
+ }]
612
+ }, "onExit", function onExit(out) {
613
+ window.lastOutput = out;
614
+ console.log(JSON.stringify(out.images));
615
+ }))
616
+ );
617
+ }).add("Annotator blocks scroll from propagating", function () {
618
+ return (
619
+ /*#__PURE__*/
620
+ React.createElement("div", {
621
+ style: {
622
+ height: "200vh"
623
+ }
624
+ },
625
+ /*#__PURE__*/
626
+ React.createElement(Annotator, {
627
+ onExit: actionAddon("onExit"),
628
+ showTags: false,
629
+ middlewares: [function (store) {
630
+ return function (next) {
631
+ return function (action) {
632
+ actionAddon(action.type)(action);
633
+ return next(action);
634
+ };
635
+ };
636
+ }],
637
+ images: [{
638
+ src: exampleImage,
639
+ name: "Seve's Desk",
640
+ regions: testRegions
641
+ }]
642
+ }),
643
+ /*#__PURE__*/
644
+ React.createElement("div", {
645
+ style: {
646
+ color: "red"
647
+ }
648
+ }, "You shouldn't be able to see this"))
649
+ );
650
+ }).add("Annotator should not expand beyond parent", function () {
651
+ return (
652
+ /*#__PURE__*/
653
+ React.createElement("div", {
654
+ style: {
655
+ width: "100vw",
656
+ height: "100vh",
657
+ padding: 100,
658
+ boxSizing: "border-box"
659
+ }
660
+ },
661
+ /*#__PURE__*/
662
+ React.createElement(Annotator, {
663
+ onExit: actionAddon("onExit"),
664
+ showTags: false,
665
+ middlewares: [function (store) {
666
+ return function (next) {
667
+ return function (action) {
668
+ actionAddon(action.type)(action);
669
+ return next(action);
670
+ };
671
+ };
672
+ }],
673
+ images: [{
674
+ src: exampleImage,
675
+ name: "Seve's Desk",
676
+ regions: testRegions
677
+ }]
678
+ }))
679
+ );
680
+ }).add("Video with frames as each image", function () {
681
+ return (
682
+ /*#__PURE__*/
683
+ React.createElement("div", {
684
+ style: {
685
+ width: "100vw",
686
+ height: "100vh",
687
+ boxSizing: "border-box"
688
+ }
689
+ },
690
+ /*#__PURE__*/
691
+ React.createElement(Annotator, {
692
+ onExit: actionAddon("onExit"),
693
+ showTags: false,
694
+ middlewares: [function (store) {
695
+ return function (next) {
696
+ return function (action) {
697
+ actionAddon(action.type)(action);
698
+ return next(action);
699
+ };
700
+ };
701
+ }],
702
+ images: [{
703
+ src: "https://s3.amazonaws.com/asset.workaround.online/SampleVideo_1280x720_1mb.mp4",
704
+ frameTime: 0,
705
+ name: "Frame 1"
706
+ }, {
707
+ src: "https://s3.amazonaws.com/asset.workaround.online/SampleVideo_1280x720_1mb.mp4",
708
+ frameTime: 4500,
709
+ name: "Frame 2"
710
+ }]
711
+ }))
712
+ );
713
+ }).add("Keyframe video", function () {
714
+ return (
715
+ /*#__PURE__*/
716
+ React.createElement("div", {
717
+ style: {
718
+ width: "100vw",
719
+ height: "100vh",
720
+ boxSizing: "border-box"
721
+ }
722
+ },
723
+ /*#__PURE__*/
724
+ React.createElement(Annotator, {
725
+ onExit: function onExit() {
726
+ var _console;
727
+
728
+ (_console = console).log.apply(_console, arguments);
729
+
730
+ actionAddon("onExit").apply(void 0, arguments);
731
+ },
732
+ showTags: true,
733
+ videoSrc: "https://s3.amazonaws.com/asset.workaround.online/SampleVideo_1280x720_1mb.mp4",
734
+ videoTime: 1000,
735
+ keyframes: {
736
+ 0: {
737
+ regions: [{
738
+ type: "point",
739
+ x: 0.1608187134502924,
740
+ y: 0.5769980506822612,
741
+ highlighted: true,
742
+ editingLabels: false,
743
+ color: "hsl(238,100%,50%)",
744
+ id: "9995495728521284"
745
+ }, {
746
+ type: "box",
747
+ x: 0.089171974522293,
748
+ y: 0.36801132342533616,
749
+ w: 0.30573248407643316,
750
+ h: 0.4170794998820476,
751
+ highlighted: true,
752
+ editingLabels: false,
753
+ color: "hsl(263,100%,50%)",
754
+ id: "04858393322065635"
755
+ }]
756
+ },
757
+ 3333: {
758
+ regions: [{
759
+ type: "point",
760
+ x: 0.1608187134502924,
761
+ y: 0.5769980506822612,
762
+ highlighted: true,
763
+ editingLabels: false,
764
+ color: "hsl(238,100%,50%)",
765
+ id: "9995495728521284"
766
+ }, {
767
+ type: "box",
768
+ x: 0.14861995753715496,
769
+ y: 0.0934182590233546,
770
+ w: 0.3163481953290871,
771
+ h: 0.7596131163010142,
772
+ highlighted: true,
773
+ editingLabels: false,
774
+ color: "hsl(263,100%,50%)",
775
+ id: "04858393322065635"
776
+ }]
777
+ }
698
778
  }
699
- }
700
- }));
779
+ }))
780
+ );
701
781
  }).add("Override Next/Prev Button Handling", function () {
702
782
  var images = [exampleImage, "https://loremflickr.com/100/100/cars?lock=1", "https://loremflickr.com/100/100/cars?lock=2"];
703
783
 
@@ -706,31 +786,34 @@ storiesOf("Annotator", module).add("Basic", function () {
706
786
  selectedImageIndex = _useState2[0],
707
787
  changeSelectedImageIndex = _useState2[1];
708
788
 
709
- return React.createElement(Annotator, {
710
- onExit: actionAddon("onExit"),
711
- onNextImage: function onNextImage() {
712
- actionAddon("onNextImage")();
713
- changeSelectedImageIndex((selectedImageIndex + 1) % 3);
714
- },
715
- onPrevImage: function onPrevImage() {
716
- actionAddon("onPrevImage")();
717
- changeSelectedImageIndex((selectedImageIndex - 1 + 3) % 3);
718
- },
719
- labelImages: true,
720
- selectedImage: images[selectedImageIndex],
721
- regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
722
- imageClsList: ["Alpha", "Beta", "Charlie", "Delta"],
723
- images: [{
724
- src: exampleImage,
725
- name: "Seve's Desk"
726
- }, {
727
- src: images[1],
728
- name: "Frame 0036"
729
- }, {
730
- src: images[2],
731
- name: "Frame 0037"
732
- }]
733
- });
789
+ return (
790
+ /*#__PURE__*/
791
+ React.createElement(Annotator, {
792
+ onExit: actionAddon("onExit"),
793
+ onNextImage: function onNextImage() {
794
+ actionAddon("onNextImage")();
795
+ changeSelectedImageIndex((selectedImageIndex + 1) % 3);
796
+ },
797
+ onPrevImage: function onPrevImage() {
798
+ actionAddon("onPrevImage")();
799
+ changeSelectedImageIndex((selectedImageIndex - 1 + 3) % 3);
800
+ },
801
+ labelImages: true,
802
+ selectedImage: images[selectedImageIndex],
803
+ regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
804
+ imageClsList: ["Alpha", "Beta", "Charlie", "Delta"],
805
+ images: [{
806
+ src: exampleImage,
807
+ name: "Seve's Desk"
808
+ }, {
809
+ src: images[1],
810
+ name: "Frame 0036"
811
+ }, {
812
+ src: images[2],
813
+ name: "Frame 0037"
814
+ }]
815
+ })
816
+ );
734
817
  }).add("Override RegionEditLabel", function () {
735
818
  var images = [exampleImage, "https://loremflickr.com/100/100/cars?lock=1", "https://loremflickr.com/100/100/cars?lock=2"];
736
819
 
@@ -741,147 +824,186 @@ storiesOf("Annotator", module).add("Basic", function () {
741
824
  onChange = _ref5.onChange,
742
825
  onClose = _ref5.onClose,
743
826
  onOpen = _ref5.onOpen;
744
- return React.createElement("div", {
745
- style: {
746
- backgroundColor: "white"
747
- }
748
- }, "I'm the closed part", React.createElement("div", {
749
- style: {
750
- display: editing ? "block" : "none"
751
- }
752
- }, "I'm the part that shows when it's being edited!", React.createElement("button", {
753
- onClick: function onClick() {
754
- return onDelete(region);
755
- }
756
- }, "Delete This Region"), React.createElement("button", {
757
- onClick: function onClick() {
758
- return onChange(_objectSpread({}, region, {
759
- cls: "awesome-value"
760
- }));
761
- }
762
- }, "Set Classification to \"awesome-value\""), React.createElement("button", {
763
- onClick: function onClick() {
764
- return onClose(region);
765
- }
766
- }, "Close the edit mode")));
827
+ return (
828
+ /*#__PURE__*/
829
+ React.createElement("div", {
830
+ style: {
831
+ backgroundColor: "white"
832
+ }
833
+ }, "I'm the closed part",
834
+ /*#__PURE__*/
835
+ React.createElement("div", {
836
+ style: {
837
+ display: editing ? "block" : "none"
838
+ }
839
+ }, "I'm the part that shows when it's being edited!",
840
+ /*#__PURE__*/
841
+ React.createElement("button", {
842
+ onClick: function onClick() {
843
+ return onDelete(region);
844
+ }
845
+ }, "Delete This Region"),
846
+ /*#__PURE__*/
847
+ React.createElement("button", {
848
+ onClick: function onClick() {
849
+ return onChange(_objectSpread({}, region, {
850
+ cls: "awesome-value"
851
+ }));
852
+ }
853
+ }, "Set Classification to \"awesome-value\""),
854
+ /*#__PURE__*/
855
+ React.createElement("button", {
856
+ onClick: function onClick() {
857
+ return onClose(region);
858
+ }
859
+ }, "Close the edit mode")))
860
+ );
767
861
  };
768
862
 
769
- return React.createElement(Annotator, {
770
- onExit: actionAddon("onExit"),
771
- labelImages: true,
772
- selectedImage: images[0],
773
- RegionEditLabel: NewRegionEditLabel,
774
- images: [{
775
- src: exampleImage,
776
- name: "Seve's Desk"
777
- }, {
778
- src: images[1],
779
- name: "Frame 0036"
780
- }, {
781
- src: images[2],
782
- name: "Frame 0037"
783
- }]
784
- });
863
+ return (
864
+ /*#__PURE__*/
865
+ React.createElement(Annotator, {
866
+ onExit: actionAddon("onExit"),
867
+ labelImages: true,
868
+ selectedImage: images[0],
869
+ RegionEditLabel: NewRegionEditLabel,
870
+ images: [{
871
+ src: exampleImage,
872
+ name: "Seve's Desk"
873
+ }, {
874
+ src: images[1],
875
+ name: "Frame 0036"
876
+ }, {
877
+ src: images[2],
878
+ name: "Frame 0037"
879
+ }]
880
+ })
881
+ );
785
882
  }).add("Two on sample page w/ hotkeys", function () {
786
- return React.createElement(HotKeys, {
787
- keyMap: defaultKeyMap
788
- }, React.createElement("div", null, React.createElement("div", {
789
- style: {
790
- height: 600
791
- }
792
- }, React.createElement(Annotator, {
793
- onExit: actionAddon("onExit"),
794
- regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
795
- imageClsList: ["Alpha", "Beta", "Charlie", "Delta"],
796
- middlewares: [function (store) {
797
- return function (next) {
798
- return function (action) {
799
- actionAddon(action.type)(action);
800
- return next(action);
883
+ return (
884
+ /*#__PURE__*/
885
+ React.createElement(HotKeys, {
886
+ keyMap: defaultKeyMap
887
+ },
888
+ /*#__PURE__*/
889
+ React.createElement("div", null,
890
+ /*#__PURE__*/
891
+ React.createElement("div", {
892
+ style: {
893
+ height: 600
894
+ }
895
+ },
896
+ /*#__PURE__*/
897
+ React.createElement(Annotator, {
898
+ onExit: actionAddon("onExit"),
899
+ regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
900
+ imageClsList: ["Alpha", "Beta", "Charlie", "Delta"],
901
+ middlewares: [function (store) {
902
+ return function (next) {
903
+ return function (action) {
904
+ actionAddon(action.type)(action);
905
+ return next(action);
906
+ };
801
907
  };
802
- };
803
- }],
804
- images: [{
805
- src: exampleImage,
806
- name: "Seve's Desk",
807
- regions: testRegions
808
- }]
809
- })), React.createElement("div", {
810
- style: {
811
- height: 600
812
- }
813
- }, React.createElement(Annotator, {
814
- onExit: actionAddon("onExit"),
815
- middlewares: [function (store) {
816
- return function (next) {
817
- return function (action) {
818
- actionAddon(action.type)(action);
819
- return next(action);
908
+ }],
909
+ images: [{
910
+ src: exampleImage,
911
+ name: "Seve's Desk",
912
+ regions: testRegions
913
+ }]
914
+ })),
915
+ /*#__PURE__*/
916
+ React.createElement("div", {
917
+ style: {
918
+ height: 600
919
+ }
920
+ },
921
+ /*#__PURE__*/
922
+ React.createElement(Annotator, {
923
+ onExit: actionAddon("onExit"),
924
+ middlewares: [function (store) {
925
+ return function (next) {
926
+ return function (action) {
927
+ actionAddon(action.type)(action);
928
+ return next(action);
929
+ };
820
930
  };
821
- };
822
- }],
823
- images: [{
824
- src: exampleImage,
825
- name: "Seve's Desk",
826
- regions: testRegions
827
- }]
828
- }))));
931
+ }],
932
+ images: [{
933
+ src: exampleImage,
934
+ name: "Seve's Desk",
935
+ regions: testRegions
936
+ }]
937
+ }))))
938
+ );
829
939
  }).add("CORs Error (Pixel Segmentation)", function () {
830
- return React.createElement(Annotator, {
831
- onExit: actionAddon("onExit"),
832
- middlewares: middlewares,
833
- labelImages: true,
834
- fullImageSegmentationMode: true,
835
- regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
836
- images: [{
837
- src: "https://placebear.com/200/300",
838
- name: "Frame 0036"
839
- }]
840
- });
940
+ return (
941
+ /*#__PURE__*/
942
+ React.createElement(Annotator, {
943
+ onExit: actionAddon("onExit"),
944
+ middlewares: middlewares,
945
+ labelImages: true,
946
+ fullImageSegmentationMode: true,
947
+ regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
948
+ images: [{
949
+ src: "https://placebear.com/200/300",
950
+ name: "Frame 0036"
951
+ }]
952
+ })
953
+ );
841
954
  }).add("Modify Allowed Area", function () {
842
- return React.createElement(Annotator, {
843
- onExit: actionAddon("onExit"),
844
- middlewares: middlewares,
845
- labelImages: true,
846
- fullImageSegmentationMode: true,
847
- allowedArea: {
848
- x: 0,
849
- y: 0.6,
850
- w: 0.3,
851
- h: 0.3
852
- },
853
- enabledTools: ["modify-allowed-area"],
854
- regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
855
- images: [{
856
- src: exampleImage,
857
- name: "Frame 0036"
858
- }]
859
- });
955
+ return (
956
+ /*#__PURE__*/
957
+ React.createElement(Annotator, {
958
+ onExit: actionAddon("onExit"),
959
+ middlewares: middlewares,
960
+ labelImages: true,
961
+ fullImageSegmentationMode: true,
962
+ allowedArea: {
963
+ x: 0,
964
+ y: 0.6,
965
+ w: 0.3,
966
+ h: 0.3
967
+ },
968
+ enabledTools: ["modify-allowed-area"],
969
+ regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
970
+ images: [{
971
+ src: exampleImage,
972
+ name: "Frame 0036"
973
+ }]
974
+ })
975
+ );
860
976
  }).add("Hide Next, Hide Header Text", function () {
861
- return React.createElement(Annotator, {
862
- onExit: actionAddon("onExit"),
863
- labelImages: true,
864
- hideNext: true,
865
- hideHeaderText: true,
866
- fullImageSegmentationMode: true,
867
- enabledTools: ["modify-allowed-area"],
868
- regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
869
- images: [{
870
- src: exampleImage,
871
- name: "Frame 0036"
872
- }]
873
- });
977
+ return (
978
+ /*#__PURE__*/
979
+ React.createElement(Annotator, {
980
+ onExit: actionAddon("onExit"),
981
+ labelImages: true,
982
+ hideNext: true,
983
+ hideHeaderText: true,
984
+ fullImageSegmentationMode: true,
985
+ enabledTools: ["modify-allowed-area"],
986
+ regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
987
+ images: [{
988
+ src: exampleImage,
989
+ name: "Frame 0036"
990
+ }]
991
+ })
992
+ );
874
993
  }).add("Hide Header", function () {
875
- return React.createElement(Annotator, {
876
- onExit: actionAddon("onExit"),
877
- labelImages: true,
878
- hideHeader: true,
879
- fullImageSegmentationMode: true,
880
- enabledTools: ["modify-allowed-area"],
881
- regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
882
- images: [{
883
- src: exampleImage,
884
- name: "Frame 0036"
885
- }]
886
- });
994
+ return (
995
+ /*#__PURE__*/
996
+ React.createElement(Annotator, {
997
+ onExit: actionAddon("onExit"),
998
+ labelImages: true,
999
+ hideHeader: true,
1000
+ fullImageSegmentationMode: true,
1001
+ enabledTools: ["modify-allowed-area"],
1002
+ regionClsList: ["Alpha", "Beta", "Charlie", "Delta"],
1003
+ images: [{
1004
+ src: exampleImage,
1005
+ name: "Frame 0036"
1006
+ }]
1007
+ })
1008
+ );
887
1009
  });