react-image-annotate-master-custom 0.0.4 → 0.0.6
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
|
-
|
|
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,
|
package/HighlightBox/index.js
CHANGED
|
@@ -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:
|
|
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
|
|
74
|
-
width:
|
|
75
|
-
height:
|
|
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,46 @@ 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
|
|
82
|
+
left: pbox.x + pbox.w / 2,
|
|
85
83
|
width: 2,
|
|
86
|
-
height:
|
|
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
|
|
95
|
-
var pathDVertical = r.type === "point" ? "M1,1 V".concat(styleCoordsVertical.height
|
|
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({
|
|
103
|
+
position: "absolute"
|
|
104
|
+
}, styleCoordsHorizontal)
|
|
105
|
+
}), React.createElement("path", {
|
|
106
|
+
d: pathDHorizontal
|
|
107
|
+
})), React.createElement("svg", Object.assign({
|
|
108
|
+
key: "".concat(r.id, "-vertical"),
|
|
109
|
+
id: "".concat(r.id, "-vertical"),
|
|
110
|
+
className: classnames(classes.highlightLight, {
|
|
111
|
+
highlighted: r.highlighted
|
|
112
|
+
})
|
|
113
|
+
}, mouseEvents, {
|
|
114
|
+
style: _objectSpread({
|
|
115
|
+
position: "absolute"
|
|
116
|
+
}, styleCoordsVertical)
|
|
117
|
+
}), React.createElement("path", {
|
|
118
|
+
d: pathDVertical
|
|
119
|
+
})), React.createElement("svg", Object.assign({
|
|
120
|
+
key: "".concat(r.id, "-box"),
|
|
121
|
+
id: "".concat(r.id, "-box"),
|
|
101
122
|
className: classnames(classes.highlightLight, {
|
|
102
123
|
highlighted: r.highlighted
|
|
103
124
|
})
|
|
@@ -111,12 +132,13 @@ export var HighlightBox = function HighlightBox(_ref) {
|
|
|
111
132
|
return onSelectRegion(r);
|
|
112
133
|
}
|
|
113
134
|
|
|
114
|
-
onSelectRegion(r);
|
|
135
|
+
onSelectRegion(r);
|
|
136
|
+
mouseEvents.onMouseDown(e);
|
|
115
137
|
}
|
|
116
138
|
} : {}, {
|
|
117
139
|
style: _objectSpread({}, r.highlighted ? {
|
|
118
140
|
pointerEvents: r.type !== "point" ? "none" : undefined,
|
|
119
|
-
cursor: "grab"
|
|
141
|
+
cursor: !r.locked && "grab"
|
|
120
142
|
} : {
|
|
121
143
|
cursor: !(zoomWithPrimary || dragWithPrimary || createWithPrimary) ? "pointer" : undefined,
|
|
122
144
|
pointerEvents: zoomWithPrimary || dragWithPrimary || createWithPrimary && !r.highlighted ? "none" : undefined
|
|
@@ -128,28 +150,6 @@ export var HighlightBox = function HighlightBox(_ref) {
|
|
|
128
150
|
style: {
|
|
129
151
|
strokeDasharray: 5
|
|
130
152
|
}
|
|
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
153
|
})));
|
|
154
154
|
};
|
|
155
155
|
export default HighlightBox;
|