@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.
- package/Annotator/examplePhotos.js +28 -28
- package/Annotator/examplePhotos_repr.js +28 -28
- package/Annotator/index.js +38 -31
- 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
package/RegionLabel/index.js
CHANGED
|
@@ -50,182 +50,234 @@ export var RegionLabel = function RegionLabel(_ref) {
|
|
|
50
50
|
label: g.label || uuidToHash(g.id)
|
|
51
51
|
};
|
|
52
52
|
}) : [];
|
|
53
|
-
return
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return !editing ? onOpen(region) : null;
|
|
53
|
+
return (
|
|
54
|
+
/*#__PURE__*/
|
|
55
|
+
React.createElement(ThemeProvider, {
|
|
56
|
+
theme: theme
|
|
58
57
|
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
key: t,
|
|
74
|
-
className: "tag"
|
|
75
|
-
}, t);
|
|
76
|
-
}))) : React.createElement("div", {
|
|
77
|
-
style: {
|
|
78
|
-
width: 200
|
|
79
|
-
}
|
|
80
|
-
}, React.createElement("div", {
|
|
81
|
-
style: {
|
|
82
|
-
display: "flex",
|
|
83
|
-
flexDirection: "row"
|
|
84
|
-
}
|
|
85
|
-
}, React.createElement("div", {
|
|
86
|
-
style: {
|
|
87
|
-
display: "flex",
|
|
88
|
-
backgroundColor: region.color || "#888",
|
|
89
|
-
color: "#fff",
|
|
90
|
-
padding: 4,
|
|
91
|
-
paddingLeft: 8,
|
|
92
|
-
paddingRight: 8,
|
|
93
|
-
borderRadius: 4,
|
|
94
|
-
fontWeight: "bold",
|
|
95
|
-
textShadow: "0px 0px 5px rgba(0,0,0,0.4)"
|
|
96
|
-
}
|
|
97
|
-
}, region.type), React.createElement("div", {
|
|
98
|
-
style: {
|
|
99
|
-
flexGrow: 1
|
|
100
|
-
}
|
|
101
|
-
}), React.createElement(IconButton, {
|
|
102
|
-
onClick: function onClick() {
|
|
103
|
-
return onDelete(region);
|
|
58
|
+
/*#__PURE__*/
|
|
59
|
+
React.createElement(Paper, {
|
|
60
|
+
onClick: function onClick() {
|
|
61
|
+
return !editing ? onOpen(region) : null;
|
|
62
|
+
},
|
|
63
|
+
className: classnames(classes.regionInfo, {
|
|
64
|
+
highlighted: region.highlighted
|
|
65
|
+
})
|
|
66
|
+
}, !editing ?
|
|
67
|
+
/*#__PURE__*/
|
|
68
|
+
React.createElement("div", null, region.cls &&
|
|
69
|
+
/*#__PURE__*/
|
|
70
|
+
React.createElement("div", {
|
|
71
|
+
className: "name"
|
|
104
72
|
},
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
73
|
+
/*#__PURE__*/
|
|
74
|
+
React.createElement("div", {
|
|
75
|
+
className: "circle",
|
|
76
|
+
style: {
|
|
77
|
+
backgroundColor: region.color
|
|
78
|
+
}
|
|
79
|
+
}), region.cls), region.tags &&
|
|
80
|
+
/*#__PURE__*/
|
|
81
|
+
React.createElement("div", {
|
|
82
|
+
className: "tags"
|
|
83
|
+
}, region.tags.map(function (t) {
|
|
84
|
+
return (
|
|
85
|
+
/*#__PURE__*/
|
|
86
|
+
React.createElement("div", {
|
|
87
|
+
key: t,
|
|
88
|
+
className: "tag"
|
|
89
|
+
}, t)
|
|
90
|
+
);
|
|
91
|
+
}))) :
|
|
92
|
+
/*#__PURE__*/
|
|
93
|
+
React.createElement("div", {
|
|
94
|
+
style: {
|
|
95
|
+
width: 200
|
|
96
|
+
}
|
|
109
97
|
},
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
height: 16
|
|
117
|
-
}
|
|
118
|
-
})), React.createElement(IconButton, {
|
|
119
|
-
onClick: function onClick() {
|
|
120
|
-
return onDeleteGroup(region.groupId);
|
|
98
|
+
/*#__PURE__*/
|
|
99
|
+
React.createElement("div", {
|
|
100
|
+
style: {
|
|
101
|
+
display: "flex",
|
|
102
|
+
flexDirection: "row"
|
|
103
|
+
}
|
|
121
104
|
},
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
105
|
+
/*#__PURE__*/
|
|
106
|
+
React.createElement("div", {
|
|
107
|
+
style: {
|
|
108
|
+
display: "flex",
|
|
109
|
+
backgroundColor: region.color || "#888",
|
|
110
|
+
color: "#fff",
|
|
111
|
+
padding: 4,
|
|
112
|
+
paddingLeft: 8,
|
|
113
|
+
paddingRight: 8,
|
|
114
|
+
borderRadius: 4,
|
|
115
|
+
fontWeight: "bold",
|
|
116
|
+
textShadow: "0px 0px 5px rgba(0,0,0,0.4)"
|
|
117
|
+
}
|
|
118
|
+
}, region.type),
|
|
119
|
+
/*#__PURE__*/
|
|
120
|
+
React.createElement("div", {
|
|
121
|
+
style: {
|
|
122
|
+
flexGrow: 1
|
|
123
|
+
}
|
|
124
|
+
}),
|
|
125
|
+
/*#__PURE__*/
|
|
126
|
+
React.createElement(IconButton, {
|
|
127
|
+
onClick: function onClick() {
|
|
128
|
+
return onDelete(region);
|
|
129
|
+
},
|
|
130
|
+
tabIndex: -1,
|
|
131
|
+
style: {
|
|
132
|
+
width: 22,
|
|
133
|
+
height: 22
|
|
134
|
+
},
|
|
135
|
+
size: "small",
|
|
136
|
+
variant: "outlined"
|
|
126
137
|
},
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
height: 16
|
|
134
|
-
}
|
|
135
|
-
}))), (allowedClasses || []).length > 0 && React.createElement("div", {
|
|
136
|
-
style: {
|
|
137
|
-
marginTop: 6
|
|
138
|
-
}
|
|
139
|
-
}, React.createElement(CreatableSelect, {
|
|
140
|
-
placeholder: "Classification",
|
|
141
|
-
onChange: function onChange(o, actionMeta) {
|
|
142
|
-
if (actionMeta.action == "create-option") {
|
|
143
|
-
onRegionClassAdded(o.value);
|
|
138
|
+
/*#__PURE__*/
|
|
139
|
+
React.createElement(DeleteOutlineIcon, {
|
|
140
|
+
style: {
|
|
141
|
+
marginTop: -8,
|
|
142
|
+
width: 16,
|
|
143
|
+
height: 16
|
|
144
144
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
})),
|
|
146
|
+
/*#__PURE__*/
|
|
147
|
+
React.createElement(IconButton, {
|
|
148
|
+
onClick: function onClick() {
|
|
149
|
+
return onDeleteGroup(region.groupId);
|
|
150
|
+
},
|
|
151
|
+
tabIndex: -1,
|
|
152
|
+
style: {
|
|
153
|
+
width: 22,
|
|
154
|
+
height: 22
|
|
155
|
+
},
|
|
156
|
+
size: "small",
|
|
157
|
+
variant: "outlined"
|
|
149
158
|
},
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
groupId: newGroup.value
|
|
164
|
-
}));
|
|
159
|
+
/*#__PURE__*/
|
|
160
|
+
React.createElement(DeleteForeverIcon, {
|
|
161
|
+
style: {
|
|
162
|
+
marginTop: -8,
|
|
163
|
+
width: 16,
|
|
164
|
+
height: 16
|
|
165
|
+
}
|
|
166
|
+
}))), (allowedClasses || []).length > 0 &&
|
|
167
|
+
/*#__PURE__*/
|
|
168
|
+
React.createElement("div", {
|
|
169
|
+
style: {
|
|
170
|
+
marginTop: 6
|
|
171
|
+
}
|
|
165
172
|
},
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
173
|
+
/*#__PURE__*/
|
|
174
|
+
React.createElement(CreatableSelect, {
|
|
175
|
+
placeholder: "Classification",
|
|
176
|
+
onChange: function onChange(o, actionMeta) {
|
|
177
|
+
if (actionMeta.action == "create-option") {
|
|
178
|
+
onRegionClassAdded(o.value);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return _onChange(_objectSpread({}, region, {
|
|
182
|
+
cls: o.value
|
|
183
|
+
}));
|
|
184
|
+
},
|
|
185
|
+
value: region.cls ? {
|
|
186
|
+
label: region.cls,
|
|
187
|
+
value: region.cls
|
|
188
|
+
} : null,
|
|
189
|
+
options: asMutable(allowedClasses.map(function (c) {
|
|
190
|
+
return {
|
|
191
|
+
value: c,
|
|
192
|
+
label: c
|
|
193
|
+
};
|
|
194
|
+
}))
|
|
195
|
+
})), (allowedGroups || []).length > 0 &&
|
|
196
|
+
/*#__PURE__*/
|
|
197
|
+
React.createElement(Select, {
|
|
198
|
+
onChange: function onChange(newGroup) {
|
|
199
|
+
return _onChange(_objectSpread({}, region, {
|
|
200
|
+
groupId: newGroup.value
|
|
201
|
+
}));
|
|
202
|
+
},
|
|
203
|
+
placeholder: "Group",
|
|
204
|
+
value: allowedGroupsForSelect.find(function (g) {
|
|
205
|
+
return g.value === region.groupId;
|
|
206
|
+
}),
|
|
207
|
+
options: _toConsumableArray(allowedGroupsForSelect)
|
|
208
|
+
}), (allowedTags || []).length > 0 &&
|
|
209
|
+
/*#__PURE__*/
|
|
210
|
+
React.createElement("div", {
|
|
211
|
+
style: {
|
|
212
|
+
marginTop: 4
|
|
213
|
+
}
|
|
182
214
|
},
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
215
|
+
/*#__PURE__*/
|
|
216
|
+
React.createElement(Select, {
|
|
217
|
+
onChange: function onChange(newTags) {
|
|
218
|
+
return _onChange(_objectSpread({}, region, {
|
|
219
|
+
tags: newTags.map(function (t) {
|
|
220
|
+
return t.value;
|
|
221
|
+
})
|
|
222
|
+
}));
|
|
223
|
+
},
|
|
224
|
+
placeholder: "Tags",
|
|
225
|
+
value: (region.tags || []).map(function (c) {
|
|
226
|
+
return {
|
|
227
|
+
label: c,
|
|
228
|
+
value: c
|
|
229
|
+
};
|
|
230
|
+
}),
|
|
231
|
+
isMulti: true,
|
|
232
|
+
options: asMutable(allowedTags.map(function (c) {
|
|
233
|
+
return {
|
|
234
|
+
value: c,
|
|
235
|
+
label: c
|
|
236
|
+
};
|
|
237
|
+
}))
|
|
238
|
+
})), allowComments &&
|
|
239
|
+
/*#__PURE__*/
|
|
240
|
+
React.createElement(TextField, {
|
|
241
|
+
InputProps: {
|
|
242
|
+
className: classes.commentBox
|
|
243
|
+
},
|
|
244
|
+
fullWidth: true,
|
|
245
|
+
multiline: true,
|
|
246
|
+
rows: 3,
|
|
247
|
+
ref: commentInputRef,
|
|
248
|
+
onClick: onCommentInputClick,
|
|
249
|
+
value: region.comment || "",
|
|
250
|
+
onChange: function onChange(event) {
|
|
251
|
+
return _onChange(_objectSpread({}, region, {
|
|
252
|
+
comment: event.target.value
|
|
253
|
+
}));
|
|
254
|
+
}
|
|
255
|
+
}), onClose &&
|
|
256
|
+
/*#__PURE__*/
|
|
257
|
+
React.createElement("div", {
|
|
258
|
+
style: {
|
|
259
|
+
marginTop: 4,
|
|
260
|
+
display: "flex"
|
|
261
|
+
}
|
|
200
262
|
},
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
display: "flex"
|
|
216
|
-
}
|
|
217
|
-
}, React.createElement("div", {
|
|
218
|
-
style: {
|
|
219
|
-
flexGrow: 1
|
|
220
|
-
}
|
|
221
|
-
}), React.createElement(Button, {
|
|
222
|
-
onClick: function onClick() {
|
|
223
|
-
return onClose(region);
|
|
263
|
+
/*#__PURE__*/
|
|
264
|
+
React.createElement("div", {
|
|
265
|
+
style: {
|
|
266
|
+
flexGrow: 1
|
|
267
|
+
}
|
|
268
|
+
}),
|
|
269
|
+
/*#__PURE__*/
|
|
270
|
+
React.createElement(Button, {
|
|
271
|
+
onClick: function onClick() {
|
|
272
|
+
return onClose(region);
|
|
273
|
+
},
|
|
274
|
+
size: "small",
|
|
275
|
+
variant: "contained",
|
|
276
|
+
color: "primary"
|
|
224
277
|
},
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}, React.createElement(CheckIcon, null))))));
|
|
278
|
+
/*#__PURE__*/
|
|
279
|
+
React.createElement(CheckIcon, null))))))
|
|
280
|
+
);
|
|
229
281
|
};
|
|
230
282
|
export default memo(RegionLabel, function (prevProps, nextProps) {
|
|
231
283
|
return prevProps.editing === nextProps.editing && prevProps.region === nextProps.region;
|
|
@@ -46,110 +46,133 @@ export var RegionSelectAndTransformBox = memo(function (_ref2) {
|
|
|
46
46
|
var _layoutParams$current = layoutParams.current,
|
|
47
47
|
iw = _layoutParams$current.iw,
|
|
48
48
|
ih = _layoutParams$current.ih;
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
49
|
+
return (
|
|
50
|
+
/*#__PURE__*/
|
|
51
|
+
React.createElement(ThemeProvider, {
|
|
52
|
+
theme: theme
|
|
53
|
+
},
|
|
54
|
+
/*#__PURE__*/
|
|
55
|
+
React.createElement(Fragment, null,
|
|
56
|
+
/*#__PURE__*/
|
|
57
|
+
React.createElement(PreventScrollToParents, null, showHighlightBox && r.type !== "polygon" &&
|
|
58
|
+
/*#__PURE__*/
|
|
59
|
+
React.createElement(HighlightBox, {
|
|
60
|
+
region: r,
|
|
61
|
+
mouseEvents: mouseEvents,
|
|
62
|
+
dragWithPrimary: dragWithPrimary,
|
|
63
|
+
createWithPrimary: createWithPrimary,
|
|
64
|
+
zoomWithPrimary: zoomWithPrimary,
|
|
65
|
+
onBeginMovePoint: onBeginMovePoint,
|
|
66
|
+
onSelectRegion: onSelectRegion,
|
|
67
|
+
pbox: pbox
|
|
68
|
+
}), r.type === "box" && !dragWithPrimary && !zoomWithPrimary && !r.locked && r.highlighted && mat.a < 1.2 && [[0, 0], [0.5, 0], [1, 0], [1, 0.5], [1, 1], [0.5, 1], [0, 1], [0, 0.5], [0.5, 0.5]].map(function (_ref3, i) {
|
|
69
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
70
|
+
px = _ref4[0],
|
|
71
|
+
py = _ref4[1];
|
|
64
72
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
return (
|
|
74
|
+
/*#__PURE__*/
|
|
75
|
+
React.createElement(TransformGrabber, Object.assign({
|
|
76
|
+
key: i
|
|
77
|
+
}, mouseEvents, {
|
|
78
|
+
onMouseDown: function onMouseDown(e) {
|
|
79
|
+
if (e.button === 0) return onBeginBoxTransform(r, [px * 2 - 1, py * 2 - 1]);
|
|
80
|
+
mouseEvents.onMouseDown(e);
|
|
81
|
+
},
|
|
82
|
+
style: {
|
|
83
|
+
left: pbox.x - 4 - 2 + pbox.w * px,
|
|
84
|
+
top: pbox.y - 4 - 2 + pbox.h * py,
|
|
85
|
+
cursor: boxCursorMap[py * 2][px * 2],
|
|
86
|
+
borderRadius: px === 0.5 && py === 0.5 ? 4 : undefined
|
|
87
|
+
}
|
|
88
|
+
}))
|
|
89
|
+
);
|
|
90
|
+
}), r.type === "polygon" && !dragWithPrimary && !zoomWithPrimary && !r.locked && r.highlighted && r.points.map(function (_ref5, i) {
|
|
91
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
92
|
+
px = _ref6[0],
|
|
93
|
+
py = _ref6[1];
|
|
83
94
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
95
|
+
var proj = mat.clone().inverse().applyToPoint(px * iw, py * ih);
|
|
96
|
+
return (
|
|
97
|
+
/*#__PURE__*/
|
|
98
|
+
React.createElement(TransformGrabber, Object.assign({
|
|
99
|
+
key: i
|
|
100
|
+
}, mouseEvents, {
|
|
101
|
+
onMouseDown: function onMouseDown(e) {
|
|
102
|
+
if (e.button === 0 && (!r.open || i === 0)) return onBeginMovePolygonPoint(r, i);
|
|
103
|
+
mouseEvents.onMouseDown(e);
|
|
104
|
+
},
|
|
105
|
+
style: {
|
|
106
|
+
cursor: !r.open ? "move" : i === 0 ? "pointer" : undefined,
|
|
107
|
+
zIndex: 10,
|
|
108
|
+
pointerEvents: r.open && i === r.points.length - 1 ? "none" : undefined,
|
|
109
|
+
left: proj.x - 4,
|
|
110
|
+
top: proj.y - 4
|
|
111
|
+
}
|
|
112
|
+
}))
|
|
113
|
+
);
|
|
114
|
+
}), r.type === "polygon" && r.highlighted && !dragWithPrimary && !zoomWithPrimary && !r.locked && !r.open && r.points.length > 1 && r.points.map(function (p1, i) {
|
|
115
|
+
return [p1, r.points[(i + 1) % r.points.length]];
|
|
116
|
+
}).map(function (_ref7) {
|
|
117
|
+
var _ref8 = _slicedToArray(_ref7, 2),
|
|
118
|
+
p1 = _ref8[0],
|
|
119
|
+
p2 = _ref8[1];
|
|
106
120
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
121
|
+
return [(p1[0] + p2[0]) / 2, (p1[1] + p2[1]) / 2];
|
|
122
|
+
}).map(function (pa, i) {
|
|
123
|
+
var proj = mat.clone().inverse().applyToPoint(pa[0] * iw, pa[1] * ih);
|
|
124
|
+
return (
|
|
125
|
+
/*#__PURE__*/
|
|
126
|
+
React.createElement(TransformGrabber, Object.assign({
|
|
127
|
+
key: i
|
|
128
|
+
}, mouseEvents, {
|
|
129
|
+
onMouseDown: function onMouseDown(e) {
|
|
130
|
+
if (e.button === 0) return onAddPolygonPoint(r, pa, i + 1);
|
|
131
|
+
mouseEvents.onMouseDown(e);
|
|
132
|
+
},
|
|
133
|
+
style: {
|
|
134
|
+
cursor: "copy",
|
|
135
|
+
zIndex: 10,
|
|
136
|
+
left: proj.x - 4,
|
|
137
|
+
top: proj.y - 4,
|
|
138
|
+
border: "2px dotted #fff",
|
|
139
|
+
opacity: 0.5
|
|
140
|
+
}
|
|
141
|
+
}))
|
|
142
|
+
);
|
|
143
|
+
}), r.type === "keypoints" && !dragWithPrimary && !zoomWithPrimary && !r.locked && r.highlighted && Object.entries(r.points).map(function (_ref9, i) {
|
|
144
|
+
var _ref10 = _slicedToArray(_ref9, 2),
|
|
145
|
+
keypointId = _ref10[0],
|
|
146
|
+
_ref10$ = _ref10[1],
|
|
147
|
+
px = _ref10$.x,
|
|
148
|
+
py = _ref10$.y;
|
|
132
149
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
var proj = mat.clone().inverse().applyToPoint(px * iw, py * ih);
|
|
151
|
+
return (
|
|
152
|
+
/*#__PURE__*/
|
|
153
|
+
React.createElement(Tooltip, {
|
|
154
|
+
title: keypointId,
|
|
155
|
+
key: i
|
|
156
|
+
},
|
|
157
|
+
/*#__PURE__*/
|
|
158
|
+
React.createElement(TransformGrabber, Object.assign({
|
|
159
|
+
key: i
|
|
160
|
+
}, mouseEvents, {
|
|
161
|
+
onMouseDown: function onMouseDown(e) {
|
|
162
|
+
if (e.button === 0 && (!r.open || i === 0)) return onBeginMoveKeypoint(r, keypointId);
|
|
163
|
+
mouseEvents.onMouseDown(e);
|
|
164
|
+
},
|
|
165
|
+
style: {
|
|
166
|
+
cursor: !r.open ? "move" : i === 0 ? "pointer" : undefined,
|
|
167
|
+
zIndex: 10,
|
|
168
|
+
pointerEvents: r.open && i === r.points.length - 1 ? "none" : undefined,
|
|
169
|
+
left: proj.x - 4,
|
|
170
|
+
top: proj.y - 4
|
|
171
|
+
}
|
|
172
|
+
})))
|
|
173
|
+
);
|
|
174
|
+
}))))
|
|
175
|
+
);
|
|
153
176
|
}, arePropsEqual);
|
|
154
177
|
export var RegionSelectAndTransformBoxes = memo(function (props) {
|
|
155
178
|
return props.regions.filter(function (r) {
|
|
@@ -157,11 +180,14 @@ export var RegionSelectAndTransformBoxes = memo(function (props) {
|
|
|
157
180
|
}).filter(function (r) {
|
|
158
181
|
return !r.locked;
|
|
159
182
|
}).map(function (r, i) {
|
|
160
|
-
return
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
183
|
+
return (
|
|
184
|
+
/*#__PURE__*/
|
|
185
|
+
React.createElement(RegionSelectAndTransformBox, Object.assign({
|
|
186
|
+
key: r.id
|
|
187
|
+
}, props, {
|
|
188
|
+
region: r
|
|
189
|
+
}))
|
|
190
|
+
);
|
|
165
191
|
});
|
|
166
192
|
}, function (n, p) {
|
|
167
193
|
return n.regions === p.regions && n.mat === p.mat;
|