react-image-annotate-master-custom 0.0.14 → 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.
@@ -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,
@@ -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
@@ -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,14 +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
- }));
27
+ })));
23
28
  }),
24
29
  line: memo(function (_ref2) {
25
30
  var region = _ref2.region,
@@ -229,29 +234,54 @@ export var WrappedRegionList = memo(function (_ref19) {
229
234
  return r.visible !== false;
230
235
  }).map(function (r) {
231
236
  var Component = RegionComponents[r.type];
232
- return React.createElement(Component, {
237
+ return React.createElement(React.Fragment, null, React.createElement(Component, {
233
238
  key: r.regionId,
234
239
  region: r,
235
240
  iw: iw,
236
241
  ih: ih,
237
242
  keypointDefinitions: keypointDefinitions,
238
243
  fullSegmentationMode: fullSegmentationMode
239
- });
244
+ }));
240
245
  });
241
246
  }, function (n, p) {
242
247
  return n.regions === p.regions && n.iw === p.iw && n.ih === p.ih;
243
248
  });
244
- export var RegionShapes = function RegionShapes(_ref20) {
245
- var mat = _ref20.mat,
246
- imagePosition = _ref20.imagePosition,
247
- _ref20$regions = _ref20.regions,
248
- regions = _ref20$regions === void 0 ? [] : _ref20$regions,
249
+ export var WrappedRegionListSid = memo(function (_ref20) {
250
+ var regions = _ref20.regions,
249
251
  keypointDefinitions = _ref20.keypointDefinitions,
252
+ iw = _ref20.iw,
253
+ ih = _ref20.ih,
250
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;
251
281
  var iw = imagePosition.bottomRight.x - imagePosition.topLeft.x;
252
282
  var ih = imagePosition.bottomRight.y - imagePosition.topLeft.y;
253
283
  if (isNaN(iw) || isNaN(ih)) return null;
254
- return React.createElement("svg", {
284
+ return React.createElement(React.Fragment, null, React.createElement("svg", {
255
285
  width: iw,
256
286
  height: ih,
257
287
  style: {
@@ -270,6 +300,13 @@ export var RegionShapes = function RegionShapes(_ref20) {
270
300
  ih: ih,
271
301
  keypointDefinitions: keypointDefinitions,
272
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
273
310
  }));
274
311
  };
275
312
  export default RegionShapes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-image-annotate-master-custom",
3
- "version": "0.0.14",
3
+ "version": "0.0.18",
4
4
  "dependencies": {
5
5
  "@fortawesome/fontawesome-svg-core": "^1.2.12",
6
6
  "@fortawesome/free-solid-svg-icons": "^5.6.3",