react-image-annotate-master-custom 0.0.1
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 +164 -0
- package/Annotator/reducers/combine-reducers.js +14 -0
- package/Annotator/reducers/convert-expanding-line-to-polygon.js +73 -0
- package/Annotator/reducers/fix-twisted.js +4 -0
- package/Annotator/reducers/general-reducer.js +1073 -0
- package/Annotator/reducers/get-active-image.js +27 -0
- package/Annotator/reducers/get-implied-video-regions.js +180 -0
- package/Annotator/reducers/history-handler.js +38 -0
- package/Annotator/reducers/image-reducer.js +20 -0
- package/Annotator/reducers/video-reducer.js +88 -0
- package/ClassSelectionMenu/index.js +135 -0
- package/Crosshairs/index.js +53 -0
- package/DebugSidebarBox/index.js +20 -0
- package/DemoSite/Editor.js +194 -0
- package/DemoSite/ErrorBoundaryDialog.js +64 -0
- package/DemoSite/index.js +69 -0
- package/FullImageSegmentationAnnotator/index.js +7 -0
- package/HighlightBox/index.js +105 -0
- package/HistorySidebarBox/index.js +71 -0
- package/ImageCanvas/index.js +428 -0
- package/ImageCanvas/region-tools.js +165 -0
- package/ImageCanvas/styles.js +31 -0
- package/ImageCanvas/use-mouse.js +180 -0
- package/ImageCanvas/use-project-box.js +27 -0
- package/ImageCanvas/use-wasd-mode.js +62 -0
- package/ImageMask/index.js +133 -0
- package/ImageMask/load-image.js +25 -0
- package/ImageSelectorSidebarBox/index.js +60 -0
- package/KeyframeTimeline/get-time-string.js +27 -0
- package/KeyframeTimeline/index.js +233 -0
- package/KeyframesSelectorSidebarBox/index.js +93 -0
- package/LandingPage/index.js +159 -0
- package/MainLayout/icon-dictionary.js +104 -0
- package/MainLayout/index.js +359 -0
- package/MainLayout/styles.js +25 -0
- package/MainLayout/types.js +0 -0
- package/MainLayout/use-implied-video-regions.js +13 -0
- package/PointDistances/index.js +73 -0
- package/PreventScrollToParents/index.js +51 -0
- package/README.md +101 -0
- package/RegionLabel/index.js +197 -0
- package/RegionLabel/styles.js +48 -0
- package/RegionSelectAndTransformBoxes/index.js +166 -0
- package/RegionSelectorSidebarBox/index.js +248 -0
- package/RegionSelectorSidebarBox/styles.js +53 -0
- package/RegionShapes/index.js +275 -0
- package/RegionTags/index.js +138 -0
- package/SettingsDialog/index.js +52 -0
- package/SettingsProvider/index.js +53 -0
- package/Shortcuts/ShortcutField.js +46 -0
- package/Shortcuts/index.js +133 -0
- package/ShortcutsManager/index.js +155 -0
- package/Sidebar/index.js +69 -0
- package/SidebarBoxContainer/index.js +93 -0
- package/SmallToolButton/index.js +42 -0
- package/TagsSidebarBox/index.js +105 -0
- package/TaskDescriptionSidebarBox/index.js +58 -0
- package/Theme/index.js +30 -0
- package/VideoOrImageCanvasBackground/index.js +151 -0
- package/colors.js +14 -0
- package/hooks/use-event-callback.js +10 -0
- package/hooks/use-exclude-pattern.js +24 -0
- package/hooks/use-load-image.js +26 -0
- package/hooks/use-window-size.js +46 -0
- package/hooks/xpattern.js +1 -0
- package/index.js +3 -0
- package/lib.js +3 -0
- package/package.json +91 -0
- package/stories.js +5 -0
- package/utils/get-from-local-storage.js +7 -0
- package/utils/get-hotkey-help-text.js +9 -0
- package/utils/get-landmarks-with-transform.js +40 -0
- package/utils/set-in-local-storage.js +3 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import React, { useMemo, useState, useEffect } from "react";
|
|
4
|
+
import { styled } from "@mui/material/styles";
|
|
5
|
+
import { createTheme, ThemeProvider } from "@mui/material/styles";
|
|
6
|
+
import range from "lodash/range";
|
|
7
|
+
import * as colors from "@mui/material/colors";
|
|
8
|
+
import useMeasure from "react-use-measure";
|
|
9
|
+
import useEventCallback from "use-event-callback";
|
|
10
|
+
import { useRafState } from "react-use";
|
|
11
|
+
import getTimeString from "./get-time-string";
|
|
12
|
+
var theme = createTheme();
|
|
13
|
+
var Container = styled("div")(function (_ref) {
|
|
14
|
+
var theme = _ref.theme;
|
|
15
|
+
return {
|
|
16
|
+
position: "relative",
|
|
17
|
+
display: "flex",
|
|
18
|
+
flexGrow: 1,
|
|
19
|
+
minWidth: 240,
|
|
20
|
+
height: 64,
|
|
21
|
+
marginLeft: 16,
|
|
22
|
+
marginRight: 16
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
var Tick = styled("div")(function (_ref2) {
|
|
26
|
+
var theme = _ref2.theme;
|
|
27
|
+
return {
|
|
28
|
+
position: "absolute",
|
|
29
|
+
width: 2,
|
|
30
|
+
marginLeft: -1,
|
|
31
|
+
height: "100%",
|
|
32
|
+
backgroundColor: colors.grey[300],
|
|
33
|
+
bottom: 0
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
var TickText = styled("div")(function (_ref3) {
|
|
37
|
+
var theme = _ref3.theme;
|
|
38
|
+
return {
|
|
39
|
+
position: "absolute",
|
|
40
|
+
userSelect: "none",
|
|
41
|
+
fontSize: 10,
|
|
42
|
+
color: colors.grey[600],
|
|
43
|
+
fontWeight: "bold",
|
|
44
|
+
bottom: 0
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
var PositionCursor = styled("div")(function (_ref4) {
|
|
48
|
+
var theme = _ref4.theme;
|
|
49
|
+
return {
|
|
50
|
+
position: "absolute",
|
|
51
|
+
bottom: "calc(50% + 6px)",
|
|
52
|
+
fontSize: 10,
|
|
53
|
+
fontWeight: "bold",
|
|
54
|
+
color: "#fff",
|
|
55
|
+
display: "grid",
|
|
56
|
+
placeItems: "center",
|
|
57
|
+
width: 48,
|
|
58
|
+
marginLeft: -24,
|
|
59
|
+
borderRadius: 2,
|
|
60
|
+
height: 24,
|
|
61
|
+
backgroundColor: colors.blue[500],
|
|
62
|
+
userSelect: "none",
|
|
63
|
+
fontVariantNumeric: "tabular-nums",
|
|
64
|
+
"&::before": {
|
|
65
|
+
position: "absolute",
|
|
66
|
+
bottom: -6,
|
|
67
|
+
left: 24 - 8,
|
|
68
|
+
content: '""',
|
|
69
|
+
width: 0,
|
|
70
|
+
height: 0,
|
|
71
|
+
borderTop: "8px solid ".concat(colors.blue[500]),
|
|
72
|
+
borderLeft: "8px solid transparent",
|
|
73
|
+
borderRight: "8px solid transparent"
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
var KeyframeMarker = styled("div")(function (_ref5) {
|
|
78
|
+
var _ref6;
|
|
79
|
+
|
|
80
|
+
var theme = _ref5.theme;
|
|
81
|
+
return _ref6 = {
|
|
82
|
+
position: "absolute",
|
|
83
|
+
bottom: 8,
|
|
84
|
+
cursor: "pointer",
|
|
85
|
+
opacity: 0.75,
|
|
86
|
+
fontSize: 10,
|
|
87
|
+
fontWeight: "bold",
|
|
88
|
+
color: "#fff",
|
|
89
|
+
display: "grid",
|
|
90
|
+
placeItems: "center",
|
|
91
|
+
width: 16,
|
|
92
|
+
marginLeft: 0,
|
|
93
|
+
borderTopLeftRadius: 2,
|
|
94
|
+
borderTopRightRadius: 2,
|
|
95
|
+
height: 12
|
|
96
|
+
}, _defineProperty(_ref6, "marginLeft", -8), _defineProperty(_ref6, "backgroundColor", colors.red[500]), _defineProperty(_ref6, "userSelect", "none"), _defineProperty(_ref6, "fontVariantNumeric", "tabular-nums"), _defineProperty(_ref6, "&::before", {
|
|
97
|
+
position: "absolute",
|
|
98
|
+
bottom: -8,
|
|
99
|
+
left: 0,
|
|
100
|
+
content: '""',
|
|
101
|
+
width: 0,
|
|
102
|
+
height: 0,
|
|
103
|
+
borderTop: "8px solid ".concat(colors.red[500]),
|
|
104
|
+
borderLeft: "8px solid transparent",
|
|
105
|
+
borderRight: "8px solid transparent"
|
|
106
|
+
}), _ref6;
|
|
107
|
+
});
|
|
108
|
+
var min = 60000;
|
|
109
|
+
var displayIntervalPairs = [[50, 250], [100, 500], [250, 1000], [1000, 5000], [5000, 30000], [10000, min], [30000, min * 2], [min, min * 5], [min * 5, min * 30], [min * 10, min * 60], [min * 30, min * 60 * 3], [min * 60, min * 60 * 5]];
|
|
110
|
+
|
|
111
|
+
var getMajorInterval = function getMajorInterval(duration) {
|
|
112
|
+
for (var _i = 0, _displayIntervalPairs = displayIntervalPairs; _i < _displayIntervalPairs.length; _i++) {
|
|
113
|
+
var _ref9 = _displayIntervalPairs[_i];
|
|
114
|
+
|
|
115
|
+
var _ref8 = _slicedToArray(_ref9, 2);
|
|
116
|
+
|
|
117
|
+
var minor = _ref8[0];
|
|
118
|
+
var major = _ref8[1];
|
|
119
|
+
|
|
120
|
+
if (duration / major < 6 && duration / major > 2) {
|
|
121
|
+
return [minor, major];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return [duration / 4, duration];
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export default (function (_ref10) {
|
|
129
|
+
var _ref10$currentTime = _ref10.currentTime,
|
|
130
|
+
currentTime = _ref10$currentTime === void 0 ? 0 : _ref10$currentTime,
|
|
131
|
+
duration = _ref10.duration,
|
|
132
|
+
onChangeCurrentTime = _ref10.onChangeCurrentTime,
|
|
133
|
+
keyframes = _ref10.keyframes;
|
|
134
|
+
|
|
135
|
+
var _useMeasure = useMeasure(),
|
|
136
|
+
_useMeasure2 = _slicedToArray(_useMeasure, 2),
|
|
137
|
+
ref = _useMeasure2[0],
|
|
138
|
+
bounds = _useMeasure2[1];
|
|
139
|
+
|
|
140
|
+
var _useState = useState(currentTime),
|
|
141
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
142
|
+
instantCurrentTime = _useState2[0],
|
|
143
|
+
changeInstantCurrentTime = _useState2[1];
|
|
144
|
+
|
|
145
|
+
var _useRafState = useRafState(false),
|
|
146
|
+
_useRafState2 = _slicedToArray(_useRafState, 2),
|
|
147
|
+
draggingTime = _useRafState2[0],
|
|
148
|
+
changeDraggingTime = _useRafState2[1];
|
|
149
|
+
|
|
150
|
+
var keyframeTimes = Object.keys(keyframes || {}).map(function (t) {
|
|
151
|
+
return parseInt(t);
|
|
152
|
+
}).filter(function (t) {
|
|
153
|
+
return !isNaN(t);
|
|
154
|
+
}).sort(function (a, b) {
|
|
155
|
+
return a - b;
|
|
156
|
+
});
|
|
157
|
+
useEffect(function () {
|
|
158
|
+
if (currentTime !== instantCurrentTime) {
|
|
159
|
+
changeInstantCurrentTime(currentTime);
|
|
160
|
+
}
|
|
161
|
+
}, [currentTime]);
|
|
162
|
+
|
|
163
|
+
var _useMemo = useMemo(function () {
|
|
164
|
+
return getMajorInterval(duration);
|
|
165
|
+
}, [duration]),
|
|
166
|
+
_useMemo2 = _slicedToArray(_useMemo, 2),
|
|
167
|
+
minorInterval = _useMemo2[0],
|
|
168
|
+
majorInterval = _useMemo2[1];
|
|
169
|
+
|
|
170
|
+
var onMouseMove = useEventCallback(function (e) {
|
|
171
|
+
if (draggingTime) {
|
|
172
|
+
var px = (e.clientX - bounds.left) / bounds.width;
|
|
173
|
+
changeInstantCurrentTime(Math.min(duration, Math.max(0, Math.floor(px * duration))));
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
var onMouseUp = useEventCallback(function (e) {
|
|
177
|
+
changeDraggingTime(false);
|
|
178
|
+
var px = (e.clientX - bounds.left) / bounds.width;
|
|
179
|
+
var newTime = Math.min(duration, Math.max(0, Math.floor(px * duration)));
|
|
180
|
+
changeInstantCurrentTime(newTime);
|
|
181
|
+
onChangeCurrentTime(newTime);
|
|
182
|
+
}); // TODO skeleton
|
|
183
|
+
|
|
184
|
+
if (!duration) return null;
|
|
185
|
+
return React.createElement(ThemeProvider, {
|
|
186
|
+
theme: theme
|
|
187
|
+
}, React.createElement(Container, {
|
|
188
|
+
onMouseMove: onMouseMove,
|
|
189
|
+
onMouseUp: onMouseUp,
|
|
190
|
+
ref: ref
|
|
191
|
+
}, range(0, duration, majorInterval).map(function (a) {
|
|
192
|
+
return React.createElement(React.Fragment, null, React.createElement(Tick, {
|
|
193
|
+
key: a,
|
|
194
|
+
style: {
|
|
195
|
+
left: a / duration * bounds.width,
|
|
196
|
+
height: "50%"
|
|
197
|
+
}
|
|
198
|
+
}), React.createElement(TickText, {
|
|
199
|
+
style: {
|
|
200
|
+
left: a / duration * bounds.width + 8,
|
|
201
|
+
bottom: "calc(50% - 12px)"
|
|
202
|
+
}
|
|
203
|
+
}, getTimeString(a)));
|
|
204
|
+
}), range(0, duration, minorInterval).filter(function (a) {
|
|
205
|
+
return !Number.isInteger(a / majorInterval);
|
|
206
|
+
}).map(function (a) {
|
|
207
|
+
return React.createElement(Tick, {
|
|
208
|
+
key: a,
|
|
209
|
+
style: {
|
|
210
|
+
left: a / duration * bounds.width,
|
|
211
|
+
height: "25%"
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}), keyframeTimes.map(function (kt) {
|
|
215
|
+
return React.createElement(KeyframeMarker, {
|
|
216
|
+
onClick: function onClick() {
|
|
217
|
+
return onChangeCurrentTime(kt);
|
|
218
|
+
},
|
|
219
|
+
key: kt,
|
|
220
|
+
style: {
|
|
221
|
+
left: kt / duration * bounds.width
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}), React.createElement(PositionCursor, {
|
|
225
|
+
onMouseDown: function onMouseDown(e) {
|
|
226
|
+
return changeDraggingTime(true);
|
|
227
|
+
},
|
|
228
|
+
style: {
|
|
229
|
+
cursor: draggingTime ? "grabbing" : "grab",
|
|
230
|
+
left: instantCurrentTime / duration * bounds.width
|
|
231
|
+
}
|
|
232
|
+
}, getTimeString(instantCurrentTime))));
|
|
233
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import AddLocationIcon from "@mui/icons-material/AddLocation";
|
|
3
|
+
import SidebarBoxContainer from "../SidebarBoxContainer";
|
|
4
|
+
import * as colors from "@mui/material/colors";
|
|
5
|
+
import getTimeString from "../KeyframeTimeline/get-time-string.js";
|
|
6
|
+
import TrashIcon from "@mui/icons-material/Delete";
|
|
7
|
+
import { styled } from "@mui/material/styles";
|
|
8
|
+
import { createTheme, ThemeProvider } from "@mui/material/styles";
|
|
9
|
+
var theme = createTheme();
|
|
10
|
+
var KeyframeRow = styled("div")(function (_ref) {
|
|
11
|
+
var theme = _ref.theme;
|
|
12
|
+
return {
|
|
13
|
+
cursor: "pointer",
|
|
14
|
+
display: "flex",
|
|
15
|
+
alignItems: "center",
|
|
16
|
+
padding: 8,
|
|
17
|
+
fontSize: 14,
|
|
18
|
+
color: colors.grey[700],
|
|
19
|
+
"&.current": {
|
|
20
|
+
backgroundColor: colors.blue[100]
|
|
21
|
+
},
|
|
22
|
+
"&:hover": {
|
|
23
|
+
backgroundColor: colors.grey[100]
|
|
24
|
+
},
|
|
25
|
+
"& .time": {
|
|
26
|
+
flexGrow: 1,
|
|
27
|
+
fontWeight: "bold",
|
|
28
|
+
"& .regionCount": {
|
|
29
|
+
marginLeft: 8,
|
|
30
|
+
fontWeight: "normal",
|
|
31
|
+
color: colors.grey[500]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"& .trash": {
|
|
35
|
+
"& .icon": {
|
|
36
|
+
fontSize: 18,
|
|
37
|
+
color: colors.grey[600],
|
|
38
|
+
transition: "transform 80ms",
|
|
39
|
+
"&:hover": {
|
|
40
|
+
color: colors.grey[800],
|
|
41
|
+
transform: "scale(1.25,1.25)"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
var KeyframesSelectorSidebarBox = function KeyframesSelectorSidebarBox(_ref2) {
|
|
49
|
+
var currentVideoTime = _ref2.currentVideoTime,
|
|
50
|
+
keyframes = _ref2.keyframes,
|
|
51
|
+
onChangeVideoTime = _ref2.onChangeVideoTime,
|
|
52
|
+
onDeleteKeyframe = _ref2.onDeleteKeyframe;
|
|
53
|
+
var keyframeTimes = Object.keys(keyframes).map(function (t) {
|
|
54
|
+
return parseInt(t);
|
|
55
|
+
});
|
|
56
|
+
return React.createElement(ThemeProvider, {
|
|
57
|
+
theme: theme
|
|
58
|
+
}, React.createElement(SidebarBoxContainer, {
|
|
59
|
+
title: "Keyframes",
|
|
60
|
+
subTitle: "",
|
|
61
|
+
icon: React.createElement(AddLocationIcon, {
|
|
62
|
+
style: {
|
|
63
|
+
color: colors.grey[700]
|
|
64
|
+
}
|
|
65
|
+
}),
|
|
66
|
+
expandedByDefault: true
|
|
67
|
+
}, keyframeTimes.map(function (t) {
|
|
68
|
+
var _keyframes$t;
|
|
69
|
+
|
|
70
|
+
return React.createElement(KeyframeRow, {
|
|
71
|
+
fullWidth: true,
|
|
72
|
+
key: t,
|
|
73
|
+
className: currentVideoTime === t ? "current" : "",
|
|
74
|
+
onClick: function onClick() {
|
|
75
|
+
return onChangeVideoTime(t);
|
|
76
|
+
}
|
|
77
|
+
}, React.createElement("div", {
|
|
78
|
+
className: "time"
|
|
79
|
+
}, getTimeString(t, 2), React.createElement("span", {
|
|
80
|
+
className: "regionCount"
|
|
81
|
+
}, "(", (((_keyframes$t = keyframes[t]) === null || _keyframes$t === void 0 ? void 0 : _keyframes$t.regions) || []).length, ")")), React.createElement("div", {
|
|
82
|
+
className: "trash"
|
|
83
|
+
}, React.createElement(TrashIcon, {
|
|
84
|
+
onClick: function onClick(e) {
|
|
85
|
+
onDeleteKeyframe(t);
|
|
86
|
+
e.stopPropagation();
|
|
87
|
+
},
|
|
88
|
+
className: "icon"
|
|
89
|
+
})));
|
|
90
|
+
})));
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export default KeyframesSelectorSidebarBox;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Button from "@mui/material/Button";
|
|
3
|
+
import { styled } from "@mui/material/styles";
|
|
4
|
+
import { createTheme, ThemeProvider } from "@mui/material/styles";
|
|
5
|
+
import * as colors from "@mui/material/colors";
|
|
6
|
+
import Grid from "@mui/material/Grid";
|
|
7
|
+
import Markdown from "react-markdown";
|
|
8
|
+
import GitHubButton from "react-github-btn";
|
|
9
|
+
import "./github-markdown.css";
|
|
10
|
+
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
|
|
11
|
+
import { docco } from "react-syntax-highlighter/dist/cjs/languages/hljs/javascript";
|
|
12
|
+
var contentMd = "# Features\r\n\r\n- Simple input/output format\r\n- Bounding Box, Point and Polygon Annotation\r\n- Zooming, Scaling, Panning\r\n- Multiple Images\r\n- Cursor Crosshair\r\n\r\n\r\n\r\n# Usage\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install react-image-annotate\r\n```\r\n\r\n## Basic Example\r\n\r\n```javascript\r\nimport ReactImageAnnotate from \"react-image-annotate\"\r\n\r\nconst App = () => (\r\n <ReactImageAnnotate\r\n selectedImage=\"https://example.com/image1.png\"\r\n taskDescription=\"# Draw region around each animal.\"\r\n images={[{ src: \"https://example.com/image1.png\", name: \"Image 1\" }]}\r\n regionClsList={[\"Dog\", \"Cat\"]}\r\n enabledTools={[\"create-box\"]}\r\n />\r\n)\r\n```\r\n\r\n# Props\r\n\r\nAll of the following properties can be defined on the `ReactImageAnnotate` component...\r\n\r\n| Prop | Type (\\* = required) | Description | Default |\r\n| ------------------------ | ------------------------------------------------ | --------------------------------------------------------------------------------------- | ------------- |\r\n| `taskDescription` | \\*`string` | Markdown description for what to do in the image. | |\r\n| `allowedArea` | `{ x: number, y: number, w: number, h: number }` | Area that is available for annotation. | Entire image. |\r\n| `regionTagList` | `Array<string>` | Allowed \"tags\" (mutually inclusive classifications) for regions. | |\r\n| `regionClsList` | `Array<string>` | Allowed \"classes\" (mutually exclusive classifications) for regions. | |\r\n| `imageTagList` | `Array<string>` | Allowed tags for entire image. | |\r\n| `imageClsList` | `Array<string>` | Allowed classes for entire image. | |\r\n| `enabledTools` | `Array<string>` | Tools allowed to be used. e.g. \"select\", \"create-point\", \"create-box\", \"create-polygon\" | Everything. |\r\n| `showTags` | `boolean` | Show tags and allow tags on regions. | `true` |\r\n| `selectedImage` | `string` | URL of initially selected image. | |\r\n| `images` | `Array<Image>` | Array of images to load into annotator | |\r\n| `showPointDistances` | `boolean` | Show distances between points. | `false` |\r\n| `pointDistancePrecision` | `number` | Precision on displayed points (e.g. 3 => 0.123) | |\r\n| `onExit` | `MainLayoutState => any` | Called when \"Save\" is called. | |\r\n\r\n# Sponsors\r\n\r\n[](https://wao.ai)\r\n";
|
|
13
|
+
var theme = createTheme();
|
|
14
|
+
var RootContainer = styled("div")(function (_ref) {
|
|
15
|
+
var theme = _ref.theme;
|
|
16
|
+
return {
|
|
17
|
+
display: "flex",
|
|
18
|
+
flexDirection: "column",
|
|
19
|
+
alignItems: "center"
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
var ContentContainer = styled("div")(function (_ref2) {
|
|
23
|
+
var theme = _ref2.theme;
|
|
24
|
+
return {
|
|
25
|
+
width: "100%",
|
|
26
|
+
boxSizing: "border-box",
|
|
27
|
+
display: "flex",
|
|
28
|
+
flexDirection: "column",
|
|
29
|
+
maxWidth: 1200
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
var Header = styled("div")(function (_ref3) {
|
|
33
|
+
var theme = _ref3.theme;
|
|
34
|
+
return {
|
|
35
|
+
width: "100%",
|
|
36
|
+
display: "flex",
|
|
37
|
+
justifyContent: "center",
|
|
38
|
+
backgroundColor: colors.blue[600],
|
|
39
|
+
padding: 8,
|
|
40
|
+
boxSizing: "border-box"
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
var HeaderButton = styled(Button)(function (_ref4) {
|
|
44
|
+
var theme = _ref4.theme;
|
|
45
|
+
return {
|
|
46
|
+
color: "white",
|
|
47
|
+
margin: 8,
|
|
48
|
+
padding: 16,
|
|
49
|
+
paddingLeft: 24,
|
|
50
|
+
paddingRight: 24
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
var Hero = styled("div")(function (_ref5) {
|
|
54
|
+
var theme = _ref5.theme;
|
|
55
|
+
return {
|
|
56
|
+
display: "flex",
|
|
57
|
+
justifyContent: "center",
|
|
58
|
+
width: "100%",
|
|
59
|
+
backgroundColor: colors.blue[500],
|
|
60
|
+
padding: 16,
|
|
61
|
+
color: "white",
|
|
62
|
+
boxSizing: "border-box"
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
var HeroMain = styled("div")(function (_ref6) {
|
|
66
|
+
var theme = _ref6.theme;
|
|
67
|
+
return {
|
|
68
|
+
fontSize: 48,
|
|
69
|
+
fontWeight: "bold",
|
|
70
|
+
paddingTop: 64,
|
|
71
|
+
textShadow: "0px 1px 5px rgba(0,0,0,0.3)"
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
var HeroSub = styled("div")(function (_ref7) {
|
|
75
|
+
var theme = _ref7.theme;
|
|
76
|
+
return {
|
|
77
|
+
paddingTop: 32,
|
|
78
|
+
lineHeight: 1.5,
|
|
79
|
+
fontSize: 24,
|
|
80
|
+
textShadow: "0px 1px 3px rgba(0,0,0,0.2)"
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
var HeroButtons = styled("div")(function (_ref8) {
|
|
84
|
+
var theme = _ref8.theme;
|
|
85
|
+
return {
|
|
86
|
+
paddingTop: 32,
|
|
87
|
+
paddingBottom: 48
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
var Section = styled("div")(function (_ref9) {
|
|
91
|
+
var theme = _ref9.theme;
|
|
92
|
+
return {
|
|
93
|
+
display: "flex",
|
|
94
|
+
padding: 16,
|
|
95
|
+
paddingTop: 32,
|
|
96
|
+
flexDirection: "column"
|
|
97
|
+
};
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
var CodeBlock = function CodeBlock(_ref10) {
|
|
101
|
+
var language = _ref10.language,
|
|
102
|
+
value = _ref10.value;
|
|
103
|
+
return React.createElement(SyntaxHighlighter, {
|
|
104
|
+
language: language,
|
|
105
|
+
style: docco
|
|
106
|
+
}, value);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
function flatten(text, child) {
|
|
110
|
+
return typeof child === "string" ? text + child : React.Children.toArray(child.props.children).reduce(flatten, text);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function HeadingRenderer(props) {
|
|
114
|
+
var children = React.Children.toArray(props.children);
|
|
115
|
+
var text = children.reduce(flatten, "");
|
|
116
|
+
var slug = text.toLowerCase().replace(/\W/g, "-");
|
|
117
|
+
return React.createElement("h" + props.level, {
|
|
118
|
+
id: slug
|
|
119
|
+
}, props.children);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
var LandingPage = function LandingPage() {
|
|
123
|
+
return React.createElement(ThemeProvider, {
|
|
124
|
+
theme: theme
|
|
125
|
+
}, React.createElement(RootContainer, null, React.createElement(Header, {
|
|
126
|
+
id: "about"
|
|
127
|
+
}, React.createElement(ContentContainer, {
|
|
128
|
+
style: {
|
|
129
|
+
flexDirection: "row",
|
|
130
|
+
flexGrow: 1
|
|
131
|
+
}
|
|
132
|
+
}, React.createElement(HeaderButton, {
|
|
133
|
+
href: "#features"
|
|
134
|
+
}, "Features"), React.createElement(HeaderButton, {
|
|
135
|
+
href: "#usage"
|
|
136
|
+
}, "Usage"), React.createElement(HeaderButton, {
|
|
137
|
+
href: "#props"
|
|
138
|
+
}, "Props"), React.createElement(HeaderButton, {
|
|
139
|
+
href: "./demo"
|
|
140
|
+
}, "Demo Playground"))), React.createElement(Hero, null, React.createElement(ContentContainer, null, React.createElement(HeroMain, null, "React Image Annotate"), React.createElement(HeroSub, null, "Powerful React component for image annotations with bounding boxes, tagging, classification, multiple images and polygon segmentation."), React.createElement(HeroButtons, null, React.createElement(GitHubButton, {
|
|
141
|
+
href: "https://github.com/waoai/react-image-annotate",
|
|
142
|
+
"data-size": "large",
|
|
143
|
+
"data-show-count": "true",
|
|
144
|
+
"aria-label": "Star waoai/react-image-annotate on GitHub"
|
|
145
|
+
}, "Star")))), React.createElement(ContentContainer, {
|
|
146
|
+
className: "markdown-body"
|
|
147
|
+
}, React.createElement(Section, {
|
|
148
|
+
className: "markdown-body"
|
|
149
|
+
}, React.createElement(Markdown, {
|
|
150
|
+
escapeHtml: false,
|
|
151
|
+
source: contentMd,
|
|
152
|
+
renderers: {
|
|
153
|
+
code: CodeBlock,
|
|
154
|
+
heading: HeadingRenderer
|
|
155
|
+
}
|
|
156
|
+
})))));
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export default LandingPage;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
3
|
+
import { faArrowsAlt, faMousePointer, faExpandArrowsAlt, faGripLines, faTag, faPaintBrush, faCrosshairs, faDrawPolygon, faVectorSquare, faHandPaper, faSearch, faMask, faEdit, faChartLine } from "@fortawesome/free-solid-svg-icons";
|
|
4
|
+
import FullscreenIcon from "@mui/icons-material/Fullscreen";
|
|
5
|
+
import AccessibilityNewIcon from "@mui/icons-material/AccessibilityNew";
|
|
6
|
+
var faStyle = {
|
|
7
|
+
marginTop: 4,
|
|
8
|
+
width: 16,
|
|
9
|
+
height: 16,
|
|
10
|
+
marginBottom: 4
|
|
11
|
+
};
|
|
12
|
+
export var iconDictionary = {
|
|
13
|
+
select: function select() {
|
|
14
|
+
return React.createElement(FontAwesomeIcon, {
|
|
15
|
+
style: faStyle,
|
|
16
|
+
size: "xs",
|
|
17
|
+
fixedWidth: true,
|
|
18
|
+
icon: faMousePointer
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
pan: function pan() {
|
|
22
|
+
return React.createElement(FontAwesomeIcon, {
|
|
23
|
+
style: faStyle,
|
|
24
|
+
size: "xs",
|
|
25
|
+
fixedWidth: true,
|
|
26
|
+
icon: faHandPaper
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
zoom: function zoom() {
|
|
30
|
+
return React.createElement(FontAwesomeIcon, {
|
|
31
|
+
style: faStyle,
|
|
32
|
+
size: "xs",
|
|
33
|
+
fixedWidth: true,
|
|
34
|
+
icon: faSearch
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
"show-tags": function showTags() {
|
|
38
|
+
return React.createElement(FontAwesomeIcon, {
|
|
39
|
+
style: faStyle,
|
|
40
|
+
size: "xs",
|
|
41
|
+
fixedWidth: true,
|
|
42
|
+
icon: faTag
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
"create-point": function createPoint() {
|
|
46
|
+
return React.createElement(FontAwesomeIcon, {
|
|
47
|
+
style: faStyle,
|
|
48
|
+
size: "xs",
|
|
49
|
+
fixedWidth: true,
|
|
50
|
+
icon: faCrosshairs
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
"create-box": function createBox() {
|
|
54
|
+
return React.createElement(FontAwesomeIcon, {
|
|
55
|
+
style: faStyle,
|
|
56
|
+
size: "xs",
|
|
57
|
+
fixedWidth: true,
|
|
58
|
+
icon: faVectorSquare
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
"create-polygon": function createPolygon() {
|
|
62
|
+
return React.createElement(FontAwesomeIcon, {
|
|
63
|
+
style: faStyle,
|
|
64
|
+
size: "xs",
|
|
65
|
+
fixedWidth: true,
|
|
66
|
+
icon: faDrawPolygon
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
"create-expanding-line": function createExpandingLine() {
|
|
70
|
+
return React.createElement(FontAwesomeIcon, {
|
|
71
|
+
style: faStyle,
|
|
72
|
+
size: "xs",
|
|
73
|
+
fixedWidth: true,
|
|
74
|
+
icon: faGripLines
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
"create-line": function createLine() {
|
|
78
|
+
return React.createElement(FontAwesomeIcon, {
|
|
79
|
+
style: faStyle,
|
|
80
|
+
size: "xs",
|
|
81
|
+
fixedWidth: true,
|
|
82
|
+
icon: faChartLine
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
"show-mask": function showMask() {
|
|
86
|
+
return React.createElement(FontAwesomeIcon, {
|
|
87
|
+
style: faStyle,
|
|
88
|
+
size: "xs",
|
|
89
|
+
fixedWidth: true,
|
|
90
|
+
icon: faMask
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
"modify-allowed-area": function modifyAllowedArea() {
|
|
94
|
+
return React.createElement(FontAwesomeIcon, {
|
|
95
|
+
style: faStyle,
|
|
96
|
+
size: "xs",
|
|
97
|
+
fixedWidth: true,
|
|
98
|
+
icon: faEdit
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
"create-keypoints": AccessibilityNewIcon,
|
|
102
|
+
window: FullscreenIcon
|
|
103
|
+
};
|
|
104
|
+
export default iconDictionary;
|