react-image-annotate-master-custom 0.0.20 → 0.0.22

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.
@@ -1,4 +1,3 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread";
2
1
  import React, { useRef, memo } from "react";
3
2
  import Paper from "@mui/material/Paper";
4
3
  import { makeStyles } from "@mui/styles";
@@ -23,7 +22,7 @@ export var RegionLabel = function RegionLabel(_ref) {
23
22
  allowedClasses = _ref.allowedClasses,
24
23
  allowedTags = _ref.allowedTags,
25
24
  onDelete = _ref.onDelete,
26
- _onChange = _ref.onChange,
25
+ onChange = _ref.onChange,
27
26
  onClose = _ref.onClose,
28
27
  onOpen = _ref.onOpen,
29
28
  onRegionClassAdded = _ref.onRegionClassAdded,
@@ -39,158 +38,26 @@ export var RegionLabel = function RegionLabel(_ref) {
39
38
 
40
39
  return React.createElement(ThemeProvider, {
41
40
  theme: theme
42
- }, React.createElement(Paper, {
43
- onClick: function onClick() {
44
- return !editing ? onOpen(region) : null;
45
- },
41
+ }, region.cls && React.createElement(Paper // onClick={() => (!editing ? onOpen(region) : null)}
42
+ , {
46
43
  className: classnames(classes.regionInfo, {
47
- highlighted: region.highlighted
44
+ highlighted: true // highlighted: region.highlighted,
45
+
48
46
  })
49
47
  }, React.createElement("div", {
50
48
  style: {
51
- display: "".concat(!editing ? "unset" : "none")
49
+ display: "unset"
52
50
  }
53
51
  }, region.cls && React.createElement("div", {
54
52
  className: "name"
55
- }, React.createElement("div", {
56
- className: "circle",
57
- style: {
58
- backgroundColor: region.color
59
- }
60
- }), region.cls), region.tags && React.createElement("div", {
53
+ }, "#".concat(region.cls)), region.tags && React.createElement("div", {
61
54
  className: "tags"
62
55
  }, region.tags.map(function (t) {
63
56
  return React.createElement("div", {
64
57
  key: t,
65
58
  className: "tag"
66
59
  }, t);
67
- }))), React.createElement("div", {
68
- style: {
69
- width: 200,
70
- display: "".concat(editing ? "unset" : "none")
71
- }
72
- }, React.createElement("div", {
73
- style: {
74
- display: "flex",
75
- flexDirection: "row"
76
- }
77
- }, React.createElement("div", {
78
- style: {
79
- display: "flex",
80
- backgroundColor: region.color || "#888",
81
- color: "#fff",
82
- padding: 4,
83
- paddingLeft: 8,
84
- paddingRight: 8,
85
- borderRadius: 4,
86
- fontWeight: "bold",
87
- textShadow: "0px 0px 5px rgba(0,0,0,0.4)"
88
- }
89
- }, region.type), React.createElement("div", {
90
- style: {
91
- flexGrow: 1
92
- }
93
- }), React.createElement(IconButton, {
94
- onClick: function onClick() {
95
- return onDelete(region);
96
- },
97
- tabIndex: -1,
98
- style: {
99
- width: 22,
100
- height: 22
101
- },
102
- size: "small",
103
- variant: "outlined",
104
- id: "delete-region-".concat(region.id)
105
- }, React.createElement(TrashIcon, {
106
- style: {
107
- marginTop: -8,
108
- width: 16,
109
- height: 16
110
- }
111
- }))), (allowedClasses || []).length > 0 && React.createElement("div", {
112
- style: {
113
- marginTop: 6
114
- }
115
- }, React.createElement(CreatableSelect, {
116
- placeholder: "Classification",
117
- onChange: function onChange(o, actionMeta) {
118
- if (actionMeta.action == "create-option") {
119
- onRegionClassAdded(o.value);
120
- }
121
-
122
- return _onChange(_objectSpread({}, region, {
123
- cls: o.value
124
- }));
125
- },
126
- value: region.cls ? {
127
- label: region.cls,
128
- value: region.cls
129
- } : null,
130
- options: asMutable(allowedClasses.map(function (c) {
131
- return {
132
- value: c,
133
- label: c
134
- };
135
- }))
136
- })), (allowedTags || []).length > 0 && React.createElement("div", {
137
- style: {
138
- marginTop: 4
139
- }
140
- }, React.createElement(Select, {
141
- onChange: function onChange(newTags) {
142
- return _onChange(_objectSpread({}, region, {
143
- tags: newTags.map(function (t) {
144
- return t.value;
145
- })
146
- }));
147
- },
148
- placeholder: "Tags",
149
- value: (region.tags || []).map(function (c) {
150
- return {
151
- label: c,
152
- value: c
153
- };
154
- }),
155
- isMulti: true,
156
- options: asMutable(allowedTags.map(function (c) {
157
- return {
158
- value: c,
159
- label: c
160
- };
161
- }))
162
- })), allowComments && React.createElement(TextField, {
163
- InputProps: {
164
- className: classes.commentBox
165
- },
166
- fullWidth: true,
167
- multiline: true,
168
- rows: 3,
169
- ref: commentInputRef,
170
- onClick: onCommentInputClick,
171
- value: region.comment || "",
172
- onChange: function onChange(event) {
173
- return _onChange(_objectSpread({}, region, {
174
- comment: event.target.value
175
- }));
176
- }
177
- }), onClose && React.createElement("div", {
178
- style: {
179
- marginTop: 4,
180
- display: "flex"
181
- }
182
- }, React.createElement("div", {
183
- style: {
184
- flexGrow: 1
185
- }
186
- }), React.createElement(Button, {
187
- onClick: function onClick() {
188
- return onClose(region);
189
- },
190
- size: "small",
191
- variant: "contained",
192
- color: "primary"
193
- }, React.createElement(CheckIcon, null))))));
60
+ })))));
194
61
  };
