@labelbee/lb-annotation 1.14.0-alpha.3 → 1.14.0-alpha.5

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.
Files changed (188) hide show
  1. package/dist/_virtual/MathUtilsWorker.js +1 -8
  2. package/dist/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +2 -35
  3. package/dist/_virtual/filterBoxWorker.js +1 -8
  4. package/dist/_virtual/highlightWorker.js +1 -8
  5. package/dist/assets/attributeIcon/icon_canvasEdit0.svg.js +1 -5
  6. package/dist/assets/attributeIcon/icon_canvasEdit1.svg.js +1 -5
  7. package/dist/assets/attributeIcon/icon_canvasEdit2.svg.js +1 -5
  8. package/dist/assets/attributeIcon/icon_canvasEdit3.svg.js +1 -5
  9. package/dist/assets/attributeIcon/icon_canvasEdit4.svg.js +1 -5
  10. package/dist/assets/attributeIcon/icon_canvasEdit5.svg.js +1 -5
  11. package/dist/assets/attributeIcon/icon_canvasEdit6.svg.js +1 -5
  12. package/dist/assets/attributeIcon/icon_canvasEdit7.svg.js +1 -5
  13. package/dist/assets/attributeIcon/icon_canvasEdit8.svg.js +1 -5
  14. package/dist/assets/attributeIcon/icon_canvasEdit_miss.svg.js +1 -5
  15. package/dist/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -5
  16. package/dist/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -5
  17. package/dist/assets/attributeIcon/icon_cuboidMore.svg.js +5 -5
  18. package/dist/assets/attributeIcon/icon_cuboidRight.svg.js +5 -5
  19. package/dist/assets/attributeIcon/icon_cuboidTop.svg.js +12 -5
  20. package/dist/assets/attributeIcon/icon_editFEN.svg.js +1 -5
  21. package/dist/assets/attributeIcon/icon_editHUANG.svg.js +1 -5
  22. package/dist/assets/attributeIcon/icon_editLAN.svg.js +1 -5
  23. package/dist/assets/attributeIcon/icon_editLV.svg.js +1 -5
  24. package/dist/assets/attributeIcon/icon_editQING.svg.js +1 -5
  25. package/dist/constant/annotation.js +1 -127
  26. package/dist/constant/annotationTask.js +1 -30
  27. package/dist/constant/defaultConfig.js +1 -266
  28. package/dist/constant/keyCode.js +1 -38
  29. package/dist/constant/style.js +1 -98
  30. package/dist/constant/tool.js +1 -236
  31. package/dist/core/index.js +1 -150
  32. package/dist/core/pointCloud/OrbitControls.js +1 -665
  33. package/dist/core/pointCloud/PCDLoader.js +2 -260
  34. package/dist/core/pointCloud/annotation.js +1 -215
  35. package/dist/core/pointCloud/cache.js +1 -53
  36. package/dist/core/pointCloud/index.js +5 -991
  37. package/dist/core/pointCloud/matrix.js +1 -138
  38. package/dist/core/scheduler.js +1 -233
  39. package/dist/core/toolOperation/LineToolOperation.js +1 -1434
  40. package/dist/core/toolOperation/ScribbleTool.js +1 -292
  41. package/dist/core/toolOperation/TextToolOperation.js +1 -131
  42. package/dist/core/toolOperation/ViewOperation.js +1 -556
  43. package/dist/core/toolOperation/basicToolOperation.js +1 -881
  44. package/dist/core/toolOperation/checkOperation.js +1 -208
  45. package/dist/core/toolOperation/cuboidOperation.js +1 -754
  46. package/dist/core/toolOperation/cuboidToggleButtonClass.js +7 -152
  47. package/dist/core/toolOperation/eventListener.js +1 -37
  48. package/dist/core/toolOperation/measureOperation.js +1 -41
  49. package/dist/core/toolOperation/pointCloud2dOperation.js +1 -365
  50. package/dist/core/toolOperation/pointOperation.js +1 -696
  51. package/dist/core/toolOperation/polygonOperation.js +1 -1251
  52. package/dist/core/toolOperation/rectOperation.js +1 -1233
  53. package/dist/core/toolOperation/segmentByRect.js +1 -174
  54. package/dist/core/toolOperation/tagOperation.js +3 -201
  55. package/dist/core/toolOperation/textAttributeClass.js +16 -182
  56. package/dist/index.js +1 -185
  57. package/dist/locales/constants.js +1 -24
  58. package/dist/locales/en_US/message.js +1 -25
  59. package/dist/locales/index.js +1 -19
  60. package/dist/locales/zh_CN/message.js +1 -25
  61. package/dist/newCore/CanvasScheduler.js +1 -35
  62. package/dist/utils/ActionsHistory.js +1 -84
  63. package/dist/utils/ImgUtils.js +1 -23
  64. package/dist/utils/MathUtils.js +2 -385
  65. package/dist/utils/VectorUtils.js +1 -25
  66. package/dist/utils/tool/AttributeUtils.js +1 -218
  67. package/dist/utils/tool/AxisUtils.js +1 -340
  68. package/dist/utils/tool/CanvasUtils.js +1 -62
  69. package/dist/utils/tool/CommonToolUtils.js +1 -174
  70. package/dist/utils/tool/CuboidUtils.js +1 -704
  71. package/dist/utils/tool/DblClickEventListener.js +1 -102
  72. package/dist/utils/tool/DrawUtils.js +3 -492
  73. package/dist/utils/tool/EnhanceCommonToolUtils.js +1 -53
  74. package/dist/utils/tool/ImgPosUtils.js +1 -58
  75. package/dist/utils/tool/LineToolUtils.js +1 -261
  76. package/dist/utils/tool/MarkerUtils.js +1 -56
  77. package/dist/utils/tool/PolygonUtils.js +1 -460
  78. package/dist/utils/tool/RectUtils.js +1 -155
  79. package/dist/utils/tool/RenderDomClass.js +7 -57
  80. package/dist/utils/tool/RenderDomUtils.js +4 -21
  81. package/dist/utils/tool/StyleUtils.js +1 -31
  82. package/dist/utils/tool/TagUtils.js +1 -129
  83. package/dist/utils/tool/UnitUtils.js +1 -12
  84. package/dist/utils/tool/ZoomUtils.js +1 -72
  85. package/dist/utils/tool/polygonTool.js +1 -133
  86. package/dist/utils/uuid.js +1 -26
  87. package/es/_virtual/MathUtilsWorker.js +1 -6
  88. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +2 -31
  89. package/es/_virtual/filterBoxWorker.js +1 -6
  90. package/es/_virtual/highlightWorker.js +1 -6
  91. package/es/assets/attributeIcon/icon_canvasEdit0.svg.js +1 -3
  92. package/es/assets/attributeIcon/icon_canvasEdit1.svg.js +1 -3
  93. package/es/assets/attributeIcon/icon_canvasEdit2.svg.js +1 -3
  94. package/es/assets/attributeIcon/icon_canvasEdit3.svg.js +1 -3
  95. package/es/assets/attributeIcon/icon_canvasEdit4.svg.js +1 -3
  96. package/es/assets/attributeIcon/icon_canvasEdit5.svg.js +1 -3
  97. package/es/assets/attributeIcon/icon_canvasEdit6.svg.js +1 -3
  98. package/es/assets/attributeIcon/icon_canvasEdit7.svg.js +1 -3
  99. package/es/assets/attributeIcon/icon_canvasEdit8.svg.js +1 -3
  100. package/es/assets/attributeIcon/icon_canvasEdit_miss.svg.js +1 -3
  101. package/es/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -3
  102. package/es/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -3
  103. package/es/assets/attributeIcon/icon_cuboidMore.svg.js +5 -3
  104. package/es/assets/attributeIcon/icon_cuboidRight.svg.js +5 -3
  105. package/es/assets/attributeIcon/icon_cuboidTop.svg.js +12 -3
  106. package/es/assets/attributeIcon/icon_editFEN.svg.js +1 -3
  107. package/es/assets/attributeIcon/icon_editHUANG.svg.js +1 -3
  108. package/es/assets/attributeIcon/icon_editLAN.svg.js +1 -3
  109. package/es/assets/attributeIcon/icon_editLV.svg.js +1 -3
  110. package/es/assets/attributeIcon/icon_editQING.svg.js +1 -3
  111. package/es/constant/annotation.js +1 -113
  112. package/es/constant/annotationTask.js +1 -25
  113. package/es/constant/defaultConfig.js +1 -260
  114. package/es/constant/keyCode.js +1 -36
  115. package/es/constant/style.js +1 -74
  116. package/es/constant/tool.js +1 -220
  117. package/es/core/index.js +1 -148
  118. package/es/core/pointCloud/OrbitControls.js +1 -661
  119. package/es/core/pointCloud/PCDLoader.js +2 -256
  120. package/es/core/pointCloud/annotation.js +1 -211
  121. package/es/core/pointCloud/cache.js +1 -49
  122. package/es/core/pointCloud/index.js +5 -962
  123. package/es/core/pointCloud/matrix.js +1 -109
  124. package/es/core/scheduler.js +1 -228
  125. package/es/core/toolOperation/LineToolOperation.js +1 -1421
  126. package/es/core/toolOperation/ScribbleTool.js +1 -290
  127. package/es/core/toolOperation/TextToolOperation.js +1 -129
  128. package/es/core/toolOperation/ViewOperation.js +1 -549
  129. package/es/core/toolOperation/basicToolOperation.js +1 -877
  130. package/es/core/toolOperation/checkOperation.js +1 -206
  131. package/es/core/toolOperation/cuboidOperation.js +1 -752
  132. package/es/core/toolOperation/cuboidToggleButtonClass.js +7 -150
  133. package/es/core/toolOperation/eventListener.js +1 -35
  134. package/es/core/toolOperation/measureOperation.js +1 -39
  135. package/es/core/toolOperation/pointCloud2dOperation.js +1 -359
  136. package/es/core/toolOperation/pointOperation.js +1 -690
  137. package/es/core/toolOperation/polygonOperation.js +1 -1245
  138. package/es/core/toolOperation/rectOperation.js +1 -1228
  139. package/es/core/toolOperation/segmentByRect.js +1 -172
  140. package/es/core/toolOperation/tagOperation.js +3 -199
  141. package/es/core/toolOperation/textAttributeClass.js +16 -180
  142. package/es/index.js +1 -46
  143. package/es/locales/constants.js +1 -22
  144. package/es/locales/en_US/message.js +1 -23
  145. package/es/locales/index.js +1 -17
  146. package/es/locales/zh_CN/message.js +1 -23
  147. package/es/newCore/CanvasScheduler.js +1 -31
  148. package/es/utils/ActionsHistory.js +1 -78
  149. package/es/utils/ImgUtils.js +1 -21
  150. package/es/utils/MathUtils.js +2 -380
  151. package/es/utils/VectorUtils.js +1 -23
  152. package/es/utils/tool/AttributeUtils.js +1 -212
  153. package/es/utils/tool/AxisUtils.js +1 -335
  154. package/es/utils/tool/CanvasUtils.js +1 -60
  155. package/es/utils/tool/CommonToolUtils.js +1 -172
  156. package/es/utils/tool/CuboidUtils.js +1 -680
  157. package/es/utils/tool/DblClickEventListener.js +1 -100
  158. package/es/utils/tool/DrawUtils.js +3 -490
  159. package/es/utils/tool/EnhanceCommonToolUtils.js +1 -48
  160. package/es/utils/tool/ImgPosUtils.js +1 -56
  161. package/es/utils/tool/LineToolUtils.js +1 -255
  162. package/es/utils/tool/MarkerUtils.js +1 -54
  163. package/es/utils/tool/PolygonUtils.js +1 -458
  164. package/es/utils/tool/RectUtils.js +1 -153
  165. package/es/utils/tool/RenderDomClass.js +7 -55
  166. package/es/utils/tool/RenderDomUtils.js +4 -19
  167. package/es/utils/tool/StyleUtils.js +1 -29
  168. package/es/utils/tool/TagUtils.js +1 -127
  169. package/es/utils/tool/UnitUtils.js +1 -10
  170. package/es/utils/tool/ZoomUtils.js +1 -70
  171. package/es/utils/tool/polygonTool.js +1 -126
  172. package/es/utils/uuid.js +1 -24
  173. package/package.json +3 -4
  174. package/LICENSE +0 -203
  175. package/dist/core/pointCloud/segmentation.js +0 -144
  176. package/dist/core/pointCloud/selector/Sse3dLassoSelector.js +0 -26
  177. package/dist/core/pointCloud/selector/Sse3dSelector.js +0 -16
  178. package/dist/types/core/pointCloud/segmentation.d.ts +0 -0
  179. package/dist/types/core/pointCloud/selector/Sse3dLassoSelector.d.ts +0 -0
  180. package/dist/types/core/pointCloud/selector/Sse3dSelector.d.ts +0 -0
  181. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +0 -12
  182. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +0 -7
  183. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +0 -11
  184. package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +0 -18
  185. package/es/core/pointCloud/segmentation.js +0 -120
  186. package/es/core/pointCloud/selector/Sse3dLassoSelector.js +0 -24
  187. package/es/core/pointCloud/selector/Sse3dSelector.js +0 -14
  188. package/es/core/toolOperation/scribbleTool2.js +0 -249
