react-image-annotate-master-custom 0.0.3 → 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
|
@@ -18,7 +18,7 @@ var useStyles = makeStyles(function (theme) {
|
|
|
18
18
|
zIndex: 2,
|
|
19
19
|
transition: "opacity 500ms",
|
|
20
20
|
"&.highlighted": {
|
|
21
|
-
zIndex:
|
|
21
|
+
zIndex: 2,
|
|
22
22
|
filter: "invert(40%) sepia(50%) saturate(1928%) hue-rotate(350deg) brightness(94%) contrast(89%)" //customize
|
|
23
23
|
|
|
24
24
|
},
|
|
@@ -69,8 +69,8 @@ export var HighlightBox = function HighlightBox(_ref) {
|
|
|
69
69
|
};
|
|
70
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");
|
|
71
71
|
var styleCoordsHorizontal = r.type === "point" ? {
|
|
72
|
-
top: pbox.y + pbox.h
|
|
73
|
-
width:
|
|
72
|
+
top: pbox.y + pbox.h / 2,
|
|
73
|
+
width: 60000,
|
|
74
74
|
height: 3
|
|
75
75
|
} : {
|
|
76
76
|
left: pbox.x - 5,
|
|
@@ -79,78 +79,27 @@ export var HighlightBox = function HighlightBox(_ref) {
|
|
|
79
79
|
height: pbox.h + 10
|
|
80
80
|
};
|
|
81
81
|
var styleCoordsVertical = r.type === "point" ? {
|
|
82
|
-
left: pbox.x + pbox.w
|
|
83
|
-
width:
|
|
84
|
-
height:
|
|
82
|
+
left: pbox.x + pbox.w / 2,
|
|
83
|
+
width: 2,
|
|
84
|
+
height: 60000
|
|
85
85
|
} : {
|
|
86
86
|
left: pbox.x - 5,
|
|
87
87
|
top: pbox.y - 5,
|
|
88
88
|
width: pbox.w + 10,
|
|
89
89
|
height: pbox.h + 10
|
|
90
90
|
};
|
|
91
|
-
var pathDHorizontal = r.type === "point" ? "M1,2 H".concat(styleCoordsHorizontal.width
|
|
92
|
-
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");
|
|
93
93
|
return React.createElement(ThemeProvider, {
|
|
94
94
|
theme: theme
|
|
95
95
|
}, React.createElement("svg", Object.assign({
|
|
96
|
-
key: "".concat(r.id, "-box"),
|
|
97
|
-
id: "".concat(r.id, "-box"),
|
|
98
|
-
className: classnames(classes.highlightLight, {
|
|
99
|
-
highlighted: r.highlighted
|
|
100
|
-
})
|
|
101
|
-
}, mouseEvents, !zoomWithPrimary && !dragWithPrimary ? {
|
|
102
|
-
onMouseDown: function onMouseDown(e) {
|
|
103
|
-
if (!r.locked && r.type === "point" && r.highlighted && e.button === 0) {
|
|
104
|
-
return onBeginMovePoint(r);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (e.button === 0 && !createWithPrimary) {
|
|
108
|
-
return onSelectRegion(r);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
onSelectRegion(r); //mouseEvents.onMouseDown(e)
|
|
112
|
-
}
|
|
113
|
-
} : {}, {
|
|
114
|
-
style: _objectSpread({}, r.highlighted ? {
|
|
115
|
-
pointerEvents: r.type !== "point" ? "none" : undefined,
|
|
116
|
-
cursor: "grab"
|
|
117
|
-
} : {
|
|
118
|
-
cursor: !(zoomWithPrimary || dragWithPrimary || createWithPrimary) ? "pointer" : undefined,
|
|
119
|
-
pointerEvents: zoomWithPrimary || dragWithPrimary || createWithPrimary && !r.highlighted ? "none" : undefined
|
|
120
|
-
}, {
|
|
121
|
-
position: "absolute"
|
|
122
|
-
}, styleCoords)
|
|
123
|
-
}), React.createElement("path", {
|
|
124
|
-
d: pathD,
|
|
125
|
-
style: {
|
|
126
|
-
strokeDasharray: 5
|
|
127
|
-
}
|
|
128
|
-
})), React.createElement("svg", Object.assign({
|
|
129
96
|
key: "".concat(r.id, "-horizontal"),
|
|
130
97
|
id: "".concat(r.id, "-horizontal"),
|
|
131
98
|
className: classnames(classes.highlightLight, {
|
|
132
99
|
highlighted: r.highlighted
|
|
133
100
|
})
|
|
134
|
-
}, mouseEvents,
|
|
135
|
-
|
|
136
|
-
if (!r.locked && r.type === "point" && r.highlighted && e.button === 0) {
|
|
137
|
-
return onBeginMovePoint(r);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (e.button === 0 && !createWithPrimary) {
|
|
141
|
-
return onSelectRegion(r);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
onSelectRegion(r); //mouseEvents.onMouseDown(e)
|
|
145
|
-
}
|
|
146
|
-
} : {}, {
|
|
147
|
-
style: _objectSpread({}, r.highlighted ? {
|
|
148
|
-
pointerEvents: r.type !== "point" ? "none" : undefined,
|
|
149
|
-
cursor: "grab"
|
|
150
|
-
} : {
|
|
151
|
-
cursor: !(zoomWithPrimary || dragWithPrimary || createWithPrimary) ? "pointer" : undefined,
|
|
152
|
-
pointerEvents: zoomWithPrimary || dragWithPrimary || createWithPrimary && !r.highlighted ? "none" : undefined
|
|
153
|
-
}, {
|
|
101
|
+
}, mouseEvents, {
|
|
102
|
+
style: _objectSpread({
|
|
154
103
|
position: "absolute"
|
|
155
104
|
}, styleCoordsHorizontal)
|
|
156
105
|
}), React.createElement("path", {
|
|
@@ -161,6 +110,18 @@ export var HighlightBox = function HighlightBox(_ref) {
|
|
|
161
110
|
className: classnames(classes.highlightLight, {
|
|
162
111
|
highlighted: r.highlighted
|
|
163
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"),
|
|
122
|
+
className: classnames(classes.highlightLight, {
|
|
123
|
+
highlighted: r.highlighted
|
|
124
|
+
})
|
|
164
125
|
}, mouseEvents, !zoomWithPrimary && !dragWithPrimary ? {
|
|
165
126
|
onMouseDown: function onMouseDown(e) {
|
|
166
127
|
if (!r.locked && r.type === "point" && r.highlighted && e.button === 0) {
|
|
@@ -171,20 +132,24 @@ export var HighlightBox = function HighlightBox(_ref) {
|
|
|
171
132
|
return onSelectRegion(r);
|
|
172
133
|
}
|
|
173
134
|
|
|
174
|
-
onSelectRegion(r);
|
|
135
|
+
onSelectRegion(r);
|
|
136
|
+
mouseEvents.onMouseDown(e);
|
|
175
137
|
}
|
|
176
138
|
} : {}, {
|
|
177
139
|
style: _objectSpread({}, r.highlighted ? {
|
|
178
140
|
pointerEvents: r.type !== "point" ? "none" : undefined,
|
|
179
|
-
cursor: "grab"
|
|
141
|
+
cursor: !r.locked && "grab"
|
|
180
142
|
} : {
|
|
181
143
|
cursor: !(zoomWithPrimary || dragWithPrimary || createWithPrimary) ? "pointer" : undefined,
|
|
182
144
|
pointerEvents: zoomWithPrimary || dragWithPrimary || createWithPrimary && !r.highlighted ? "none" : undefined
|
|
183
145
|
}, {
|
|
184
146
|
position: "absolute"
|
|
185
|
-
},
|
|
147
|
+
}, styleCoords)
|
|
186
148
|
}), React.createElement("path", {
|
|
187
|
-
d:
|
|
149
|
+
d: pathD,
|
|
150
|
+
style: {
|
|
151
|
+
strokeDasharray: 5
|
|
152
|
+
}
|
|
188
153
|
})));
|
|
189
154
|
};
|
|
190
155
|
export default HighlightBox;
|