195
62
  export default memo(RegionLabel, function (prevProps, nextProps) {
196
63
  return prevProps.editing === nextProps.editing && prevProps.region === nextProps.region;
@@ -6,8 +6,8 @@ export default {
6
6
  transition: "opacity 200ms",
7
7
  opacity: 0.5,
8
8
  "&:hover": {
9
- opacity: 0.9,
10
- cursor: "pointer"
9
+ opacity: 0.9 // cursor: "pointer",
10
+
11
11
  },
12
12
  "&.highlighted": {
13
13
  opacity: 0.9,
@@ -1,21 +1,6 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread";
2
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
2
  import React, { memo } from "react";
4
3
  import colorAlpha from "color-alpha";
5
- var noSelectStyle = {
6
- WebkitUserSelect: 'none',
7
-
8
- /* Chrome, Safari, Opera */
9
- MozUserSelect: 'none',
10
-
11
- /* Firefox */
12
- MsUserSelect: 'none',
13
-
14
- /* Internet Explorer/Edge */
15
- userSelect: 'none'
16
- /* Non-prefixed version */
17
-
18
- };
19
4
 
20
5
  function clamp(num, min, max) {
21
6
  return num <= min ? min : num >= max ? max : num;
@@ -27,7 +12,7 @@ var RegionComponents = {
27
12
  var region = _ref.region,
28
13
  iw = _ref.iw,
29
14
  ih = _ref.ih;
30
- return React.createElement(React.Fragment, null, React.createElement("g", {
15
+ return React.createElement("g", {
31
16
  transform: "translate(".concat(region.x * iw, " ").concat(region.y * ih, ")")
32
17
  }, React.createElement("path", {
33
18
  d: "M 1.866 12.7018 C 4.234 9.7951 9.486 2.7501 9.486 -1.207 C 9.486 -6.0063 5.5922 -9.9 0.793 -9.9 S -7.9 -6.0063 -7.9 -1.207 c 0 3.9571 5.2973 11.0021 7.62 13.9088 c 0.5569 0.6927 1.5892 0.6927 2.1461 0 z M 0.793 -4.1047 A 2.8977 2.8977 90 1 1 0.793 1.6907 a 2.8977 2.8977 90 1 1 0 -5.7953 z",
@@ -38,7 +23,7 @@ var RegionComponents = {
38
23
  strokeWidth: 2,
39
24
  stroke: "#E45B21",
40
25
  fill: "#E45B21"
41
- })));
26
+ }));
42
27
  }),
43
28
  line: memo(function (_ref2) {
44
29
  var region = _ref2.region,
@@ -260,41 +245,17 @@ export var WrappedRegionList = memo(function (_ref19) {
260
245
  }, function (n, p) {
261
246
  return n.regions === p.regions && n.iw === p.iw && n.ih === p.ih;
262
247
  });
263
- export var WrappedRegionListSid = memo(function (_ref20) {
264
- var regions = _ref20.regions,
248
+ export var RegionShapes = function RegionShapes(_ref20) {
249
+ var mat = _ref20.mat,
250
+ imagePosition = _ref20.imagePosition,
251
+ _ref20$regions = _ref20.regions,
252
+ regions = _ref20$regions === void 0 ? [] : _ref20$regions,
265
253
  keypointDefinitions = _ref20.keypointDefinitions,
266
- iw = _ref20.iw,
267
- ih = _ref20.ih,
268
254
  fullSegmentationMode = _ref20.fullSegmentationMode;
269
- return regions.filter(function (r) {
270
- return r.visible !== false;
271
- }).map(function (r) {
272
- return React.createElement(React.Fragment, null, React.createElement("div", {
273
- style: _objectSpread({
274
- color: '#800020',
275
- position: 'absolute',
276
- zIndex: 1000,
277
- left: r.x * iw + 18,
278
- top: r.y * ih + 18,
279
- fontSize: '13px',
280
- fontWeight: 500
281
- }, noSelectStyle)
282
- }, (r === null || r === void 0 ? void 0 : r.sid) && "#".concat(r === null || r === void 0 ? void 0 : r.sid)));
283
- });
284
- }, function (n, p) {
285
- return n.regions === p.regions && n.iw === p.iw && n.ih === p.ih;
286
- });
287
- export var RegionShapes = function RegionShapes(_ref21) {
288
- var mat = _ref21.mat,
289
- imagePosition = _ref21.imagePosition,
290
- _ref21$regions = _ref21.regions,
291
- regions = _ref21$regions === void 0 ? [] : _ref21$regions,
292
- keypointDefinitions = _ref21.keypointDefinitions,
293
- fullSegmentationMode = _ref21.fullSegmentationMode;
294
255
  var iw = imagePosition.bottomRight.x - imagePosition.topLeft.x;
295
256
  var ih = imagePosition.bottomRight.y - imagePosition.topLeft.y;
296
257
  if (isNaN(iw) || isNaN(ih)) return null;
297
- return React.createElement(React.Fragment, null, React.createElement("svg", {
258
+ return React.createElement("svg", {
298
259
  width: iw,
299
260
  height: ih,
300
261
  style: {
@@ -313,13 +274,6 @@ export var RegionShapes = function RegionShapes(_ref21) {
313
274
  ih: ih,
314
275
  keypointDefinitions: keypointDefinitions,
315
276
  fullSegmentationMode: fullSegmentationMode
316
- })), React.createElement(WrappedRegionListSid, {
317
- key: "wrapped-region-list-sid",
318
- regions: regions,
319
- iw: iw,
320
- ih: ih,
321
- keypointDefinitions: keypointDefinitions,
322
- fullSegmentationMode: fullSegmentationMode
323
277
  }));
324
278
  };
325
279
  export default RegionShapes;
@@ -44,8 +44,9 @@ export var RegionTags = function RegionTags(_ref) {
44
44
  ih = _layoutParams$current.ih;
45
45
  var margin = 8;
46
46
  if (region.highlighted && region.type === "box") margin += 6;
47
- var labelBoxHeight = region.editingLabels && !region.locked ? 300 : region.tags ? 60 : 50;
48
- var displayOnTop = pbox.y > labelBoxHeight;
47
+ var labelBoxHeight = region.editingLabels && !region.locked ? 300 : region.tags ? 60 : 50; // const displayOnTop = pbox.y > labelBoxHeight
48
+
49
+ var displayOnTop = true;
49
50
  var coords = displayOnTop ? {
50
51
  left: pbox.x,
51
52
  top: pbox.y - margin / 2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-image-annotate-master-custom",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "dependencies": {
5
5
  "@fortawesome/fontawesome-svg-core": "^1.2.12",
6
6
  "@fortawesome/free-solid-svg-icons": "^5.6.3",