react-image-annotate-master-custom 0.0.16 → 0.0.18
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/ImageCanvas/index.js +6 -6
- package/MainLayout/index.js +1 -6
- package/RegionShapes/index.js +47 -15
- package/package.json +1 -1
package/ImageCanvas/index.js
CHANGED
|
@@ -406,18 +406,18 @@ export var ImageCanvas = function ImageCanvas(_ref2) {
|
|
|
406
406
|
regionClsList: regionClsList,
|
|
407
407
|
imageSrc: imageSrc,
|
|
408
408
|
regions: regions
|
|
409
|
-
}), React.createElement("canvas", {
|
|
410
|
-
style: {
|
|
411
|
-
opacity: 0.25
|
|
412
|
-
},
|
|
413
|
-
className: classes.canvas,
|
|
414
|
-
ref: canvasEl
|
|
415
409
|
}), React.createElement(RegionShapes, {
|
|
416
410
|
mat: mat,
|
|
417
411
|
keypointDefinitions: keypointDefinitions,
|
|
418
412
|
imagePosition: imagePosition,
|
|
419
413
|
regions: regions,
|
|
420
414
|
fullSegmentationMode: fullImageSegmentationMode
|
|
415
|
+
}), React.createElement("canvas", {
|
|
416
|
+
style: {
|
|
417
|
+
opacity: 0.25
|
|
418
|
+
},
|
|
419
|
+
className: classes.canvas,
|
|
420
|
+
ref: canvasEl
|
|
421
421
|
}), React.createElement(VideoOrImageCanvasBackground, {
|
|
422
422
|
videoPlaying: videoPlaying,
|
|
423
423
|
imagePosition: imagePosition,
|
package/MainLayout/index.js
CHANGED
|
@@ -147,11 +147,7 @@ export var MainLayout = function MainLayout(_ref3) {
|
|
|
147
147
|
e.target.focus();
|
|
148
148
|
}
|
|
149
149
|
}, []);
|
|
150
|
-
var canvas = React.createElement(ImageCanvas, Object.assign({
|
|
151
|
-
onClick: function onClick() {
|
|
152
|
-
return console.log("3333");
|
|
153
|
-
}
|
|
154
|
-
}, settings, {
|
|
150
|
+
var canvas = React.createElement(ImageCanvas, Object.assign({}, settings, {
|
|
155
151
|
showCrosshairs: settings.showCrosshairs && !["select", "pan", "zoom"].includes(state.selectedTool),
|
|
156
152
|
key: state.selectedImage,
|
|
157
153
|
showMask: state.showMask,
|
|
@@ -197,7 +193,6 @@ export var MainLayout = function MainLayout(_ref3) {
|
|
|
197
193
|
allowComments: state.allowComments
|
|
198
194
|
}));
|
|
199
195
|
var onClickIconSidebarItem = useEventCallback(function (item) {
|
|
200
|
-
console.log(1111);
|
|
201
196
|
dispatch({
|
|
202
197
|
type: "SELECT_TOOL",
|
|
203
198
|
selectedTool: item.name
|
package/RegionShapes/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import React, { memo } from "react";
|
|
3
3
|
import colorAlpha from "color-alpha";
|
|
4
|
+
import "./regionShape.css";
|
|
4
5
|
|
|
5
6
|
function clamp(num, min, max) {
|
|
6
7
|
return num <= min ? min : num >= max ? max : num;
|
|
@@ -12,19 +13,18 @@ var RegionComponents = {
|
|
|
12
13
|
var region = _ref.region,
|
|
13
14
|
iw = _ref.iw,
|
|
14
15
|
ih = _ref.ih;
|
|
15
|
-
return React.createElement("g", {
|
|
16
|
+
return React.createElement(React.Fragment, null, React.createElement("g", {
|
|
16
17
|
transform: "translate(".concat(region.x * iw, " ").concat(region.y * ih, ")")
|
|
17
18
|
}, React.createElement("path", {
|
|
18
19
|
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",
|
|
20
|
+
style: {
|
|
21
|
+
position: "absolute",
|
|
22
|
+
zIndex: -1
|
|
23
|
+
},
|
|
19
24
|
strokeWidth: 2,
|
|
20
25
|
stroke: "#E45B21",
|
|
21
26
|
fill: "#E45B21"
|
|
22
|
-
})
|
|
23
|
-
x: "15",
|
|
24
|
-
y: "15",
|
|
25
|
-
fill: "red",
|
|
26
|
-
fontSize: "12"
|
|
27
|
-
}, region === null || region === void 0 ? void 0 : region.sid));
|
|
27
|
+
})));
|
|
28
28
|
}),
|
|
29
29
|
line: memo(function (_ref2) {
|
|
30
30
|
var region = _ref2.region,
|
|
@@ -234,29 +234,54 @@ export var WrappedRegionList = memo(function (_ref19) {
|
|
|
234
234
|
return r.visible !== false;
|
|
235
235
|
}).map(function (r) {
|
|
236
236
|
var Component = RegionComponents[r.type];
|
|
237
|
-
return React.createElement(Component, {
|
|
237
|
+
return React.createElement(React.Fragment, null, React.createElement(Component, {
|
|
238
238
|
key: r.regionId,
|
|
239
239
|
region: r,
|
|
240
240
|
iw: iw,
|
|
241
241
|
ih: ih,
|
|
242
242
|
keypointDefinitions: keypointDefinitions,
|
|
243
243
|
fullSegmentationMode: fullSegmentationMode
|
|
244
|
-
});
|
|
244
|
+
}));
|
|
245
245
|
});
|
|
246
246
|
}, function (n, p) {
|
|
247
247
|
return n.regions === p.regions && n.iw === p.iw && n.ih === p.ih;
|
|
248
248
|
});
|
|
249
|
-
export var
|
|
250
|
-
var
|
|
251
|
-
imagePosition = _ref20.imagePosition,
|
|
252
|
-
_ref20$regions = _ref20.regions,
|
|
253
|
-
regions = _ref20$regions === void 0 ? [] : _ref20$regions,
|
|
249
|
+
export var WrappedRegionListSid = memo(function (_ref20) {
|
|
250
|
+
var regions = _ref20.regions,
|
|
254
251
|
keypointDefinitions = _ref20.keypointDefinitions,
|
|
252
|
+
iw = _ref20.iw,
|
|
253
|
+
ih = _ref20.ih,
|
|
255
254
|
fullSegmentationMode = _ref20.fullSegmentationMode;
|
|
255
|
+
return regions.filter(function (r) {
|
|
256
|
+
return r.visible !== false;
|
|
257
|
+
}).map(function (r) {
|
|
258
|
+
return React.createElement(React.Fragment, null, React.createElement("div", {
|
|
259
|
+
style: {
|
|
260
|
+
color: '#800020',
|
|
261
|
+
position: 'absolute',
|
|
262
|
+
zIndex: 1000,
|
|
263
|
+
left: r.x * iw + 18,
|
|
264
|
+
top: r.y * ih + 18,
|
|
265
|
+
fontSize: '13px',
|
|
266
|
+
fontWeight: 500
|
|
267
|
+
},
|
|
268
|
+
className: "noselect"
|
|
269
|
+
}, (r === null || r === void 0 ? void 0 : r.sid) && "#".concat(r === null || r === void 0 ? void 0 : r.sid)));
|
|
270
|
+
});
|
|
271
|
+
}, function (n, p) {
|
|
272
|
+
return n.regions === p.regions && n.iw === p.iw && n.ih === p.ih;
|
|
273
|
+
});
|
|
274
|
+
export var RegionShapes = function RegionShapes(_ref21) {
|
|
275
|
+
var mat = _ref21.mat,
|
|
276
|
+
imagePosition = _ref21.imagePosition,
|
|
277
|
+
_ref21$regions = _ref21.regions,
|
|
278
|
+
regions = _ref21$regions === void 0 ? [] : _ref21$regions,
|
|
279
|
+
keypointDefinitions = _ref21.keypointDefinitions,
|
|
280
|
+
fullSegmentationMode = _ref21.fullSegmentationMode;
|
|
256
281
|
var iw = imagePosition.bottomRight.x - imagePosition.topLeft.x;
|
|
257
282
|
var ih = imagePosition.bottomRight.y - imagePosition.topLeft.y;
|
|
258
283
|
if (isNaN(iw) || isNaN(ih)) return null;
|
|
259
|
-
return React.createElement("svg", {
|
|
284
|
+
return React.createElement(React.Fragment, null, React.createElement("svg", {
|
|
260
285
|
width: iw,
|
|
261
286
|
height: ih,
|
|
262
287
|
style: {
|
|
@@ -275,6 +300,13 @@ export var RegionShapes = function RegionShapes(_ref20) {
|
|
|
275
300
|
ih: ih,
|
|
276
301
|
keypointDefinitions: keypointDefinitions,
|
|
277
302
|
fullSegmentationMode: fullSegmentationMode
|
|
303
|
+
})), React.createElement(WrappedRegionListSid, {
|
|
304
|
+
key: "wrapped-region-list-sid",
|
|
305
|
+
regions: regions,
|
|
306
|
+
iw: iw,
|
|
307
|
+
ih: ih,
|
|
308
|
+
keypointDefinitions: keypointDefinitions,
|
|
309
|
+
fullSegmentationMode: fullSegmentationMode
|
|
278
310
|
}));
|
|
279
311
|
};
|
|
280
312
|
export default RegionShapes;
|