@labelbee/lb-annotation 1.14.0-alpha.2 → 1.14.0-alpha.3
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/dist/_virtual/MathUtilsWorker.js +8 -1
- package/dist/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +35 -2
- package/dist/_virtual/filterBoxWorker.js +8 -1
- package/dist/_virtual/highlightWorker.js +8 -1
- package/dist/assets/attributeIcon/icon_canvasEdit0.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_canvasEdit1.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_canvasEdit2.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_canvasEdit3.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_canvasEdit4.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_canvasEdit5.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_canvasEdit6.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_canvasEdit7.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_canvasEdit8.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_canvasEdit_miss.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -5
- package/dist/assets/attributeIcon/icon_cuboidLeft.svg.js +5 -7
- package/dist/assets/attributeIcon/icon_cuboidMore.svg.js +5 -5
- package/dist/assets/attributeIcon/icon_cuboidRight.svg.js +5 -5
- package/dist/assets/attributeIcon/icon_cuboidTop.svg.js +5 -12
- package/dist/assets/attributeIcon/icon_editFEN.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_editHUANG.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_editLAN.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_editLV.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_editQING.svg.js +5 -1
- package/dist/constant/annotation.js +127 -1
- package/dist/constant/annotationTask.js +30 -1
- package/dist/constant/defaultConfig.js +266 -1
- package/dist/constant/keyCode.js +38 -1
- package/dist/constant/style.js +98 -1
- package/dist/constant/tool.js +236 -1
- package/dist/core/index.js +150 -1
- package/dist/core/pointCloud/OrbitControls.js +665 -1
- package/dist/core/pointCloud/PCDLoader.js +260 -2
- package/dist/core/pointCloud/annotation.js +215 -1
- package/dist/core/pointCloud/cache.js +53 -1
- package/dist/core/pointCloud/index.js +991 -5
- package/dist/core/pointCloud/matrix.js +138 -1
- package/dist/core/pointCloud/segmentation.js +144 -0
- package/dist/core/pointCloud/selector/Sse3dLassoSelector.js +26 -0
- package/dist/core/pointCloud/selector/Sse3dSelector.js +16 -0
- package/dist/core/scheduler.js +233 -1
- package/dist/core/toolOperation/LineToolOperation.js +1434 -1
- package/dist/core/toolOperation/ScribbleTool.js +292 -1
- package/dist/core/toolOperation/TextToolOperation.js +131 -1
- package/dist/core/toolOperation/ViewOperation.js +556 -1
- package/dist/core/toolOperation/basicToolOperation.js +881 -1
- package/dist/core/toolOperation/checkOperation.js +208 -1
- package/dist/core/toolOperation/cuboidOperation.js +754 -1
- package/dist/core/toolOperation/cuboidToggleButtonClass.js +152 -7
- package/dist/core/toolOperation/eventListener.js +37 -1
- package/dist/core/toolOperation/measureOperation.js +41 -1
- package/dist/core/toolOperation/pointCloud2dOperation.js +365 -1
- package/dist/core/toolOperation/pointOperation.js +696 -1
- package/dist/core/toolOperation/polygonOperation.js +1251 -1
- package/dist/core/toolOperation/rectOperation.js +1233 -1
- package/dist/core/toolOperation/segmentByRect.js +174 -1
- package/dist/core/toolOperation/tagOperation.js +201 -3
- package/dist/core/toolOperation/textAttributeClass.js +182 -16
- package/dist/index.js +185 -1
- package/dist/locales/constants.js +24 -1
- package/dist/locales/en_US/message.js +25 -1
- package/dist/locales/index.js +19 -1
- package/dist/locales/zh_CN/message.js +25 -1
- package/dist/newCore/CanvasScheduler.js +35 -1
- package/dist/types/core/pointCloud/segmentation.d.ts +0 -0
- package/dist/types/core/pointCloud/selector/Sse3dLassoSelector.d.ts +0 -0
- package/dist/types/core/pointCloud/selector/Sse3dSelector.d.ts +0 -0
- package/dist/utils/ActionsHistory.js +84 -1
- package/dist/utils/ImgUtils.js +23 -1
- package/dist/utils/MathUtils.js +385 -2
- package/dist/utils/VectorUtils.js +25 -1
- package/dist/utils/tool/AttributeUtils.js +218 -1
- package/dist/utils/tool/AxisUtils.js +340 -1
- package/dist/utils/tool/CanvasUtils.js +62 -1
- package/dist/utils/tool/CommonToolUtils.js +174 -1
- package/dist/utils/tool/CuboidUtils.js +704 -1
- package/dist/utils/tool/DblClickEventListener.js +102 -1
- package/dist/utils/tool/DrawUtils.js +492 -3
- package/dist/utils/tool/EnhanceCommonToolUtils.js +53 -1
- package/dist/utils/tool/ImgPosUtils.js +58 -1
- package/dist/utils/tool/LineToolUtils.js +261 -1
- package/dist/utils/tool/MarkerUtils.js +56 -1
- package/dist/utils/tool/PolygonUtils.js +460 -1
- package/dist/utils/tool/RectUtils.js +155 -1
- package/dist/utils/tool/RenderDomClass.js +57 -7
- package/dist/utils/tool/RenderDomUtils.js +21 -4
- package/dist/utils/tool/StyleUtils.js +31 -1
- package/dist/utils/tool/TagUtils.js +129 -1
- package/dist/utils/tool/UnitUtils.js +12 -1
- package/dist/utils/tool/ZoomUtils.js +72 -1
- package/dist/utils/tool/polygonTool.js +133 -1
- package/dist/utils/uuid.js +26 -1
- package/es/_virtual/MathUtilsWorker.js +6 -1
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +12 -0
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +7 -0
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +31 -2
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +11 -0
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +18 -0
- package/es/_virtual/filterBoxWorker.js +6 -1
- package/es/_virtual/highlightWorker.js +6 -1
- package/es/assets/attributeIcon/icon_canvasEdit0.svg.js +3 -1
- package/es/assets/attributeIcon/icon_canvasEdit1.svg.js +3 -1
- package/es/assets/attributeIcon/icon_canvasEdit2.svg.js +3 -1
- package/es/assets/attributeIcon/icon_canvasEdit3.svg.js +3 -1
- package/es/assets/attributeIcon/icon_canvasEdit4.svg.js +3 -1
- package/es/assets/attributeIcon/icon_canvasEdit5.svg.js +3 -1
- package/es/assets/attributeIcon/icon_canvasEdit6.svg.js +3 -1
- package/es/assets/attributeIcon/icon_canvasEdit7.svg.js +3 -1
- package/es/assets/attributeIcon/icon_canvasEdit8.svg.js +3 -1
- package/es/assets/attributeIcon/icon_canvasEdit_miss.svg.js +3 -1
- package/es/assets/attributeIcon/icon_cuboidFAB.svg.js +3 -5
- package/es/assets/attributeIcon/icon_cuboidLeft.svg.js +3 -7
- package/es/assets/attributeIcon/icon_cuboidMore.svg.js +3 -5
- package/es/assets/attributeIcon/icon_cuboidRight.svg.js +3 -5
- package/es/assets/attributeIcon/icon_cuboidTop.svg.js +3 -12
- package/es/assets/attributeIcon/icon_editFEN.svg.js +3 -1
- package/es/assets/attributeIcon/icon_editHUANG.svg.js +3 -1
- package/es/assets/attributeIcon/icon_editLAN.svg.js +3 -1
- package/es/assets/attributeIcon/icon_editLV.svg.js +3 -1
- package/es/assets/attributeIcon/icon_editQING.svg.js +3 -1
- package/es/constant/annotation.js +113 -1
- package/es/constant/annotationTask.js +25 -1
- package/es/constant/defaultConfig.js +260 -1
- package/es/constant/keyCode.js +36 -1
- package/es/constant/style.js +74 -1
- package/es/constant/tool.js +220 -1
- package/es/core/index.js +148 -1
- package/es/core/pointCloud/OrbitControls.js +661 -1
- package/es/core/pointCloud/PCDLoader.js +256 -2
- package/es/core/pointCloud/annotation.js +211 -1
- package/es/core/pointCloud/cache.js +49 -1
- package/es/core/pointCloud/index.js +962 -5
- package/es/core/pointCloud/matrix.js +109 -1
- package/es/core/pointCloud/segmentation.js +120 -0
- package/es/core/pointCloud/selector/Sse3dLassoSelector.js +24 -0
- package/es/core/pointCloud/selector/Sse3dSelector.js +14 -0
- package/es/core/scheduler.js +228 -1
- package/es/core/toolOperation/LineToolOperation.js +1421 -1
- package/es/core/toolOperation/ScribbleTool.js +290 -1
- package/es/core/toolOperation/TextToolOperation.js +129 -1
- package/es/core/toolOperation/ViewOperation.js +549 -1
- package/es/core/toolOperation/basicToolOperation.js +877 -1
- package/es/core/toolOperation/checkOperation.js +206 -1
- package/es/core/toolOperation/cuboidOperation.js +752 -1
- package/es/core/toolOperation/cuboidToggleButtonClass.js +150 -7
- package/es/core/toolOperation/eventListener.js +35 -1
- package/es/core/toolOperation/measureOperation.js +39 -1
- package/es/core/toolOperation/pointCloud2dOperation.js +359 -1
- package/es/core/toolOperation/pointOperation.js +690 -1
- package/es/core/toolOperation/polygonOperation.js +1245 -1
- package/es/core/toolOperation/rectOperation.js +1228 -1
- package/es/core/toolOperation/scribbleTool2.js +249 -0
- package/es/core/toolOperation/segmentByRect.js +172 -1
- package/es/core/toolOperation/tagOperation.js +199 -3
- package/es/core/toolOperation/textAttributeClass.js +180 -16
- package/es/index.js +46 -1
- package/es/locales/constants.js +22 -1
- package/es/locales/en_US/message.js +23 -1
- package/es/locales/index.js +17 -1
- package/es/locales/zh_CN/message.js +23 -1
- package/es/newCore/CanvasScheduler.js +31 -1
- package/es/utils/ActionsHistory.js +78 -1
- package/es/utils/ImgUtils.js +21 -1
- package/es/utils/MathUtils.js +380 -2
- package/es/utils/VectorUtils.js +23 -1
- package/es/utils/tool/AttributeUtils.js +212 -1
- package/es/utils/tool/AxisUtils.js +335 -1
- package/es/utils/tool/CanvasUtils.js +60 -1
- package/es/utils/tool/CommonToolUtils.js +172 -1
- package/es/utils/tool/CuboidUtils.js +680 -1
- package/es/utils/tool/DblClickEventListener.js +100 -1
- package/es/utils/tool/DrawUtils.js +490 -3
- package/es/utils/tool/EnhanceCommonToolUtils.js +48 -1
- package/es/utils/tool/ImgPosUtils.js +56 -1
- package/es/utils/tool/LineToolUtils.js +255 -1
- package/es/utils/tool/MarkerUtils.js +54 -1
- package/es/utils/tool/PolygonUtils.js +458 -1
- package/es/utils/tool/RectUtils.js +153 -1
- package/es/utils/tool/RenderDomClass.js +55 -7
- package/es/utils/tool/RenderDomUtils.js +19 -4
- package/es/utils/tool/StyleUtils.js +29 -1
- package/es/utils/tool/TagUtils.js +127 -1
- package/es/utils/tool/UnitUtils.js +10 -1
- package/es/utils/tool/ZoomUtils.js +70 -1
- package/es/utils/tool/polygonTool.js +126 -1
- package/es/utils/uuid.js +24 -1
- package/package.json +7 -5
|
@@ -1,37 +1,201 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import EKeyCode from '../../constant/keyCode.js';
|
|
2
|
+
import { TEXT_ATTRIBUTE_LINE_HEIGHT, TEXT_ATTRIBUTE_MAX_LENGTH } from '../../constant/tool.js';
|
|
3
|
+
|
|
4
|
+
const defaultWidth = 30;
|
|
5
|
+
const DEFAULT_TEXT_WIDTH = 164;
|
|
6
|
+
class TextAttributeClass {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
this.textKeyDown = (e) => {
|
|
9
|
+
e.stopPropagation();
|
|
10
|
+
switch (e.keyCode) {
|
|
11
|
+
case EKeyCode.Enter:
|
|
12
|
+
this.submitTextarea();
|
|
13
|
+
this.appendToContainer();
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const {container, icon, color, getCurrentSelectedData, updateSelectedTextAttribute} = props;
|
|
18
|
+
const width = props.width || DEFAULT_TEXT_WIDTH;
|
|
19
|
+
this.container = container;
|
|
20
|
+
this.getCurrentSelectedData = getCurrentSelectedData;
|
|
21
|
+
this.updateSelectedTextAttribute = updateSelectedTextAttribute;
|
|
22
|
+
this._textAttributeDOM = this.initTextAttributeDOM();
|
|
23
|
+
this._iconDOM = this.initIconDOM(icon);
|
|
24
|
+
this._textDOM = this.initTextDOM(width, TEXT_ATTRIBUTE_LINE_HEIGHT);
|
|
25
|
+
this._textareaDOM = this.initTextareaDOM(width, color);
|
|
26
|
+
this.appendToContainer();
|
|
27
|
+
}
|
|
28
|
+
get isExit() {
|
|
29
|
+
if (!this._textAttributeDOM) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return this.container.contains(this._textAttributeDOM);
|
|
33
|
+
}
|
|
34
|
+
get isExitTextareaDOM() {
|
|
35
|
+
if (!this._textareaDOM) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
return this.container.contains(this._textareaDOM);
|
|
39
|
+
}
|
|
40
|
+
updateIcon(icon) {
|
|
41
|
+
if (this._iconDOM) {
|
|
42
|
+
this._iconDOM.innerHTML = icon;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
appendToContainer() {
|
|
46
|
+
if (!this._textAttributeDOM || !this._textDOM || !this._iconDOM) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
this.container.appendChild(this._textAttributeDOM);
|
|
50
|
+
this._textAttributeDOM.appendChild(this._textDOM);
|
|
51
|
+
this._textAttributeDOM.appendChild(this._iconDOM);
|
|
52
|
+
}
|
|
53
|
+
initTextAttributeDOM() {
|
|
54
|
+
const _textAttributeDOM = document.createElement("div");
|
|
55
|
+
_textAttributeDOM.setAttribute("id", "textArea");
|
|
56
|
+
return _textAttributeDOM;
|
|
57
|
+
}
|
|
58
|
+
initTextDOM(width, lineHeight) {
|
|
59
|
+
const _textDOM = document.createElement("span");
|
|
60
|
+
_textDOM.setAttribute("style", `
|
|
61
|
+
width: ${Math.max(width, defaultWidth)}px;
|
|
62
|
+
line-height: ${lineHeight}px;
|
|
4
63
|
word-break: break-all;
|
|
5
64
|
white-space: pre-line;
|
|
6
65
|
font-style: italic;
|
|
7
|
-
`)
|
|
66
|
+
`);
|
|
67
|
+
return _textDOM;
|
|
68
|
+
}
|
|
69
|
+
initIconDOM(icon) {
|
|
70
|
+
const _iconDOM = document.createElement("div");
|
|
71
|
+
_iconDOM.setAttribute("id", "annotation_text");
|
|
72
|
+
_iconDOM.innerHTML = icon;
|
|
73
|
+
_iconDOM.addEventListener("mouseup", (e) => {
|
|
74
|
+
e.stopPropagation();
|
|
75
|
+
this.renderTextarea();
|
|
76
|
+
});
|
|
77
|
+
_iconDOM.addEventListener("mousedown", (e) => {
|
|
78
|
+
e.stopPropagation();
|
|
79
|
+
});
|
|
80
|
+
_iconDOM.addEventListener("contextmenu", (e) => {
|
|
81
|
+
e.stopPropagation();
|
|
82
|
+
});
|
|
83
|
+
_iconDOM.setAttribute("style", `
|
|
8
84
|
position: absolute;
|
|
9
85
|
left: -20px;
|
|
10
86
|
top: 4px;
|
|
11
87
|
cursor: pointer;
|
|
12
88
|
z-index: 10
|
|
13
|
-
`)
|
|
89
|
+
`);
|
|
90
|
+
return _iconDOM;
|
|
91
|
+
}
|
|
92
|
+
initTextareaDOM(width, color) {
|
|
93
|
+
const _textareaDOM = document.createElement("textarea");
|
|
94
|
+
_textareaDOM.addEventListener("click", (e) => {
|
|
95
|
+
e.stopPropagation();
|
|
96
|
+
});
|
|
97
|
+
_textareaDOM.addEventListener("mouseup", (e) => {
|
|
98
|
+
e.stopPropagation();
|
|
99
|
+
});
|
|
100
|
+
_textareaDOM.setAttribute("style", `
|
|
14
101
|
background-color: transparent;
|
|
15
102
|
border-radius: 5px;
|
|
16
|
-
border-color: ${
|
|
103
|
+
border-color: ${color};
|
|
17
104
|
outline: none;
|
|
18
105
|
resize: none;
|
|
19
|
-
width: ${Math.max(
|
|
20
|
-
`)
|
|
106
|
+
width: ${Math.max(width, 30)}px;
|
|
107
|
+
`);
|
|
108
|
+
_textareaDOM.setAttribute("maxLength", `${TEXT_ATTRIBUTE_MAX_LENGTH}`);
|
|
109
|
+
return _textareaDOM;
|
|
110
|
+
}
|
|
111
|
+
removeTextDOM() {
|
|
112
|
+
if (!this._textAttributeDOM) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (this._textDOM) {
|
|
116
|
+
this._textAttributeDOM.removeChild(this._textDOM);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
removeIconDOM() {
|
|
120
|
+
if (!this._textAttributeDOM) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (this._iconDOM) {
|
|
124
|
+
this._textAttributeDOM.removeChild(this._iconDOM);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
removeTextareaDOM() {
|
|
128
|
+
var _a, _b;
|
|
129
|
+
if (this._textareaDOM && this._textAttributeDOM && ((_a = this._textAttributeDOM) == null ? void 0 : _a.contains(this._textareaDOM))) {
|
|
130
|
+
(_b = this._textAttributeDOM) == null ? void 0 : _b.removeChild(this._textareaDOM);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
submitTextarea() {
|
|
134
|
+
var _a;
|
|
135
|
+
if (this._textareaDOM) {
|
|
136
|
+
this.updateSelectedTextAttribute((_a = this._textareaDOM) == null ? void 0 : _a.value);
|
|
137
|
+
this.removeTextareaDOM();
|
|
138
|
+
this.clearTextAttribute();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
clearTextAttribute() {
|
|
142
|
+
if (this._textAttributeDOM && this.container.contains(this._textAttributeDOM)) {
|
|
143
|
+
this.container.removeChild(this._textAttributeDOM);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
renderTextarea() {
|
|
147
|
+
if (!this._textAttributeDOM || !this._textareaDOM) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const data = this.getCurrentSelectedData();
|
|
151
|
+
if (!data) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const {width = DEFAULT_TEXT_WIDTH, textAttribute, color} = data;
|
|
155
|
+
this._textareaDOM.value = `${textAttribute}`;
|
|
156
|
+
this._textareaDOM.setAttribute("style", `
|
|
21
157
|
background-color: rgba(0,0,0,0.4);
|
|
22
158
|
border-radius: 5px;
|
|
23
|
-
border-color: ${
|
|
159
|
+
border-color: ${color};
|
|
24
160
|
outline: none;
|
|
25
161
|
resize: none;
|
|
26
162
|
font-style: italic;
|
|
27
163
|
font-weight: 900;
|
|
28
164
|
text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.6);
|
|
29
|
-
width: ${Math.max(
|
|
30
|
-
`)
|
|
165
|
+
width: ${Math.max(width, defaultWidth)}px;
|
|
166
|
+
`);
|
|
167
|
+
this._textareaDOM.setAttribute("maxLength", `${TEXT_ATTRIBUTE_MAX_LENGTH}`);
|
|
168
|
+
this._textAttributeDOM.appendChild(this._textareaDOM);
|
|
169
|
+
this.removeIconDOM();
|
|
170
|
+
this.removeTextDOM();
|
|
171
|
+
this._textareaDOM.focus();
|
|
172
|
+
this._textareaDOM.addEventListener("keydown", this.textKeyDown);
|
|
173
|
+
}
|
|
174
|
+
update(textAttribute, position) {
|
|
175
|
+
var _a;
|
|
176
|
+
const {left, top, color, width = DEFAULT_TEXT_WIDTH} = position;
|
|
177
|
+
const newWidth = Math.max(width, defaultWidth);
|
|
178
|
+
(_a = this._textAttributeDOM) == null ? void 0 : _a.setAttribute("style", `
|
|
31
179
|
position: absolute;
|
|
32
|
-
width: ${
|
|
180
|
+
width: ${newWidth}px;
|
|
33
181
|
font-size: 14px;
|
|
34
|
-
left:${
|
|
35
|
-
top: ${
|
|
36
|
-
color: ${
|
|
37
|
-
`)
|
|
182
|
+
left:${left}px;
|
|
183
|
+
top: ${top}px;
|
|
184
|
+
color: ${color};
|
|
185
|
+
`);
|
|
186
|
+
if (this._textDOM) {
|
|
187
|
+
this._textDOM.innerHTML = `${textAttribute}`;
|
|
188
|
+
}
|
|
189
|
+
if (this._textareaDOM) {
|
|
190
|
+
this._textareaDOM.style.width = `${newWidth}px`;
|
|
191
|
+
this._textareaDOM.style.borderColor = `${color}`;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
changeSelected() {
|
|
195
|
+
if (this.isExitTextareaDOM) {
|
|
196
|
+
this.submitTextarea();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export { TextAttributeClass as default };
|
package/es/index.js
CHANGED
|
@@ -1 +1,46 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { RectOperation } from './core/toolOperation/rectOperation.js';
|
|
2
|
+
export { default as TagOperation } from './core/toolOperation/tagOperation.js';
|
|
3
|
+
export { default as PointOperation } from './core/toolOperation/pointOperation.js';
|
|
4
|
+
export { default as LineToolOperation } from './core/toolOperation/LineToolOperation.js';
|
|
5
|
+
export { default as TextToolOperation } from './core/toolOperation/TextToolOperation.js';
|
|
6
|
+
export { default as PolygonOperation } from './core/toolOperation/polygonOperation.js';
|
|
7
|
+
export { default as MeasureOperation } from './core/toolOperation/measureOperation.js';
|
|
8
|
+
export { BasicToolOperation } from './core/toolOperation/basicToolOperation.js';
|
|
9
|
+
export { default as ViewOperation } from './core/toolOperation/ViewOperation.js';
|
|
10
|
+
export { default as ScribbleTool } from './core/toolOperation/ScribbleTool.js';
|
|
11
|
+
export { default as PointCloud2dOperation } from './core/toolOperation/pointCloud2dOperation.js';
|
|
12
|
+
import * as annotation from './constant/annotation.js';
|
|
13
|
+
export { annotation as cAnnotation };
|
|
14
|
+
import * as annotationTask from './constant/annotationTask.js';
|
|
15
|
+
export { annotationTask as cAnnotationTask };
|
|
16
|
+
import * as keyCode from './constant/keyCode.js';
|
|
17
|
+
export { keyCode as cKeyCode };
|
|
18
|
+
import * as style from './constant/style.js';
|
|
19
|
+
export { style as cStyle };
|
|
20
|
+
import * as tool from './constant/tool.js';
|
|
21
|
+
export { tool as cTool };
|
|
22
|
+
export { CLIENT_TOOL_HEAD_TYPE, CLIENT_TOOL_NAME, DEFAULT_FONT, DEFAULT_TEXT_MAX_WIDTH, EAnnotationMode, EAuditStatus, ECheckModel, EDependPattern, EDragTarget, EDrawPointPattern, EFilterToolOperation, ELineColor, ELineTypes, EOperationMode, EPageOperator, EPointCloudName, EPolygonPattern, ERectPattern, EScribblePattern, ESelectedType, ETextType, EThumbnailOption, EToolName, EToolType, EVideoToolName, OPERATION_LIST, SEGMENT_NUMBER, TEXT_ATTRIBUTE_LINE_HEIGHT, TEXT_ATTRIBUTE_MAX_LENGTH, TEXT_TYPE, TOOL_NAME, TOOL_NAME_EN, edgeAdsorptionScope, editStepWidth } from './constant/tool.js';
|
|
23
|
+
export { default as TagUtils } from './utils/tool/TagUtils.js';
|
|
24
|
+
export { default as uuid } from './utils/uuid.js';
|
|
25
|
+
import EnhanceCommonToolUtils from './utils/tool/EnhanceCommonToolUtils.js';
|
|
26
|
+
export { default as MarkerUtils } from './utils/tool/MarkerUtils.js';
|
|
27
|
+
export { default as RectUtils } from './utils/tool/RectUtils.js';
|
|
28
|
+
export { default as AxisUtils } from './utils/tool/AxisUtils.js';
|
|
29
|
+
export { default as DrawUtils } from './utils/tool/DrawUtils.js';
|
|
30
|
+
export { default as ImgUtils } from './utils/ImgUtils.js';
|
|
31
|
+
export { default as MathUtils } from './utils/MathUtils.js';
|
|
32
|
+
export { default as AttributeUtils } from './utils/tool/AttributeUtils.js';
|
|
33
|
+
export { default as ActionsHistory } from './utils/ActionsHistory.js';
|
|
34
|
+
export { default as DblClickEventListener } from './utils/tool/DblClickEventListener.js';
|
|
35
|
+
export { default as AnnotationEngine } from './core/index.js';
|
|
36
|
+
export { default as UnitUtils } from './utils/tool/UnitUtils.js';
|
|
37
|
+
export { default as StyleUtils } from './utils/tool/StyleUtils.js';
|
|
38
|
+
export { CanvasScheduler } from './newCore/CanvasScheduler.js';
|
|
39
|
+
export { PointCloud } from './core/pointCloud/index.js';
|
|
40
|
+
export { createThreeMatrix4, getCuboidFromPointCloudBox, lidar2image, pointCloudLidar2image, rotatePoint, transferKitti2Matrix } from './core/pointCloud/matrix.js';
|
|
41
|
+
export { PointCloudAnnotation } from './core/pointCloud/annotation.js';
|
|
42
|
+
|
|
43
|
+
const CommonToolUtils = EnhanceCommonToolUtils;
|
|
44
|
+
const toolUtils = EnhanceCommonToolUtils;
|
|
45
|
+
|
|
46
|
+
export { CommonToolUtils, toolUtils };
|
package/es/locales/constants.js
CHANGED
|
@@ -1 +1,22 @@
|
|
|
1
|
-
var
|
|
1
|
+
var EMessage;
|
|
2
|
+
(function(EMessage2) {
|
|
3
|
+
EMessage2["NoRotateNotice"] = "noRotateNotice";
|
|
4
|
+
EMessage2["RectErrorSizeNotice"] = "rectErrorSizeNotice";
|
|
5
|
+
EMessage2["TextCheckNumberErrorNotice"] = "textCheckNumberErrorNotice";
|
|
6
|
+
EMessage2["TextCheckEnglishErrorNotice"] = "textCheckEnglishErrorNotice";
|
|
7
|
+
EMessage2["TextCheckCustomErrorNotice"] = "textCheckCustomErrorNotice";
|
|
8
|
+
EMessage2["UpperLimitErrorNotice"] = "UpperLimitErrorNotice";
|
|
9
|
+
EMessage2["LowerLimitErrorNotice"] = "LowerLimitErrorNotice";
|
|
10
|
+
EMessage2["InvalidImage"] = "InvalidImage";
|
|
11
|
+
EMessage2["DisableDelete"] = "DisableDelete";
|
|
12
|
+
EMessage2["ClearPartialData"] = "ClearPartialData";
|
|
13
|
+
EMessage2["MarkerFinish"] = "MarkerFinish";
|
|
14
|
+
EMessage2["LowerLimitPoint"] = "LowerLimitPoint";
|
|
15
|
+
EMessage2["NoRotateInDependence"] = "noRotateInDependence";
|
|
16
|
+
EMessage2["UnableToReannotation"] = "unableToReannotation";
|
|
17
|
+
EMessage2["ForbiddenCreationOutsideBoundary"] = "ForbiddenCreationOutsideBoundary";
|
|
18
|
+
EMessage2["SuccessfulEdgeAdsorption"] = "SuccessfulEdgeAdsorption";
|
|
19
|
+
EMessage2["ForbidAddNewPoint"] = "ForbidAddNewPoint";
|
|
20
|
+
})(EMessage || (EMessage = {}));
|
|
21
|
+
|
|
22
|
+
export { EMessage };
|
|
@@ -1 +1,23 @@
|
|
|
1
|
-
import{EMessage
|
|
1
|
+
import { EMessage } from '../constants.js';
|
|
2
|
+
|
|
3
|
+
const message = {
|
|
4
|
+
[EMessage.NoRotateNotice]: "This Image contains data and cannot be rotated",
|
|
5
|
+
[EMessage.RectErrorSizeNotice]: "The drawing frame size is smaller than the minimum drawing size",
|
|
6
|
+
[EMessage.TextCheckNumberErrorNotice]: "Please enter in number-only format",
|
|
7
|
+
[EMessage.TextCheckEnglishErrorNotice]: "Please enter in English only format",
|
|
8
|
+
[EMessage.TextCheckCustomErrorNotice]: "Please enter in the required format",
|
|
9
|
+
[EMessage.UpperLimitErrorNotice]: "The number of vertices is not more than",
|
|
10
|
+
[EMessage.LowerLimitErrorNotice]: "The number of vertices is not less than",
|
|
11
|
+
[EMessage.InvalidImage]: "Invalid image, please skip this image",
|
|
12
|
+
[EMessage.DisableDelete]: "Disable delete",
|
|
13
|
+
[EMessage.ClearPartialData]: "Clear partial data",
|
|
14
|
+
[EMessage.MarkerFinish]: "ListAnnotation is finished",
|
|
15
|
+
[EMessage.LowerLimitPoint]: "The maximum number of points has been reached",
|
|
16
|
+
[EMessage.NoRotateInDependence]: "Disallow rotation in dependent cases",
|
|
17
|
+
[EMessage.UnableToReannotation]: "Unabled to reannotation",
|
|
18
|
+
[EMessage.ForbiddenCreationOutsideBoundary]: "Fobid creation outside boundary",
|
|
19
|
+
[EMessage.SuccessfulEdgeAdsorption]: "Successful edge adsorption",
|
|
20
|
+
[EMessage.ForbidAddNewPoint]: "Forbid to add new point in rect-polygon"
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { message as default };
|
package/es/locales/index.js
CHANGED
|
@@ -1 +1,17 @@
|
|
|
1
|
-
import{ELang
|
|
1
|
+
import { ELang } from '../constant/annotation.js';
|
|
2
|
+
import message$1 from './en_US/message.js';
|
|
3
|
+
import message from './zh_CN/message.js';
|
|
4
|
+
|
|
5
|
+
class Locale {
|
|
6
|
+
}
|
|
7
|
+
Locale.getMessagesByLocale = (key, locale) => {
|
|
8
|
+
switch (locale) {
|
|
9
|
+
case ELang.US:
|
|
10
|
+
return message$1[key];
|
|
11
|
+
case ELang.Zh:
|
|
12
|
+
default:
|
|
13
|
+
return message[key];
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { Locale as default };
|
|
@@ -1 +1,23 @@
|
|
|
1
|
-
import{EMessage
|
|
1
|
+
import { EMessage } from '../constants.js';
|
|
2
|
+
|
|
3
|
+
const message = {
|
|
4
|
+
[EMessage.NoRotateNotice]: "\u672C\u56FE\u542B\u6709\u6570\u636E\uFF0C\u65E0\u6CD5\u8FDB\u884C\u65CB\u8F6C",
|
|
5
|
+
[EMessage.RectErrorSizeNotice]: "\u7ED8\u5236\u6846\u5C3A\u5BF8\u5C0F\u4E8E\u6700\u5C0F\u7ED8\u5236\u5C3A\u5BF8",
|
|
6
|
+
[EMessage.TextCheckNumberErrorNotice]: "\u8BF7\u6309\u4EC5\u6570\u5B57\u7684\u683C\u5F0F\u8F93\u5165",
|
|
7
|
+
[EMessage.TextCheckEnglishErrorNotice]: "\u8BF7\u6309\u4EC5\u82F1\u6587\u7684\u683C\u5F0F\u8F93\u5165",
|
|
8
|
+
[EMessage.TextCheckCustomErrorNotice]: "\u8BF7\u6309\u8981\u6C42\u7684\u683C\u5F0F\u8F93\u5165",
|
|
9
|
+
[EMessage.UpperLimitErrorNotice]: "\u9876\u70B9\u6570\u4E0D\u591A\u4E8E",
|
|
10
|
+
[EMessage.LowerLimitErrorNotice]: "\u9876\u70B9\u6570\u4E0D\u5C11\u4E8E",
|
|
11
|
+
[EMessage.InvalidImage]: "\u65E0\u6548\u56FE\u7247\uFF0C\u8BF7\u8DF3\u8FC7\u6B64\u56FE",
|
|
12
|
+
[EMessage.DisableDelete]: "\u8BE5\u6570\u636E\u7981\u6B62\u5220\u9664",
|
|
13
|
+
[EMessage.ClearPartialData]: "\u5B58\u5728\u90E8\u5206\u6570\u636E\u65E0\u6CD5\u6E05\u9664",
|
|
14
|
+
[EMessage.MarkerFinish]: "\u5217\u8868\u6807\u6CE8\u5DF2\u5B8C\u6210",
|
|
15
|
+
[EMessage.LowerLimitPoint]: "\u5DF2\u5230\u8FBE\u6807\u70B9\u6570\u91CF\u4E0A\u9650",
|
|
16
|
+
[EMessage.NoRotateInDependence]: "\u4F9D\u8D56\u60C5\u51B5\u4E0B\u65E0\u6CD5\u8FDB\u884C\u65CB\u8F6C",
|
|
17
|
+
[EMessage.UnableToReannotation]: "\u65E0\u6CD5\u8FDB\u884C\u7EED\u6807\u64CD\u4F5C",
|
|
18
|
+
[EMessage.ForbiddenCreationOutsideBoundary]: "\u8FB9\u754C\u5916\u7981\u6B62\u521B\u5EFA",
|
|
19
|
+
[EMessage.SuccessfulEdgeAdsorption]: "\u8FB9\u7F18\u5438\u9644\u6210\u529F",
|
|
20
|
+
[EMessage.ForbidAddNewPoint]: "\u6846\u4F53\u65E0\u6CD5\u6DFB\u52A0\u70B9"
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { message as default };
|
|
@@ -1 +1,31 @@
|
|
|
1
|
-
class
|
|
1
|
+
class CanvasScheduler {
|
|
2
|
+
constructor(props) {
|
|
3
|
+
this.container = props.container;
|
|
4
|
+
}
|
|
5
|
+
createCanvas(id, options) {
|
|
6
|
+
if (typeof id !== "string") {
|
|
7
|
+
this.container.appendChild(id);
|
|
8
|
+
id.style.position = "absolute";
|
|
9
|
+
id.style.left = "0";
|
|
10
|
+
id.style.top = "0";
|
|
11
|
+
return id;
|
|
12
|
+
}
|
|
13
|
+
const canvas = document.createElement("canvas");
|
|
14
|
+
canvas.id = id;
|
|
15
|
+
if (options && options.size) {
|
|
16
|
+
canvas.width = options.size.width;
|
|
17
|
+
canvas.height = options.size.height;
|
|
18
|
+
}
|
|
19
|
+
this.container.appendChild(canvas);
|
|
20
|
+
return canvas;
|
|
21
|
+
}
|
|
22
|
+
destroyCanvas(id) {
|
|
23
|
+
const dom = document.getElementById(id);
|
|
24
|
+
if (dom) {
|
|
25
|
+
this.container.removeChild(dom);
|
|
26
|
+
}
|
|
27
|
+
return dom;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { CanvasScheduler };
|
|
@@ -1 +1,78 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
|
|
3
|
+
class ActionsHistory {
|
|
4
|
+
constructor(historyChanged) {
|
|
5
|
+
this.record = [];
|
|
6
|
+
this.recordIndex = -1;
|
|
7
|
+
this.minRecordIndex = -1;
|
|
8
|
+
this.emitHistoryChanged = () => {
|
|
9
|
+
if (this.historyChanged) {
|
|
10
|
+
const isEmit = this.constructor.name === "ActionsHistory" ? true : this.record.length > 0;
|
|
11
|
+
if (isEmit) {
|
|
12
|
+
this.historyChanged(this.undoEnabled, this.redoEnabled);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
this.historyChanged = historyChanged;
|
|
17
|
+
}
|
|
18
|
+
get undoEnabled() {
|
|
19
|
+
return this.recordIndex > this.minRecordIndex;
|
|
20
|
+
}
|
|
21
|
+
get redoEnabled() {
|
|
22
|
+
return this.recordIndex < this.record.length - 1;
|
|
23
|
+
}
|
|
24
|
+
pushHistory(action) {
|
|
25
|
+
if (this.recordIndex !== this.record.length - 1) {
|
|
26
|
+
const newRecord = this.record.slice(0, Math.min(this.recordIndex + 1, this.record.length));
|
|
27
|
+
this.record = newRecord;
|
|
28
|
+
}
|
|
29
|
+
this.record.push(_.cloneDeepWith(action));
|
|
30
|
+
this.recordIndex += 1;
|
|
31
|
+
this.emitHistoryChanged();
|
|
32
|
+
}
|
|
33
|
+
updateHistory(newRecord) {
|
|
34
|
+
this.record[this.recordIndex] = _.cloneDeep(newRecord);
|
|
35
|
+
}
|
|
36
|
+
applyAttribute(id, key, value) {
|
|
37
|
+
if (id) {
|
|
38
|
+
this.record.forEach((lines) => {
|
|
39
|
+
const line = lines.find((i) => i.id === id);
|
|
40
|
+
if (line) {
|
|
41
|
+
line[key] = value;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
undo() {
|
|
47
|
+
if (this.undoEnabled) {
|
|
48
|
+
this.recordIndex -= 1;
|
|
49
|
+
this.emitHistoryChanged();
|
|
50
|
+
return _.cloneDeep(this.record[this.recordIndex]) || [];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
redo() {
|
|
54
|
+
if (this.redoEnabled) {
|
|
55
|
+
this.recordIndex += 1;
|
|
56
|
+
this.emitHistoryChanged();
|
|
57
|
+
return _.cloneDeep(this.record[this.recordIndex]);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
init() {
|
|
61
|
+
this.record = [[]];
|
|
62
|
+
this.recordIndex = 0;
|
|
63
|
+
this.emitHistoryChanged();
|
|
64
|
+
}
|
|
65
|
+
empty() {
|
|
66
|
+
this.record = [];
|
|
67
|
+
this.recordIndex = -1;
|
|
68
|
+
this.emitHistoryChanged();
|
|
69
|
+
}
|
|
70
|
+
initRecord(data, isExitData = false) {
|
|
71
|
+
const existData = data.length > 0 || isExitData;
|
|
72
|
+
this.record = existData ? [_.cloneDeep(data)] : [];
|
|
73
|
+
this.minRecordIndex = existData ? 0 : -1;
|
|
74
|
+
this.recordIndex = 0;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export { ActionsHistory as default };
|
package/es/utils/ImgUtils.js
CHANGED
|
@@ -1 +1,21 @@
|
|
|
1
|
-
class
|
|
1
|
+
class ImgUtils {
|
|
2
|
+
static load(src) {
|
|
3
|
+
return new Promise((resolve, reject) => {
|
|
4
|
+
const imgNode = new Image();
|
|
5
|
+
imgNode.crossOrigin = "anonymous";
|
|
6
|
+
if (src.startsWith("file")) {
|
|
7
|
+
imgNode.src = encodeURI(src);
|
|
8
|
+
} else {
|
|
9
|
+
imgNode.src = src;
|
|
10
|
+
}
|
|
11
|
+
imgNode.onload = () => {
|
|
12
|
+
resolve(imgNode);
|
|
13
|
+
};
|
|
14
|
+
imgNode.onerror = () => {
|
|
15
|
+
reject(imgNode);
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { ImgUtils as default };
|