react-image-annotate-master-custom 0.0.4 → 0.0.8

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.
@@ -769,11 +769,8 @@ export default (function (state, action) {
769
769
  if (((_getIn$regions = getIn(state, pathToActiveImage).regions) === null || _getIn$regions === void 0 ? void 0 : _getIn$regions.length) > 0 && ((_getIn$regions2 = getIn(state, pathToActiveImage).regions[getIn(state, pathToActiveImage).regions.length - 1]) === null || _getIn$regions2 === void 0 ? void 0 : _getIn$regions2.isNew)) {
770
770
  var _regions = _toConsumableArray(getIn(state, pathToActiveImage).regions || []);
771
771
 
772
- console.log(state, "state");
773
- console.log(getIn(state, pathToActiveImage), "pathToActiveImage");
774
772
  return setIn(state, [].concat(_toConsumableArray(pathToActiveImage), ["regions"]), _regions);
775
773
  } else {
776
- console.log(3333333333333);
777
774
  state.onCreateAnno(newRegion); // customize
778
775
 
779
776
  var _regions2 = _toConsumableArray(getIn(state, pathToActiveImage).regions || []).map(function (r) {
package/DemoSite/index.js CHANGED
@@ -37,12 +37,8 @@ export default (function () {
37
37
  }
38
38
  }, "click"), React.createElement(Annotator //customize
39
39
  , Object.assign({}, annotatorProps, {
40
- onCreateAnno: function onCreateAnno(anno) {
41
- console.log("Annotator created: ", anno);
42
- },
43
- onClickAnno: function onClickAnno(anno) {
44
- console.log("Annotator click: ", anno);
45
- },
40
+ onCreateAnno: function onCreateAnno(anno) {},
41
+ onClickAnno: function onClickAnno(anno) {},
46
42
  onExit: function onExit(output) {
47
43
  var checkOutside = false;
48
44
  output.images[0].regions.forEach(function (r) {
@@ -56,8 +52,6 @@ export default (function () {
56
52
  } else {
57
53
  changeLastOutput(output.images[0].regions);
58
54
  }
59
-
60
- console.log(output.images[0].regions);
61
55
  }
62
56
  }))) : React.createElement(Editor, {
63
57
  lastOutput: lastOutput,
@@ -3,7 +3,6 @@ import React from "react";
3
3
  import classnames from "classnames";
4
4
  import { makeStyles } from "@mui/styles";
5
5
  import { createTheme, ThemeProvider } from "@mui/material/styles";
6
- import zIndex from "@mui/material/styles/zIndex";
7
6
  var theme = createTheme();
8
7
  var useStyles = makeStyles(function (theme) {
9
8
  return {
@@ -19,7 +18,7 @@ var useStyles = makeStyles(function (theme) {
19
18
  zIndex: 2,
20
19
  transition: "opacity 500ms",
21
20
  "&.highlighted": {
22
- zIndex: 1,
21
+ zIndex: 2,
23
22
  filter: "invert(40%) sepia(50%) saturate(1928%) hue-rotate(350deg) brightness(94%) contrast(89%)" //customize
24
23
 
25
24
  },
@@ -70,10 +69,9 @@ export var HighlightBox = function HighlightBox(_ref) {
70
69
  };
71
70
  var pathD = r.type === "point" ? "M5,5 L".concat(styleCoords.width - 5, " 5L").concat(styleCoords.width - 5, " ").concat(styleCoords.height - 5, "L5 ").concat(styleCoords.height - 5, "Z") : "M5,5 L".concat(pbox.w + 5, ",5 L").concat(pbox.w + 5, ",").concat(pbox.h + 5, " L5,").concat(pbox.h + 5, " Z");
72
71
  var styleCoordsHorizontal = r.type === "point" ? {
73
- top: pbox.y + pbox.h - 12,
74
- width: 600000000,
75
- height: 2,
76
- zIndex: 1
72
+ top: pbox.y + pbox.h / 2,
73
+ width: 60000,
74
+ height: 3
77
75
  } : {
78
76
  left: pbox.x - 5,
79
77
  top: pbox.y - 5,
@@ -81,23 +79,50 @@ export var HighlightBox = function HighlightBox(_ref) {
81
79
  height: pbox.h + 10
82
80
  };
83
81
  var styleCoordsVertical = r.type === "point" ? {
84
- left: pbox.x + pbox.w - 15,
82
+ left: pbox.x + pbox.w / 2,
85
83
  width: 2,
86
- height: 60000000,
87
- zIndex: 1
84
+ height: 60000
88
85
  } : {
89
86
  left: pbox.x - 5,
90
87
  top: pbox.y - 5,
91
88
  width: pbox.w + 10,
92
89
  height: pbox.h + 10
93
90
  };
94
- var pathDHorizontal = r.type === "point" ? "M1,2 H".concat(styleCoordsHorizontal.width - 5, " Z") : "M5,5 L".concat(pbox.w + 5, ",5 L").concat(pbox.w + 5, ",").concat(pbox.h + 5, " L5,").concat(pbox.h + 5, " Z");
95
- var pathDVertical = r.type === "point" ? "M1,1 V".concat(styleCoordsVertical.height - 5, " Z") : "M5,5 L".concat(pbox.w + 5, ",5 L").concat(pbox.w + 5, ",").concat(pbox.h + 5, " L5,").concat(pbox.h + 5, " Z");
91
+ var pathDHorizontal = r.type === "point" ? "M1,2 H".concat(styleCoordsHorizontal.width, " Z") : "M5,5 L".concat(pbox.w + 5, ",5 L").concat(pbox.w + 5, ",").concat(pbox.h + 5, " L5,").concat(pbox.h + 5, " Z");
92
+ var pathDVertical = r.type === "point" ? "M1,1 V".concat(styleCoordsVertical.height, " Z") : "M5,5 L".concat(pbox.w + 5, ",5 L").concat(pbox.w + 5, ",").concat(pbox.h + 5, " L5,").concat(pbox.h + 5, " Z");
96
93
  return React.createElement(ThemeProvider, {
97
94
  theme: theme
98
95
  }, React.createElement("svg", Object.assign({
99
- key: "".concat(r.id),
100
- id: "".concat(r.id),
96
+ key: "".concat(r.id, "-horizontal"),
97
+ id: "".concat(r.id, "-horizontal"),
98
+ className: classnames(classes.highlightLight, {
99
+ highlighted: r.highlighted
100
+ })
101
+ }, mouseEvents, {
102
+ style: _objectSpread({}, r.highlighted && {
103
+ pointerEvents: r.type !== "point" ? "none" : undefined
104
+ }, {
105
+ position: "absolute"
106
+ }, styleCoordsHorizontal)
107
+ }), React.createElement("path", {
108
+ d: pathDHorizontal
109
+ })), React.createElement("svg", Object.assign({
110
+ key: "".concat(r.id, "-vertical"),
111
+ id: "".concat(r.id, "-vertical"),
112
+ className: classnames(classes.highlightLight, {
113
+ highlighted: r.highlighted
114
+ })
115
+ }, mouseEvents, {
116
+ style: _objectSpread({}, r.highlighted && {
117
+ pointerEvents: r.type !== "point" ? "none" : undefined
118
+ }, {
119
+ position: "absolute"
120
+ }, styleCoordsVertical)
121
+ }), React.createElement("path", {
122
+ d: pathDVertical
123
+ })), React.createElement("svg", Object.assign({
124
+ key: "".concat(r.id, "-box"),
125
+ id: "".concat(r.id, "-box"),
101
126
  className: classnames(classes.highlightLight, {
102
127
  highlighted: r.highlighted
103
128
  })
@@ -111,12 +136,13 @@ export var HighlightBox = function HighlightBox(_ref) {
111
136
  return onSelectRegion(r);
112
137
  }
113
138
 
114
- onSelectRegion(r); //mouseEvents.onMouseDown(e)
139
+ onSelectRegion(r);
140
+ mouseEvents.onMouseDown(e);
115
141
  }
116
142
  } : {}, {
117
143
  style: _objectSpread({}, r.highlighted ? {
118
144
  pointerEvents: r.type !== "point" ? "none" : undefined,
119
- cursor: "grab"
145
+ cursor: !r.locked && "grab"
120
146
  } : {
121
147
  cursor: !(zoomWithPrimary || dragWithPrimary || createWithPrimary) ? "pointer" : undefined,
122
148
  pointerEvents: zoomWithPrimary || dragWithPrimary || createWithPrimary && !r.highlighted ? "none" : undefined
@@ -128,28 +154,6 @@ export var HighlightBox = function HighlightBox(_ref) {
128
154
  style: {
129
155
  strokeDasharray: 5
130
156
  }
131
- })), React.createElement("svg", {
132
- key: "".concat(r.id, "-horizontal"),
133
- id: "".concat(r.id, "-horizontal"),
134
- className: classnames(classes.highlightLight, {
135
- highlighted: r.highlighted
136
- }),
137
- style: _objectSpread({
138
- position: "absolute"
139
- }, styleCoordsHorizontal)
140
- }, React.createElement("path", {
141
- d: pathDHorizontal
142
- })), React.createElement("svg", {
143
- key: "".concat(r.id, "-vertical"),
144
- id: "".concat(r.id, "-vertical"),
145
- className: classnames(classes.highlightLight, {
146
- highlighted: r.highlighted
147
- }),
148
- style: _objectSpread({
149
- position: "absolute"
150
- }, styleCoordsVertical)
151
- }, React.createElement("path", {
152
- d: pathDVertical
153
157
  })));
154
158
  };
155
159
  export default HighlightBox;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-image-annotate-master-custom",
3
- "version": "0.0.4",
3
+ "version": "0.0.8",
4
4
  "dependencies": {
5
5
  "@fortawesome/fontawesome-svg-core": "^1.2.12",
6
6
  "@fortawesome/free-solid-svg-icons": "^5.6.3",