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

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,21 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread";
1
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
3
  import React, { memo } from "react";
3
4
  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
+ };
4
19
 
5
20
  function clamp(num, min, max) {
6
21
  return num <= min ? min : num >= max ? max : num;
@@ -12,19 +27,18 @@ var RegionComponents = {
12
27
  var region = _ref.region,
13
28
  iw = _ref.iw,
14
29
  ih = _ref.ih;
15
- return React.createElement("g", {
30
+ return React.createElement(React.Fragment, null, React.createElement("g", {
16
31
  transform: "translate(".concat(region.x * iw, " ").concat(region.y * ih, ")")
17
32
  }, React.createElement("path", {
18
33
  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",
34
+ style: {
35
+ position: "absolute",
36
+ zIndex: -1
37
+ },
19
38
  strokeWidth: 2,
20
39
  stroke: "#E45B21",
21
40
  fill: "#E45B21"
22
- }), React.createElement("text", {
23
- x: "15",
24
- y: "15",
25
- fill: "red",
26
- fontSize: "12"
27
- }, region === null || region === void 0 ? void 0 : region.sid));
41
+ })));
28
42
  }),
29
43
  line: memo(function (_ref2) {
30
44
  var region = _ref2.region,
@@ -234,29 +248,53 @@ export var WrappedRegionList = memo(function (_ref19) {
234
248
  return r.visible !== false;
235
249
  }).map(function (r) {
236
250
  var Component = RegionComponents[r.type];
237
- return React.createElement(Component, {
251
+ return React.createElement(React.Fragment, null, React.createElement(Component, {
238
252
  key: r.regionId,
239
253
  region: r,
240
254
  iw: iw,
241
255
  ih: ih,
242
256
  keypointDefinitions: keypointDefinitions,
243
257
  fullSegmentationMode: fullSegmentationMode
244
- });
258
+ }));
245
259
  });
246
260
  }, function (n, p) {
247
261
  return n.regions === p.regions && n.iw === p.iw && n.ih === p.ih;
248
262
  });
249
- export var RegionShapes = function RegionShapes(_ref20) {
250
- var mat = _ref20.mat,
251
- imagePosition = _ref20.imagePosition,
252
- _ref20$regions = _ref20.regions,
253
- regions = _ref20$regions === void 0 ? [] : _ref20$regions,
263
+ export var WrappedRegionListSid = memo(function (_ref20) {
264
+ var regions = _ref20.regions,
254
265
  keypointDefinitions = _ref20.keypointDefinitions,
266
+ iw = _ref20.iw,
267
+ ih = _ref20.ih,
255
268
  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;
256
294
  var iw = imagePosition.bottomRight.x - imagePosition.topLeft.x;
257
295
  var ih = imagePosition.bottomRight.y - imagePosition.topLeft.y;
258
296
  if (isNaN(iw) || isNaN(ih)) return null;
259
- return React.createElement("svg", {
297
+ return React.createElement(React.Fragment, null, React.createElement("svg", {
260
298
  width: iw,
261
299
  height: ih,
262
300
  style: {
@@ -275,6 +313,13 @@ export var RegionShapes = function RegionShapes(_ref20) {
275
313
  ih: ih,
276
314
  keypointDefinitions: keypointDefinitions,
277
315
  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
278
323
  }));
279
324
  };
280
325
  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.16",
3
+ "version": "0.0.20",
4
4
  "dependencies": {
5
5
  "@fortawesome/fontawesome-svg-core": "^1.2.12",
6
6
  "@fortawesome/free-solid-svg-icons": "^5.6.3",