@@ -1,249 +0,0 @@
1
- import { ImgConversionUtils } from '@labelbee/lb-utils';
2
- import AxisUtils from '../../utils/tool/AxisUtils.js';
3
- import DrawUtils from '../../utils/tool/DrawUtils.js';
4
- import { EToolName, EScribblePattern } from '../../constant/tool.js';
5
- import CommonToolUtils from '../../utils/tool/CommonToolUtils.js';
6
- import AttributeUtils from '../../utils/tool/AttributeUtils.js';
7
- import { BasicToolOperation } from './basicToolOperation.js';
8
-
9
- const DEFAULT_PEN_SIZE = 20;
10
- const DEFAULT_COLOR = "white";
11
- class ScribbleTool extends BasicToolOperation {
12
- constructor(props) {
13
- super(props);
14
- this.toolName = EToolName.ScribbleTool;
15
- this.action = EScribblePattern.Scribble;
16
- this.getOriginCoordinate = (e) => {
17
- return AxisUtils.changePointByZoom(this.getCoordinateUnderZoom(e), 1 / this.zoom);
18
- };
19
- this.onMouseDown = (e) => {
20
- if (super.onMouseDown(e) || this.forbidMouseOperation || !this.imgInfo) {
21
- return void 0;
22
- }
23
- this.initCacheCanvas(this.imgNode);
24
- this.mouseEvents("onMouseDown").call(this, e);
25
- };
26
- this.onMouseMove = (e) => {
27
- if (super.onMouseMove(e) || this.forbidMouseOperation || !this.imgInfo) {
28
- return void 0;
29
- }
30
- this.mouseEvents("onMouseMove").call(this, e);
31
- };
32
- this.onMouseUp = (e) => {
33
- if (super.onMouseUp(e) || this.forbidMouseOperation || !this.imgInfo) {
34
- return void 0;
35
- }
36
- this.mouseEvents("onMouseUp").call(this, e);
37
- };
38
- this.mouseEvents = (eventType) => {
39
- const events = {
40
- [EScribblePattern.Scribble]: {
41
- onMouseMove: this.onScribbleMove,
42
- onMouseUp: this.onScribbleEnd,
43
- onMouseDown: this.onScribbleStart
44
- },
45
- [EScribblePattern.Erase]: {
46
- onMouseMove: this.onEraseMove,
47
- onMouseUp: this.onEraseEnd,
48
- onMouseDown: this.onEraseStart
49
- }
50
- };
51
- return events[this.action][eventType];
52
- };
53
- this.setPattern = (pattern) => {
54
- this.action = pattern;
55
- };
56
- this.penSize = DEFAULT_PEN_SIZE;
57
- }
58
- get color() {
59
- var _a, _b;
60
- return (_b = (_a = this == null ? void 0 : this.defaultAttributeInfo) == null ? void 0 : _a.color) != null ? _b : DEFAULT_COLOR;
61
- }
62
- get penSizeWithZoom() {
63
- return this.penSize / this.zoom;
64
- }
65
- setPenSize(size) {
66
- this.penSize = size;
67
- }
68
- initCacheCanvas(imgNode) {
69
- if (this.cacheCanvas || !imgNode) {
70
- return;
71
- }
72
- const {canvas, ctx} = ImgConversionUtils.createCanvas(imgNode);
73
- this.cacheCanvas = canvas;
74
- this.cacheContext = ctx;
75
- }
76
- updateCacheCanvasSize(imgNode) {
77
- if (this.cacheCanvas) {
78
- this.cacheCanvas.width = imgNode.width;
79
- this.cacheCanvas.height = imgNode.height;
80
- }
81
- }
82
- updateUrl2CacheContext(url) {
83
- ImgConversionUtils.createImgDom(url).then((img) => {
84
- if (!this.cacheContext) {
85
- this.initCacheCanvas(img);
86
- }
87
- if (this.cacheContext) {
88
- this.cacheContext.save();
89
- this.clearResult();
90
- this.cacheContext.drawImage(img, 0, 0, img.width, img.height);
91
- this.cacheContext.restore();
92
- this.render();
93
- }
94
- });
95
- }
96
- setImgNode(imgNode, basicImgInfo) {
97
- super.setImgNode(imgNode, basicImgInfo);
98
- if (this.cacheCanvas) {
99
- this.updateCacheCanvasSize(imgNode);
100
- } else {
101
- this.initCacheCanvas(imgNode);
102
- }
103
- }
104
- setResult(data) {
105
- var _a;
106
- const {url} = (_a = data == null ? void 0 : data[0]) != null ? _a : {};
107
- this.history.initRecord([url], !!url);
108
- this.clearResult();
109
- if (!url) {
110
- this.render();
111
- return;
112
- }
113
- this.updateUrl2CacheContext(url);
114
- }
115
- onKeyDown(e) {
116
- if (!CommonToolUtils.hotkeyFilter(e) || super.onKeyDown(e) === false) {
117
- return;
118
- }
119
- const {keyCode} = e;
120
- const keyCode2Attribute = AttributeUtils.getAttributeByKeycode(keyCode, this.config.attributeList);
121
- if (keyCode2Attribute !== void 0) {
122
- this.setDefaultAttribute(keyCode2Attribute);
123
- }
124
- }
125
- eventBinding() {
126
- super.eventBinding();
127
- }
128
- setDefaultAttribute(attributeValue) {
129
- const attributeInfo = this.config.attributeList.find((v) => v.value === attributeValue);
130
- if (attributeInfo) {
131
- this.defaultAttribute = attributeInfo.value;
132
- this.defaultAttributeInfo = attributeInfo;
133
- this.emit("changeAttributeSidebar");
134
- this.render();
135
- }
136
- }
137
- clearStatusAfterLeave() {
138
- this.onScribbleEnd();
139
- this.startPoint = void 0;
140
- }
141
- onMouseLeave() {
142
- super.onMouseLeave();
143
- this.clearStatusAfterLeave();
144
- }
145
- onScribbleStart(e) {
146
- if (!this.cacheContext) {
147
- return;
148
- }
149
- this.cacheContext.save();
150
- this.cacheContext.beginPath();
151
- this.cacheContext.strokeStyle = this.color;
152
- this.cacheContext.lineWidth = this.penSizeWithZoom;
153
- this.cacheContext.lineCap = "round";
154
- this.cacheContext.lineJoin = "round";
155
- const originCoordinate = AxisUtils.changePointByZoom(this.getCoordinateUnderZoom(e), 1 / this.zoom);
156
- this.cacheContext.moveTo(originCoordinate.x, originCoordinate.y);
157
- this.startPoint = originCoordinate;
158
- }
159
- onScribbleMove(e) {
160
- if (e.buttons === 1 && this.cacheContext && this.startPoint) {
161
- const originCoordinate = this.getOriginCoordinate(e);
162
- this.cacheContext.lineTo(originCoordinate.x, originCoordinate.y);
163
- this.cacheContext.stroke();
164
- }
165
- }
166
- onScribbleEnd() {
167
- var _a, _b, _c;
168
- if (this.startPoint) {
169
- (_a = this.cacheContext) == null ? void 0 : _a.closePath();
170
- (_b = this.cacheContext) == null ? void 0 : _b.restore();
171
- this.startPoint = void 0;
172
- this.history.pushHistory((_c = this.cacheCanvas) == null ? void 0 : _c.toDataURL("image/png", 0));
173
- }
174
- }
175
- eraseArc(e) {
176
- var _a;
177
- if (this.cacheContext) {
178
- const originCoordinate = this.getOriginCoordinate(e);
179
- this.cacheContext.save();
180
- this.cacheContext.beginPath();
181
- this.cacheContext.arc(originCoordinate.x, originCoordinate.y, this.penSizeWithZoom / 2, 0, Math.PI * 2, false);
182
- this.cacheContext.clip();
183
- this.cacheContext.clearRect(0, 0, this.cacheContext.canvas.width, this.cacheContext.canvas.height);
184
- (_a = this.cacheContext) == null ? void 0 : _a.restore();
185
- }
186
- }
187
- onEraseStart(e) {
188
- if (!this.cacheContext || e.buttons !== 1) {
189
- return;
190
- }
191
- this.eraseArc(e);
192
- }
193
- onEraseMove(e) {
194
- if (!this.cacheContext || e.buttons !== 1) {
195
- return;
196
- }
197
- this.eraseArc(e);
198
- }
199
- onEraseEnd() {
200
- }
201
- exportData() {
202
- var _a;
203
- const imgBase64 = (_a = this.cacheCanvas) == null ? void 0 : _a.toDataURL("image/png", 0);
204
- return [[], this.basicImgInfo, {imgBase64}];
205
- }
206
- clearCacheCanvas() {
207
- var _a;
208
- (_a = this.cacheContext) == null ? void 0 : _a.clearRect(0, 0, this.cacheContext.canvas.width, this.cacheContext.canvas.height);
209
- this.render();
210
- }
211
- clearResult() {
212
- this.clearCacheCanvas();
213
- }
214
- renderPoint(radius) {
215
- DrawUtils.drawCircleWithFill(this.canvas, this.coord, radius, {color: this.color});
216
- }
217
- render() {
218
- super.render();
219
- if (!this.ctx || !this.cacheCanvas) {
220
- return;
221
- }
222
- this.ctx.save();
223
- this.ctx.globalAlpha = 0.5;
224
- DrawUtils.drawImg(this.canvas, this.cacheCanvas, {
225
- zoom: this.zoom,
226
- currentPos: this.currentPos,
227
- rotate: this.rotate
228
- });
229
- this.ctx.restore();
230
- if (this.forbidOperation || this.forbidCursorLine) {
231
- return;
232
- }
233
- this.renderPoint(this.penSize / 2);
234
- }
235
- undo() {
236
- const url = this.history.undo();
237
- if (url && this.cacheCanvas) {
238
- this.updateUrl2CacheContext(url);
239
- }
240
- }
241
- redo() {
242
- const url = this.history.redo();
243
- if (url && this.cacheCanvas) {
244
- this.updateUrl2CacheContext(url);
245
- }
246
- }
247
- }
248
-
249
- export { ScribbleTool as default };