react-image-annotate-master-custom 0.0.9 → 0.0.11
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.
- package/Annotator/index.js +1 -0
- package/Annotator/reducers/general-reducer.js +6 -0
- package/DemoSite/index.js +2 -2
- package/HighlightBox/index.js +4 -38
- package/MainLayout/index.js +17 -2
- package/package.json +1 -1
package/Annotator/index.js
CHANGED
|
@@ -112,6 +112,7 @@ export var Annotator = function Annotator(_ref) {
|
|
|
112
112
|
state = _useReducer2[0],
|
|
113
113
|
dispatchToReducer = _useReducer2[1];
|
|
114
114
|
|
|
115
|
+
console.log("🚀 ~ state:", state);
|
|
115
116
|
var dispatch = useEventCallback(function (action) {
|
|
116
117
|
if (action.type === "HEADER_BUTTON_CLICKED") {
|
|
117
118
|
if (["Exit", "Done", "Save", "Complete"].includes(action.buttonName)) {
|
|
@@ -262,6 +262,12 @@ export default (function (state, action) {
|
|
|
262
262
|
});
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
+
case "UNSELECTED_REGION":
|
|
266
|
+
{
|
|
267
|
+
state = unselectRegions(state);
|
|
268
|
+
return setIn(state, ["mode"], null);
|
|
269
|
+
}
|
|
270
|
+
|
|
265
271
|
case "ADD_POLYGON_POINT":
|
|
266
272
|
{
|
|
267
273
|
var _polygon = action.polygon,
|
package/DemoSite/index.js
CHANGED
|
@@ -27,11 +27,11 @@ export default (function () {
|
|
|
27
27
|
}, React.createElement("button", {
|
|
28
28
|
onClick: function onClick(e) {
|
|
29
29
|
e.stopPropagation();
|
|
30
|
-
var element = document.getElementById("
|
|
30
|
+
var element = document.getElementById("snag_canvas");
|
|
31
31
|
|
|
32
32
|
if (element) {
|
|
33
33
|
var clickEvent = document.createEvent("MouseEvents");
|
|
34
|
-
clickEvent.initEvent("
|
|
34
|
+
clickEvent.initEvent("mousedown", true, true);
|
|
35
35
|
element.dispatchEvent(clickEvent);
|
|
36
36
|
}
|
|
37
37
|
}
|
package/HighlightBox/index.js
CHANGED
|
@@ -98,24 +98,7 @@ export var HighlightBox = function HighlightBox(_ref) {
|
|
|
98
98
|
className: classnames(classes.highlightLight, {
|
|
99
99
|
highlighted: r.highlighted
|
|
100
100
|
})
|
|
101
|
-
}, mouseEvents,
|
|
102
|
-
onMouseDown: function onMouseDown(e) {
|
|
103
|
-
// if (
|
|
104
|
-
// !r.locked &&
|
|
105
|
-
// r.type === "point" &&
|
|
106
|
-
// r.highlighted &&
|
|
107
|
-
// e.button === 0
|
|
108
|
-
// ) {
|
|
109
|
-
// return onBeginMovePoint(r)
|
|
110
|
-
// }
|
|
111
|
-
if (e.button === 0 && !createWithPrimary) {
|
|
112
|
-
return onSelectRegion(r);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
onSelectRegion(r);
|
|
116
|
-
mouseEvents.onMouseDown(e);
|
|
117
|
-
}
|
|
118
|
-
} : {}, {
|
|
101
|
+
}, mouseEvents, {
|
|
119
102
|
style: _objectSpread({}, r.highlighted && {
|
|
120
103
|
pointerEvents: r.type !== "point" ? "none" : undefined
|
|
121
104
|
}, {
|
|
@@ -129,24 +112,7 @@ export var HighlightBox = function HighlightBox(_ref) {
|
|
|
129
112
|
className: classnames(classes.highlightLight, {
|
|
130
113
|
highlighted: r.highlighted
|
|
131
114
|
})
|
|
132
|
-
}, mouseEvents,
|
|
133
|
-
onMouseDown: function onMouseDown(e) {
|
|
134
|
-
// if (
|
|
135
|
-
// !r.locked &&
|
|
136
|
-
// r.type === "point" &&
|
|
137
|
-
// r.highlighted &&
|
|
138
|
-
// e.button === 0
|
|
139
|
-
// ) {
|
|
140
|
-
// return onBeginMovePoint(r)
|
|
141
|
-
// }
|
|
142
|
-
if (e.button === 0 && !createWithPrimary) {
|
|
143
|
-
return onSelectRegion(r);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
onSelectRegion(r);
|
|
147
|
-
mouseEvents.onMouseDown(e);
|
|
148
|
-
}
|
|
149
|
-
} : {}, {
|
|
115
|
+
}, mouseEvents, {
|
|
150
116
|
style: _objectSpread({}, r.highlighted && {
|
|
151
117
|
pointerEvents: r.type !== "point" ? "none" : undefined
|
|
152
118
|
}, {
|
|
@@ -155,8 +121,8 @@ export var HighlightBox = function HighlightBox(_ref) {
|
|
|
155
121
|
}), React.createElement("path", {
|
|
156
122
|
d: pathDVertical
|
|
157
123
|
})), React.createElement("svg", Object.assign({
|
|
158
|
-
key: "".concat(r.id
|
|
159
|
-
id: "".concat(r.id
|
|
124
|
+
key: "".concat(r.id),
|
|
125
|
+
id: "".concat(r.id),
|
|
160
126
|
className: classnames(classes.highlightLight, {
|
|
161
127
|
highlighted: r.highlighted
|
|
162
128
|
})
|
package/MainLayout/index.js
CHANGED
|
@@ -147,7 +147,11 @@ export var MainLayout = function MainLayout(_ref3) {
|
|
|
147
147
|
e.target.focus();
|
|
148
148
|
}
|
|
149
149
|
}, []);
|
|
150
|
-
var canvas = React.createElement(ImageCanvas, Object.assign({
|
|
150
|
+
var canvas = React.createElement(ImageCanvas, Object.assign({
|
|
151
|
+
onClick: function onClick() {
|
|
152
|
+
return console.log("3333");
|
|
153
|
+
}
|
|
154
|
+
}, settings, {
|
|
151
155
|
showCrosshairs: settings.showCrosshairs && !["select", "pan", "zoom"].includes(state.selectedTool),
|
|
152
156
|
key: state.selectedImage,
|
|
153
157
|
showMask: state.showMask,
|
|
@@ -193,10 +197,14 @@ export var MainLayout = function MainLayout(_ref3) {
|
|
|
193
197
|
allowComments: state.allowComments
|
|
194
198
|
}));
|
|
195
199
|
var onClickIconSidebarItem = useEventCallback(function (item) {
|
|
200
|
+
console.log(1111);
|
|
196
201
|
dispatch({
|
|
197
202
|
type: "SELECT_TOOL",
|
|
198
203
|
selectedTool: item.name
|
|
199
204
|
});
|
|
205
|
+
dispatch({
|
|
206
|
+
type: "UNSELECTED_REGION"
|
|
207
|
+
});
|
|
200
208
|
});
|
|
201
209
|
var onClickHeaderItem = useEventCallback(function (item) {
|
|
202
210
|
if (item.name === "Fullscreen") {
|
|
@@ -346,7 +354,14 @@ export var MainLayout = function MainLayout(_ref3) {
|
|
|
346
354
|
history: state.history,
|
|
347
355
|
onRestoreHistory: action("RESTORE_HISTORY")
|
|
348
356
|
})].filter(Boolean)
|
|
349
|
-
},
|
|
357
|
+
}, React.createElement("div", {
|
|
358
|
+
id: "snag_canvas",
|
|
359
|
+
onMouseDown: function onMouseDown() {
|
|
360
|
+
return dispatch({
|
|
361
|
+
type: "UNSELECTED_REGION"
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
}), canvas), React.createElement(SettingsDialog, {
|
|
350
365
|
open: state.settingsOpen,
|
|
351
366
|
onClose: function onClose() {
|
|
352
367
|
return dispatch({
|