@searpent/react-image-annotate 2.3.3 → 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.
- package/Annotator/examplePhotos.js +30 -30
- package/Annotator/examplePhotos_repr.js +28 -28
- package/Annotator/index.js +69 -32
- package/Annotator/index.story_bugdemo_15_1.js +895 -773
- package/Annotator/index.story_repr.js +1048 -933
- package/Annotator/reducers/convert-expanding-line-to-polygon.js +15 -16
- package/ClassSelectionMenu/index.js +55 -35
- package/Crosshairs/index.js +30 -23
- package/DebugSidebarBox/index.js +40 -9
- package/DemoSite/Editor.js +124 -79
- package/DemoSite/ErrorBoundaryDialog.js +19 -6
- package/DemoSite/index.js +26 -17
- package/Editor/index.js +70 -36
- package/Editor/index_bugdemo_15_1.js +68 -35
- package/Editor/readOnly.js +178 -127
- package/Errorer/index.js +8 -3
- package/FullImageSegmentationAnnotator/index.js +6 -3
- package/GroupSelectorSidebarBox/index.js +48 -32
- package/GroupsEditorSidebarBox/index.js +75 -40
- package/HelpSidebarBox/index.js +24 -13
- package/HighlightBox/index.js +37 -30
- package/HistorySidebarBox/index.js +51 -29
- package/ImageCanvas/index.js +165 -130
- package/ImageMask/index.js +9 -6
- package/ImageSelectorSidebarBox/index.js +44 -26
- package/KeyframeTimeline/index.js +65 -45
- package/KeyframesSelectorSidebarBox/index.js +76 -54
- package/LandingPage/index.js +76 -38
- package/Locker/index.js +8 -3
- package/MainLayout/RightSidebarItemsWrapper.js +7 -4
- package/MainLayout/icon-dictionary.js +99 -66
- package/MainLayout/index.js +256 -196
- package/MainLayout/index_bugdemo_15_1.js +253 -195
- package/MetadataEditorSidebarBox/index.js +152 -102
- package/MetadataEditorSidebarBox/index_14_01_25.js +152 -102
- package/MetadataEditorSidebarBox/index_repr.js +183 -128
- package/PageSelector/UpdatedBySemaphore.js +54 -0
- package/PageSelector/index.js +172 -96
- package/PageSelector/page-selector.css +126 -2
- package/PointDistances/index.js +45 -33
- package/PreventScrollToParents/index.js +16 -9
- package/RegionLabel/index.js +217 -165
- package/RegionSelectAndTransformBoxes/index.js +131 -105
- package/RegionSelectorSidebarBox/index.js +243 -165
- package/RegionShapes/index.js +213 -153
- package/RegionTags/index.js +83 -69
- package/SettingsDialog/index.js +50 -37
- package/SettingsProvider/index.js +8 -5
- package/Shortcuts/ShortcutField.js +21 -14
- package/Shortcuts/index.js +18 -12
- package/ShortcutsManager/index.js +7 -4
- package/Sidebar/index.js +46 -29
- package/SidebarBoxContainer/index.js +14 -7
- package/SmallToolButton/index.js +23 -16
- package/TagsSidebarBox/index.js +41 -28
- package/TaskDescriptionSidebarBox/index.js +24 -13
- package/Theme/index.js +8 -3
- package/VideoOrImageCanvasBackground/index.js +30 -17
- package/package.json +1 -1
- package/utils/spellcheck-nspell.js +2 -2
|
@@ -710,34 +710,34 @@ var examplePhotos = [{
|
|
|
710
710
|
},
|
|
711
711
|
"text": "[{\"label\":\"photo_caption\",\"text\":\"Protest n z února v Indii,\\n\\tpred proti v Pekingu.\"}]",
|
|
712
712
|
"groupId": "6",
|
|
713
|
-
"id": "346807506913198081"
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
713
|
+
"id": "346807506913198081"
|
|
714
|
+
} // {
|
|
715
|
+
// "label": "photo_caption",
|
|
716
|
+
// "score": 0.99,
|
|
717
|
+
// "box": {
|
|
718
|
+
// "X1": 0.80248857,
|
|
719
|
+
// "X2": 0.95999366,
|
|
720
|
+
// "Y1": 0.32127157,
|
|
721
|
+
// "Y2": 0.34381694
|
|
722
|
+
// },
|
|
723
|
+
// "text": "[{\"label\":\"photo_caption\",\"text\":\"Protest z února v Indii proti konání ZOH v Pekingu\"}]",
|
|
724
|
+
// "groupId": "6",
|
|
725
|
+
// "id": "346807506913198082"
|
|
726
|
+
// },
|
|
727
|
+
// {
|
|
728
|
+
// "label": "author",
|
|
729
|
+
// "score": 0.99,
|
|
730
|
+
// "box": {
|
|
731
|
+
// "X1": 0.9584186,
|
|
732
|
+
// "X2": 0.9733816,
|
|
733
|
+
// "Y1": 0.51628906,
|
|
734
|
+
// "Y2": 0.53319806
|
|
735
|
+
// },
|
|
736
|
+
// "text": "[{\"label\":\"author\",\"text\":\"PUR\"}]",
|
|
737
|
+
// "groupId": "6",
|
|
738
|
+
// "id": "346807506913198083"
|
|
739
|
+
// }
|
|
740
|
+
]
|
|
741
741
|
}, {
|
|
742
742
|
"modelFamily": "metadata-engine",
|
|
743
743
|
"name": "metadata-engine",
|
|
@@ -750,7 +750,7 @@ var examplePhotos = [{
|
|
|
750
750
|
"Y1": 0,
|
|
751
751
|
"Y2": 1
|
|
752
752
|
},
|
|
753
|
-
"text": "[{\"key\":\"articleType\",\"value\":\"news\"}, {\"key\":\"section\",\"value\":\"editorial\"}]",
|
|
753
|
+
"text": "[{\"key\":\"articleType\",\"value\":\"news\"}, {\"key\":\"previousArticleId\",\"value\":\"prev-article-1\"}, {\"key\":\"section\",\"value\":\"editorial\"}]",
|
|
754
754
|
"groupId": "42ba09e0-b2f5-439d-bdae-201e7c37787b",
|
|
755
755
|
"id": "aba453dd-f870-4510-ae40-a19eb52eb7d6"
|
|
756
756
|
}, {
|
|
@@ -762,7 +762,7 @@ var examplePhotos = [{
|
|
|
762
762
|
"Y1": 0,
|
|
763
763
|
"Y2": 1
|
|
764
764
|
},
|
|
765
|
-
"text": "[{\"key\":\"articleType\",\"value\":\"ads\"}, {\"key\":\"section\",\"value\":\"last page\"}]",
|
|
765
|
+
"text": "[{\"key\":\"articleType\",\"value\":\"ads\"}, {\"key\":\"previousArticleId\",\"value\":\"prev-article-2\"}, {\"key\":\"section\",\"value\":\"last page\"}]",
|
|
766
766
|
"groupId": "1",
|
|
767
767
|
"id": "2615bf87-7247-4bde-a0f9-45413034a6a6"
|
|
768
768
|
}]
|
|
@@ -710,34 +710,34 @@ var examplePhotos = [{
|
|
|
710
710
|
},
|
|
711
711
|
"text": "[{\"label\":\"photo_caption\",\"text\":\"Protest n z února v Indii,\\n\\tpred proti v Pekingu.\"}]",
|
|
712
712
|
"groupId": "6",
|
|
713
|
-
"id": "346807506913198081"
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
713
|
+
"id": "346807506913198081"
|
|
714
|
+
} // {
|
|
715
|
+
// "label": "photo_caption",
|
|
716
|
+
// "score": 0.99,
|
|
717
|
+
// "box": {
|
|
718
|
+
// "X1": 0.80248857,
|
|
719
|
+
// "X2": 0.95999366,
|
|
720
|
+
// "Y1": 0.32127157,
|
|
721
|
+
// "Y2": 0.34381694
|
|
722
|
+
// },
|
|
723
|
+
// "text": "[{\"label\":\"photo_caption\",\"text\":\"Protest z února v Indii proti konání ZOH v Pekingu\"}]",
|
|
724
|
+
// "groupId": "6",
|
|
725
|
+
// "id": "346807506913198082"
|
|
726
|
+
// },
|
|
727
|
+
// {
|
|
728
|
+
// "label": "author",
|
|
729
|
+
// "score": 0.99,
|
|
730
|
+
// "box": {
|
|
731
|
+
// "X1": 0.9584186,
|
|
732
|
+
// "X2": 0.9733816,
|
|
733
|
+
// "Y1": 0.51628906,
|
|
734
|
+
// "Y2": 0.53319806
|
|
735
|
+
// },
|
|
736
|
+
// "text": "[{\"label\":\"author\",\"text\":\"PUR\"}]",
|
|
737
|
+
// "groupId": "6",
|
|
738
|
+
// "id": "346807506913198083"
|
|
739
|
+
// }
|
|
740
|
+
]
|
|
741
741
|
}, {
|
|
742
742
|
"modelFamily": "metadata-engine",
|
|
743
743
|
"name": "metadata-engine",
|
package/Annotator/index.js
CHANGED
|
@@ -84,7 +84,8 @@ export var Annotator = function Annotator(_ref) {
|
|
|
84
84
|
_ref$save = _ref.save,
|
|
85
85
|
save = _ref$save === void 0 ? function () {} : _ref$save,
|
|
86
86
|
_ref$fetchImage = _ref.fetchImage,
|
|
87
|
-
fetchImage = _ref$fetchImage === void 0 ? function () {} : _ref$fetchImage
|
|
87
|
+
fetchImage = _ref$fetchImage === void 0 ? function () {} : _ref$fetchImage,
|
|
88
|
+
updatedBy = _ref.updatedBy;
|
|
88
89
|
|
|
89
90
|
if (typeof selectedImage === "string") {
|
|
90
91
|
selectedImage = (images || []).findIndex(function (img) {
|
|
@@ -213,7 +214,37 @@ export var Annotator = function Annotator(_ref) {
|
|
|
213
214
|
});
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
|
-
}, [state.previouslySelectedImage, state.selectedImage, state.images, state, save]); //
|
|
217
|
+
}, [state.previouslySelectedImage, state.selectedImage, state.images, state, save]); // Automatically save image shortly after specific metadata fields change
|
|
218
|
+
// (ArticleType, PreviousArticleId), but debounce so we don't save on every keystroke.
|
|
219
|
+
|
|
220
|
+
useEffect(function () {
|
|
221
|
+
var _state$images;
|
|
222
|
+
|
|
223
|
+
var lastAction = state.lastAction;
|
|
224
|
+
|
|
225
|
+
if (!lastAction || lastAction.type !== "UPDATE_METADATA" || lastAction.name !== "articleType" && lastAction.name !== "previousArticleId" || isNaN(lastAction.imageIndex)) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
var imageIndex = lastAction.imageIndex;
|
|
230
|
+
var image = (_state$images = state.images) === null || _state$images === void 0 ? void 0 : _state$images[imageIndex];
|
|
231
|
+
if (!image) return;
|
|
232
|
+
var timeoutId = setTimeout(function () {
|
|
233
|
+
var _state$images2;
|
|
234
|
+
|
|
235
|
+
var latestImage = (_state$images2 = state.images) === null || _state$images2 === void 0 ? void 0 : _state$images2[imageIndex];
|
|
236
|
+
if (!latestImage) return;
|
|
237
|
+
dispatchToReducer({
|
|
238
|
+
type: "SAVE_IMAGE",
|
|
239
|
+
image: _objectSpread({}, latestImage),
|
|
240
|
+
triggerRecalc: false,
|
|
241
|
+
toSaveMetadata: []
|
|
242
|
+
});
|
|
243
|
+
}, 800);
|
|
244
|
+
return function () {
|
|
245
|
+
clearTimeout(timeoutId);
|
|
246
|
+
};
|
|
247
|
+
}, [state.lastAction, state.images]); // handle save of image
|
|
217
248
|
|
|
218
249
|
useEffect(function () {
|
|
219
250
|
if (state.toSaveImage !== null) {
|
|
@@ -383,35 +414,41 @@ export var Annotator = function Annotator(_ref) {
|
|
|
383
414
|
recalcActive = _ref7[0],
|
|
384
415
|
saveActive = _ref7[1];
|
|
385
416
|
|
|
386
|
-
return
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
417
|
+
return (
|
|
418
|
+
/*#__PURE__*/
|
|
419
|
+
React.createElement(SettingsProvider, {
|
|
420
|
+
clsColors: clsColors,
|
|
421
|
+
groupColors: groupColors
|
|
422
|
+
},
|
|
423
|
+
/*#__PURE__*/
|
|
424
|
+
React.createElement(MainLayout, {
|
|
425
|
+
RegionEditLabel: RegionEditLabel,
|
|
426
|
+
alwaysShowNextButton: Boolean(onNextImage),
|
|
427
|
+
alwaysShowPrevButton: Boolean(onPrevImage),
|
|
428
|
+
state: state,
|
|
429
|
+
dispatch: dispatch,
|
|
430
|
+
onRegionClassAdded: onRegionClassAdded,
|
|
431
|
+
hideHeader: hideHeader,
|
|
432
|
+
hideHeaderText: hideHeaderText,
|
|
433
|
+
hideNext: hideNext,
|
|
434
|
+
hidePrev: hidePrev,
|
|
435
|
+
hideClone: hideClone,
|
|
436
|
+
hideSettings: hideSettings,
|
|
437
|
+
hideFullScreen: hideFullScreen,
|
|
438
|
+
hideSave: hideSave,
|
|
439
|
+
groups: groups,
|
|
440
|
+
onGroupSelect: onGroupSelect,
|
|
441
|
+
hideHistory: hideHistory,
|
|
442
|
+
hideNotEditingLabel: hideNotEditingLabel,
|
|
443
|
+
showEditor: showEditor,
|
|
444
|
+
showPageSelector: showPageSelector,
|
|
445
|
+
saveActive: recalcActive,
|
|
446
|
+
recalcActive: saveActive,
|
|
447
|
+
onMetadataChange: handleMetadataChange,
|
|
448
|
+
onAddGroup: handleAddGroup,
|
|
449
|
+
onRecalcClick: handleRecalcClicked,
|
|
450
|
+
updatedBy: updatedBy
|
|
451
|
+
}))
|
|
452
|
+
);
|
|
416
453
|
};
|
|
417
454
|
export default Annotator;
|