@labelbee/lb-annotation 1.14.0-alpha.3 → 1.14.0-alpha.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.
- package/dist/_virtual/MathUtilsWorker.js +1 -8
- package/dist/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +2 -35
- package/dist/_virtual/filterBoxWorker.js +1 -8
- package/dist/_virtual/highlightWorker.js +1 -8
- package/dist/assets/attributeIcon/icon_canvasEdit0.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit1.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit2.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit3.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit4.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit5.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit6.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit7.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit8.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_canvasEdit_miss.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -5
- package/dist/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -5
- 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 +12 -5
- package/dist/assets/attributeIcon/icon_editFEN.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_editHUANG.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_editLAN.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_editLV.svg.js +1 -5
- package/dist/assets/attributeIcon/icon_editQING.svg.js +1 -5
- package/dist/constant/annotation.js +1 -127
- package/dist/constant/annotationTask.js +1 -30
- package/dist/constant/defaultConfig.js +1 -266
- package/dist/constant/keyCode.js +1 -38
- package/dist/constant/style.js +1 -98
- package/dist/constant/tool.js +1 -236
- package/dist/core/index.js +1 -150
- package/dist/core/pointCloud/OrbitControls.js +1 -665
- package/dist/core/pointCloud/PCDLoader.js +2 -260
- package/dist/core/pointCloud/annotation.js +1 -215
- package/dist/core/pointCloud/cache.js +1 -53
- package/dist/core/pointCloud/index.js +5 -991
- package/dist/core/pointCloud/matrix.js +1 -138
- package/dist/core/scheduler.js +1 -233
- package/dist/core/toolOperation/LineToolOperation.js +1 -1434
- package/dist/core/toolOperation/ScribbleTool.js +1 -292
- package/dist/core/toolOperation/TextToolOperation.js +1 -131
- package/dist/core/toolOperation/ViewOperation.js +1 -556
- package/dist/core/toolOperation/basicToolOperation.js +1 -881
- package/dist/core/toolOperation/checkOperation.js +1 -208
- package/dist/core/toolOperation/cuboidOperation.js +1 -754
- package/dist/core/toolOperation/cuboidToggleButtonClass.js +7 -152
- package/dist/core/toolOperation/eventListener.js +1 -37
- package/dist/core/toolOperation/measureOperation.js +1 -41
- package/dist/core/toolOperation/pointCloud2dOperation.js +1 -365
- package/dist/core/toolOperation/pointOperation.js +1 -696
- package/dist/core/toolOperation/polygonOperation.js +1 -1251
- package/dist/core/toolOperation/rectOperation.js +1 -1233
- package/dist/core/toolOperation/segmentByRect.js +1 -174
- package/dist/core/toolOperation/tagOperation.js +3 -201
- package/dist/core/toolOperation/textAttributeClass.js +16 -182
- package/dist/index.js +1 -185
- package/dist/locales/constants.js +1 -24
- package/dist/locales/en_US/message.js +1 -25
- package/dist/locales/index.js +1 -19
- package/dist/locales/zh_CN/message.js +1 -25
- package/dist/newCore/CanvasScheduler.js +1 -35
- package/dist/types/core/pointCloud/index.d.ts +2 -2
- package/dist/utils/ActionsHistory.js +1 -84
- package/dist/utils/ImgUtils.js +1 -23
- package/dist/utils/MathUtils.js +2 -385
- package/dist/utils/VectorUtils.js +1 -25
- package/dist/utils/tool/AttributeUtils.js +1 -218
- package/dist/utils/tool/AxisUtils.js +1 -340
- package/dist/utils/tool/CanvasUtils.js +1 -62
- package/dist/utils/tool/CommonToolUtils.js +1 -174
- package/dist/utils/tool/CuboidUtils.js +1 -704
- package/dist/utils/tool/DblClickEventListener.js +1 -102
- package/dist/utils/tool/DrawUtils.js +3 -492
- package/dist/utils/tool/EnhanceCommonToolUtils.js +1 -53
- package/dist/utils/tool/ImgPosUtils.js +1 -58
- package/dist/utils/tool/LineToolUtils.js +1 -261
- package/dist/utils/tool/MarkerUtils.js +1 -56
- package/dist/utils/tool/PolygonUtils.js +1 -460
- package/dist/utils/tool/RectUtils.js +1 -155
- package/dist/utils/tool/RenderDomClass.js +7 -57
- package/dist/utils/tool/RenderDomUtils.js +4 -21
- package/dist/utils/tool/StyleUtils.js +1 -31
- package/dist/utils/tool/TagUtils.js +1 -129
- package/dist/utils/tool/UnitUtils.js +1 -12
- package/dist/utils/tool/ZoomUtils.js +1 -72
- package/dist/utils/tool/polygonTool.js +1 -133
- package/dist/utils/uuid.js +1 -26
- package/es/_virtual/MathUtilsWorker.js +1 -6
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +2 -31
- package/es/_virtual/filterBoxWorker.js +1 -6
- package/es/_virtual/highlightWorker.js +1 -6
- package/es/assets/attributeIcon/icon_canvasEdit0.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit1.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit2.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit3.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit4.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit5.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit6.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit7.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit8.svg.js +1 -3
- package/es/assets/attributeIcon/icon_canvasEdit_miss.svg.js +1 -3
- package/es/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -3
- package/es/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -3
- package/es/assets/attributeIcon/icon_cuboidMore.svg.js +5 -3
- package/es/assets/attributeIcon/icon_cuboidRight.svg.js +5 -3
- package/es/assets/attributeIcon/icon_cuboidTop.svg.js +12 -3
- package/es/assets/attributeIcon/icon_editFEN.svg.js +1 -3
- package/es/assets/attributeIcon/icon_editHUANG.svg.js +1 -3
- package/es/assets/attributeIcon/icon_editLAN.svg.js +1 -3
- package/es/assets/attributeIcon/icon_editLV.svg.js +1 -3
- package/es/assets/attributeIcon/icon_editQING.svg.js +1 -3
- package/es/constant/annotation.js +1 -113
- package/es/constant/annotationTask.js +1 -25
- package/es/constant/defaultConfig.js +1 -260
- package/es/constant/keyCode.js +1 -36
- package/es/constant/style.js +1 -74
- package/es/constant/tool.js +1 -220
- package/es/core/index.js +1 -148
- package/es/core/pointCloud/OrbitControls.js +1 -661
- package/es/core/pointCloud/PCDLoader.js +2 -256
- package/es/core/pointCloud/annotation.js +1 -211
- package/es/core/pointCloud/cache.js +1 -49
- package/es/core/pointCloud/index.js +5 -962
- package/es/core/pointCloud/matrix.js +1 -109
- package/es/core/scheduler.js +1 -228
- package/es/core/toolOperation/LineToolOperation.js +1 -1421
- package/es/core/toolOperation/ScribbleTool.js +1 -290
- package/es/core/toolOperation/TextToolOperation.js +1 -129
- package/es/core/toolOperation/ViewOperation.js +1 -549
- package/es/core/toolOperation/basicToolOperation.js +1 -877
- package/es/core/toolOperation/checkOperation.js +1 -206
- package/es/core/toolOperation/cuboidOperation.js +1 -752
- package/es/core/toolOperation/cuboidToggleButtonClass.js +7 -150
- package/es/core/toolOperation/eventListener.js +1 -35
- package/es/core/toolOperation/measureOperation.js +1 -39
- package/es/core/toolOperation/pointCloud2dOperation.js +1 -359
- package/es/core/toolOperation/pointOperation.js +1 -690
- package/es/core/toolOperation/polygonOperation.js +1 -1245
- package/es/core/toolOperation/rectOperation.js +1 -1228
- package/es/core/toolOperation/segmentByRect.js +1 -172
- package/es/core/toolOperation/tagOperation.js +3 -199
- package/es/core/toolOperation/textAttributeClass.js +16 -180
- package/es/index.js +1 -46
- package/es/locales/constants.js +1 -22
- package/es/locales/en_US/message.js +1 -23
- package/es/locales/index.js +1 -17
- package/es/locales/zh_CN/message.js +1 -23
- package/es/newCore/CanvasScheduler.js +1 -31
- package/es/utils/ActionsHistory.js +1 -78
- package/es/utils/ImgUtils.js +1 -21
- package/es/utils/MathUtils.js +2 -380
- package/es/utils/VectorUtils.js +1 -23
- package/es/utils/tool/AttributeUtils.js +1 -212
- package/es/utils/tool/AxisUtils.js +1 -335
- package/es/utils/tool/CanvasUtils.js +1 -60
- package/es/utils/tool/CommonToolUtils.js +1 -172
- package/es/utils/tool/CuboidUtils.js +1 -680
- package/es/utils/tool/DblClickEventListener.js +1 -100
- package/es/utils/tool/DrawUtils.js +3 -490
- package/es/utils/tool/EnhanceCommonToolUtils.js +1 -48
- package/es/utils/tool/ImgPosUtils.js +1 -56
- package/es/utils/tool/LineToolUtils.js +1 -255
- package/es/utils/tool/MarkerUtils.js +1 -54
- package/es/utils/tool/PolygonUtils.js +1 -458
- package/es/utils/tool/RectUtils.js +1 -153
- package/es/utils/tool/RenderDomClass.js +7 -55
- package/es/utils/tool/RenderDomUtils.js +4 -19
- package/es/utils/tool/StyleUtils.js +1 -29
- package/es/utils/tool/TagUtils.js +1 -127
- package/es/utils/tool/UnitUtils.js +1 -10
- package/es/utils/tool/ZoomUtils.js +1 -70
- package/es/utils/tool/polygonTool.js +1 -126
- package/es/utils/uuid.js +1 -24
- package/package.json +3 -4
- package/LICENSE +0 -203
- package/dist/core/pointCloud/segmentation.js +0 -144
- package/dist/core/pointCloud/selector/Sse3dLassoSelector.js +0 -26
- package/dist/core/pointCloud/selector/Sse3dSelector.js +0 -16
- 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/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +0 -12
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +0 -7
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +0 -11
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +0 -18
- package/es/core/pointCloud/segmentation.js +0 -120
- package/es/core/pointCloud/selector/Sse3dLassoSelector.js +0 -24
- package/es/core/pointCloud/selector/Sse3dSelector.js +0 -14
- package/es/core/toolOperation/scribbleTool2.js +0 -249
|
@@ -1,172 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import AxisUtils from '../../utils/tool/AxisUtils.js';
|
|
3
|
-
import { RectOperation } from './rectOperation.js';
|
|
4
|
-
import EKeyCode from '../../constant/keyCode.js';
|
|
5
|
-
|
|
6
|
-
var __async = (__this, __arguments, generator) => {
|
|
7
|
-
return new Promise((resolve, reject) => {
|
|
8
|
-
var fulfilled = (value) => {
|
|
9
|
-
try {
|
|
10
|
-
step(generator.next(value));
|
|
11
|
-
} catch (e) {
|
|
12
|
-
reject(e);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
var rejected = (value) => {
|
|
16
|
-
try {
|
|
17
|
-
step(generator.throw(value));
|
|
18
|
-
} catch (e) {
|
|
19
|
-
reject(e);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
23
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
class SegmentByRect extends RectOperation {
|
|
27
|
-
constructor(props) {
|
|
28
|
-
super(props);
|
|
29
|
-
this.onKeydown = (e) => {
|
|
30
|
-
switch (e.keyCode) {
|
|
31
|
-
case EKeyCode.Esc:
|
|
32
|
-
e.preventDefault();
|
|
33
|
-
e.stopPropagation();
|
|
34
|
-
this.clearPredictionInfo();
|
|
35
|
-
break;
|
|
36
|
-
case EKeyCode.Z:
|
|
37
|
-
if (e.ctrlKey) {
|
|
38
|
-
e.preventDefault();
|
|
39
|
-
e.stopPropagation();
|
|
40
|
-
this.rectList = [];
|
|
41
|
-
this.render();
|
|
42
|
-
}
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
this.segmentPrediction = (e) => __async(this, null, function* () {
|
|
47
|
-
const coord = this.getCoordinateUnderZoom(e);
|
|
48
|
-
this.isRunSegment = true;
|
|
49
|
-
this.render();
|
|
50
|
-
if (!this.runPrediction) {
|
|
51
|
-
this.emit("messageError", "You needs to set runPrediction function");
|
|
52
|
-
this.clearPredictionInfo();
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
yield this.runPrediction({
|
|
56
|
-
point: coord,
|
|
57
|
-
rect: {
|
|
58
|
-
x: this.rectList[0].x,
|
|
59
|
-
y: this.rectList[0].y,
|
|
60
|
-
w: this.rectList[0].width,
|
|
61
|
-
h: this.rectList[0].height
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
this.clearPredictionInfo();
|
|
65
|
-
});
|
|
66
|
-
this.isRunSegment = false;
|
|
67
|
-
this.runPrediction = props.runPrediction;
|
|
68
|
-
}
|
|
69
|
-
setRunPrediction(runPrediction) {
|
|
70
|
-
this.runPrediction = runPrediction;
|
|
71
|
-
}
|
|
72
|
-
eventBinding() {
|
|
73
|
-
document.addEventListener("keydown", (e) => this.onKeydown(e));
|
|
74
|
-
super.eventBinding();
|
|
75
|
-
}
|
|
76
|
-
clearPredictionInfo() {
|
|
77
|
-
this.rectList = [];
|
|
78
|
-
this.isShowCursor = false;
|
|
79
|
-
this.coord = {x: -1, y: -1};
|
|
80
|
-
this.drawingRect = void 0;
|
|
81
|
-
this.isRunSegment = false;
|
|
82
|
-
this.clearCanvas();
|
|
83
|
-
this.render();
|
|
84
|
-
}
|
|
85
|
-
onMouseUp(e) {
|
|
86
|
-
if (this.isRunSegment) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
if (e.button === 0 && this.rectList.length === 1 && !this.isRunSegment) {
|
|
90
|
-
e.stopPropagation();
|
|
91
|
-
this.segmentPrediction(e);
|
|
92
|
-
this.clearActiveStatus();
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
super.onMouseUp(e);
|
|
96
|
-
return void 0;
|
|
97
|
-
}
|
|
98
|
-
onMouseDown(e) {
|
|
99
|
-
if (this.isRunSegment) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
super.onMouseDown(e);
|
|
103
|
-
return void 0;
|
|
104
|
-
}
|
|
105
|
-
renderCursorLine() {
|
|
106
|
-
var _a;
|
|
107
|
-
if (!this.ctx) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
const {ctx} = this;
|
|
111
|
-
const padding = 10;
|
|
112
|
-
const lineWidth = 1;
|
|
113
|
-
const {x, y} = this.coord;
|
|
114
|
-
ctx.save();
|
|
115
|
-
ctx.strokeStyle = "white";
|
|
116
|
-
ctx.setLineDash([6]);
|
|
117
|
-
ctx.lineWidth = lineWidth;
|
|
118
|
-
ctx.strokeRect(x - padding, y - padding, padding * 2, padding * 2);
|
|
119
|
-
ctx.restore();
|
|
120
|
-
let text = `\u2460 ${i18n.t("FramingOfObjectToBeDivided")}`;
|
|
121
|
-
const isEn = i18n.language === "en";
|
|
122
|
-
let rectWidth = isEn ? 326 : 186;
|
|
123
|
-
if (((_a = this.rectList) == null ? void 0 : _a.length) === 1) {
|
|
124
|
-
text = `\u2461 ${i18n.t("ClickOnTarget")}`;
|
|
125
|
-
rectWidth = isEn ? 232 : 142;
|
|
126
|
-
const radius = 2;
|
|
127
|
-
ctx.save();
|
|
128
|
-
ctx.strokeStyle = "white";
|
|
129
|
-
const margin = lineWidth + padding;
|
|
130
|
-
ctx.beginPath();
|
|
131
|
-
ctx.moveTo(x + margin + radius * 2, y + margin + radius);
|
|
132
|
-
ctx.arc(x + margin + radius, y + margin + radius, radius, 0, Math.PI * 2, true);
|
|
133
|
-
ctx.stroke();
|
|
134
|
-
ctx.restore();
|
|
135
|
-
}
|
|
136
|
-
if (this.isRunSegment) {
|
|
137
|
-
rectWidth = isEn ? 316 : 136;
|
|
138
|
-
text = i18n.t("SplittingAlgorithmPrediction");
|
|
139
|
-
}
|
|
140
|
-
ctx.save();
|
|
141
|
-
ctx.fillStyle = this.style.strokeColor;
|
|
142
|
-
ctx.fillRect(x + padding, y - padding * 4 - 1, rectWidth, 32);
|
|
143
|
-
ctx.restore();
|
|
144
|
-
ctx.save();
|
|
145
|
-
ctx.font = "14px Source Han Sans CN";
|
|
146
|
-
ctx.fillStyle = "white";
|
|
147
|
-
ctx.fillText(text, x + padding + 14, y - padding * 2);
|
|
148
|
-
ctx.restore();
|
|
149
|
-
super.renderCursorLine();
|
|
150
|
-
}
|
|
151
|
-
renderDrawingRect(rect, zoom, isZoom = false) {
|
|
152
|
-
if (this.ctx && rect) {
|
|
153
|
-
const transformRect = AxisUtils.changeRectByZoom(rect, isZoom ? zoom : this.zoom, this.currentPos);
|
|
154
|
-
const {x, y, width, height} = transformRect;
|
|
155
|
-
this.ctx.save();
|
|
156
|
-
this.ctx.lineCap = "butt";
|
|
157
|
-
this.ctx.lineWidth = this.style.strokeWidth;
|
|
158
|
-
this.ctx.strokeStyle = "white";
|
|
159
|
-
this.ctx.strokeRect(x, y, width, height);
|
|
160
|
-
this.ctx.strokeStyle = this.style.strokeColor;
|
|
161
|
-
this.ctx.setLineDash([6]);
|
|
162
|
-
this.ctx.strokeRect(x, y, width, height);
|
|
163
|
-
this.ctx.restore();
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
renderTextAttribute() {
|
|
167
|
-
}
|
|
168
|
-
renderSelectedRect() {
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export { SegmentByRect as default };
|
|
1
|
+
import{i18n as d}from"@labelbee/lb-utils";import m from"../../utils/tool/AxisUtils.js";import{RectOperation as g}from"./rectOperation.js";import f from"../../constant/keyCode.js";var p=(u,e,t)=>new Promise((i,c)=>{var r=s=>{try{o(t.next(s))}catch(h){c(h)}},n=s=>{try{o(t.throw(s))}catch(h){c(h)}},o=s=>s.done?i(s.value):Promise.resolve(s.value).then(r,n);o((t=t.apply(u,e)).next())});class y extends g{constructor(e){super(e);this.onKeydown=t=>{switch(t.keyCode){case f.Esc:t.preventDefault(),t.stopPropagation(),this.clearPredictionInfo();break;case f.Z:t.ctrlKey&&(t.preventDefault(),t.stopPropagation(),this.rectList=[],this.render());break}},this.segmentPrediction=t=>p(this,null,function*(){const i=this.getCoordinateUnderZoom(t);if(this.isRunSegment=!0,this.render(),!this.runPrediction){this.emit("messageError","You needs to set runPrediction function"),this.clearPredictionInfo();return}yield this.runPrediction({point:i,rect:{x:this.rectList[0].x,y:this.rectList[0].y,w:this.rectList[0].width,h:this.rectList[0].height}}),this.clearPredictionInfo()}),this.isRunSegment=!1,this.runPrediction=e.runPrediction}setRunPrediction(e){this.runPrediction=e}eventBinding(){document.addEventListener("keydown",e=>this.onKeydown(e)),super.eventBinding()}clearPredictionInfo(){this.rectList=[],this.isShowCursor=!1,this.coord={x:-1,y:-1},this.drawingRect=void 0,this.isRunSegment=!1,this.clearCanvas(),this.render()}onMouseUp(e){if(!this.isRunSegment){if(e.button===0&&this.rectList.length===1&&!this.isRunSegment){e.stopPropagation(),this.segmentPrediction(e),this.clearActiveStatus();return}super.onMouseUp(e)}}onMouseDown(e){this.isRunSegment||super.onMouseDown(e)}renderCursorLine(){var e;if(!this.ctx)return;const{ctx:t}=this,i=10,c=1,{x:r,y:n}=this.coord;t.save(),t.strokeStyle="white",t.setLineDash([6]),t.lineWidth=c,t.strokeRect(r-i,n-i,i*2,i*2),t.restore();let o=`\u2460 ${d.t("FramingOfObjectToBeDivided")}`;const s=d.language==="en";let h=s?326:186;if(((e=this.rectList)==null?void 0:e.length)===1){o=`\u2461 ${d.t("ClickOnTarget")}`,h=s?232:142;const a=2;t.save(),t.strokeStyle="white";const l=c+i;t.beginPath(),t.moveTo(r+l+a*2,n+l+a),t.arc(r+l+a,n+l+a,a,0,Math.PI*2,!0),t.stroke(),t.restore()}this.isRunSegment&&(h=s?316:136,o=d.t("SplittingAlgorithmPrediction")),t.save(),t.fillStyle=this.style.strokeColor,t.fillRect(r+i,n-i*4-1,h,32),t.restore(),t.save(),t.font="14px Source Han Sans CN",t.fillStyle="white",t.fillText(o,r+i+14,n-i*2),t.restore(),super.renderCursorLine()}renderDrawingRect(e,t,i=!1){if(this.ctx&&e){const c=m.changeRectByZoom(e,i?t:this.zoom,this.currentPos),{x:r,y:n,width:o,height:s}=c;this.ctx.save(),this.ctx.lineCap="butt",this.ctx.lineWidth=this.style.strokeWidth,this.ctx.strokeStyle="white",this.ctx.strokeRect(r,n,o,s),this.ctx.strokeStyle=this.style.strokeColor,this.ctx.setLineDash([6]),this.ctx.strokeRect(r,n,o,s),this.ctx.restore()}}renderTextAttribute(){}renderSelectedRect(){}}export{y as default};
|
|
@@ -1,184 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import uuid from '../../utils/uuid.js';
|
|
4
|
-
import { BasicToolOperation } from './basicToolOperation.js';
|
|
5
|
-
|
|
6
|
-
class TagOperation extends BasicToolOperation {
|
|
7
|
-
constructor(props) {
|
|
8
|
-
super(props);
|
|
9
|
-
this.getInitResultList = (dataSourceStep, basicResultList) => {
|
|
10
|
-
if (!(dataSourceStep === 0 || dataSourceStep === void 0) && basicResultList.length === 0) {
|
|
11
|
-
return [];
|
|
12
|
-
}
|
|
13
|
-
return TagUtil.getDefaultTagResult(this.config.inputList, basicResultList);
|
|
14
|
-
};
|
|
15
|
-
this.setLabel = (i, j) => {
|
|
16
|
-
var _a, _b;
|
|
17
|
-
if (this.isImgError) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
if (!this.basicResult && this.dependToolName) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const labelInfoSet = this.config.inputList;
|
|
24
|
-
if (!labelInfoSet[i]) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
const {subSelected} = labelInfoSet[i];
|
|
28
|
-
if (i < labelInfoSet.length && labelInfoSet[i].subSelected && subSelected && j < subSelected.length) {
|
|
29
|
-
const key = labelInfoSet[i].value;
|
|
30
|
-
let value = (_a = subSelected[j]) == null ? void 0 : _a.value;
|
|
31
|
-
const isMulti = (_b = labelInfoSet[i]) == null ? void 0 : _b.isMulti;
|
|
32
|
-
const basicTagResult = this.tagResult.filter((v) => {
|
|
33
|
-
const basicSourceID = `${v.sourceID}`;
|
|
34
|
-
return CommonToolUtils.isSameSourceID(basicSourceID, this.sourceID);
|
|
35
|
-
})[0];
|
|
36
|
-
if (basicTagResult) {
|
|
37
|
-
let times = 0;
|
|
38
|
-
const {result} = basicTagResult;
|
|
39
|
-
if (basicTagResult.sourceID === 0) {
|
|
40
|
-
basicTagResult.sourceID = "0";
|
|
41
|
-
}
|
|
42
|
-
for (const oldKey in basicTagResult.result) {
|
|
43
|
-
if (oldKey === labelInfoSet[i].value) {
|
|
44
|
-
times++;
|
|
45
|
-
if (isMulti === true) {
|
|
46
|
-
const keyList = result[oldKey].split(";").filter((v) => v !== "");
|
|
47
|
-
const index = keyList.indexOf(value);
|
|
48
|
-
if (index === -1) {
|
|
49
|
-
keyList.push(value);
|
|
50
|
-
} else {
|
|
51
|
-
keyList.splice(index, 1);
|
|
52
|
-
}
|
|
53
|
-
value = keyList.join(";");
|
|
54
|
-
}
|
|
55
|
-
if (value === "") {
|
|
56
|
-
if (Object.keys(result).length === 1) {
|
|
57
|
-
this.tagResult = this.tagResult.filter((v) => {
|
|
58
|
-
const basicSourceID = `${v.sourceID}`;
|
|
59
|
-
return CommonToolUtils.isDifferSourceID(basicSourceID, this.sourceID);
|
|
60
|
-
});
|
|
61
|
-
} else if (Object.keys(result).length > 1) {
|
|
62
|
-
delete result[oldKey];
|
|
63
|
-
}
|
|
64
|
-
} else {
|
|
65
|
-
result[oldKey] = value;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (times === 0) {
|
|
70
|
-
Object.assign(basicTagResult.result, {[key]: value});
|
|
71
|
-
}
|
|
72
|
-
} else {
|
|
73
|
-
this.tagResult = [
|
|
74
|
-
{
|
|
75
|
-
sourceID: this.sourceID,
|
|
76
|
-
id: uuid(8, 62),
|
|
77
|
-
result: {
|
|
78
|
-
[key]: value
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
];
|
|
82
|
-
}
|
|
83
|
-
this.render();
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
this.clearResult = (sendMessage = true, value) => {
|
|
87
|
-
if (value) {
|
|
88
|
-
this.tagResult = this.tagResult.map((v) => {
|
|
89
|
-
if (v == null ? void 0 : v.result[value]) {
|
|
90
|
-
delete v.result[value];
|
|
91
|
-
}
|
|
92
|
-
return v;
|
|
93
|
-
});
|
|
94
|
-
} else {
|
|
95
|
-
this.tagResult = [];
|
|
96
|
-
}
|
|
97
|
-
this.render();
|
|
98
|
-
};
|
|
99
|
-
this.config = CommonToolUtils.jsonParser(props.config);
|
|
100
|
-
this.tagResult = [];
|
|
101
|
-
this.labelSelectedList = [];
|
|
102
|
-
this.setShowDefaultCursor(true);
|
|
103
|
-
}
|
|
104
|
-
destroy() {
|
|
105
|
-
this.clearTag();
|
|
106
|
-
super.destroy();
|
|
107
|
-
}
|
|
108
|
-
setResult(tagResult) {
|
|
109
|
-
this.tagResult = tagResult;
|
|
110
|
-
this.render();
|
|
111
|
-
}
|
|
112
|
-
get currentPageResult() {
|
|
113
|
-
return [this.currentTagResult];
|
|
114
|
-
}
|
|
115
|
-
get currentTagResult() {
|
|
116
|
-
var _a;
|
|
117
|
-
return (_a = this.tagResult.filter((v) => {
|
|
118
|
-
const basicSourceID = `${v.sourceID}`;
|
|
119
|
-
return CommonToolUtils.isSameSourceID(basicSourceID, this.sourceID);
|
|
120
|
-
})[0]) != null ? _a : {};
|
|
121
|
-
}
|
|
122
|
-
get sourceID() {
|
|
123
|
-
return CommonToolUtils.getSourceID(this.basicResult);
|
|
124
|
-
}
|
|
125
|
-
onKeyDown(e) {
|
|
126
|
-
if (!CommonToolUtils.hotkeyFilter(e) || super.onKeyDown(e) === false) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
let {keyCode} = e;
|
|
130
|
-
if (keyCode) {
|
|
131
|
-
if (keyCode <= 57 && keyCode >= 49 || keyCode <= 105 && keyCode >= 97) {
|
|
132
|
-
if (keyCode > 57) {
|
|
133
|
-
keyCode -= 97;
|
|
134
|
-
} else {
|
|
135
|
-
keyCode -= 49;
|
|
136
|
-
}
|
|
137
|
-
if (this.config.inputList.length === 1) {
|
|
138
|
-
this.labelSelectedList = [0, keyCode];
|
|
139
|
-
this.setLabel(0, keyCode);
|
|
140
|
-
setTimeout(() => {
|
|
141
|
-
this.labelSelectedList = [];
|
|
142
|
-
this.render();
|
|
143
|
-
}, 500);
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
if (this.labelSelectedList.length === 1) {
|
|
147
|
-
this.labelSelectedList = [this.labelSelectedList[0], keyCode];
|
|
148
|
-
this.setLabel(this.labelSelectedList[0], keyCode);
|
|
149
|
-
setTimeout(() => {
|
|
150
|
-
this.labelSelectedList = [];
|
|
151
|
-
this.render();
|
|
152
|
-
}, 500);
|
|
153
|
-
} else {
|
|
154
|
-
this.labelSelectedList = [keyCode];
|
|
155
|
-
this.emit("expend");
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
clearTag() {
|
|
161
|
-
var _a;
|
|
162
|
-
const parentNode = (_a = this.canvas) == null ? void 0 : _a.parentNode;
|
|
163
|
-
const oldDom = window.self.document.getElementById("tagToolTag");
|
|
164
|
-
if (oldDom && parentNode && parentNode.contains(oldDom)) {
|
|
165
|
-
parentNode == null ? void 0 : parentNode.removeChild(oldDom);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
renderTag() {
|
|
169
|
-
var _a, _b, _c, _d, _e, _f;
|
|
170
|
-
this.clearTag();
|
|
171
|
-
if (!(((_a = this.tagResult) == null ? void 0 : _a.length) > 0)) {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
const dom = document.createElement("div");
|
|
175
|
-
const tagInfoList = TagUtil.getTagNameList((_c = (_b = this.currentTagResult) == null ? void 0 : _b.result) != null ? _c : {}, this.config.inputList);
|
|
176
|
-
dom.innerHTML = (_d = tagInfoList.reduce((acc, cur) => {
|
|
177
|
-
return `${acc}${cur.keyName}: ${cur.value.join(` \u3001 `)}
|
|
178
|
-
`;
|
|
179
|
-
}, "")) != null ? _d : "";
|
|
180
|
-
dom.setAttribute("id", "tagToolTag");
|
|
181
|
-
dom.setAttribute("style", `
|
|
1
|
+
import c from"../../utils/tool/CommonToolUtils.js";import m from"../../utils/tool/TagUtils.js";import T from"../../utils/uuid.js";import{BasicToolOperation as D}from"./basicToolOperation.js";class R extends D{constructor(t){super(t);this.getInitResultList=(e,s)=>!(e===0||e===void 0)&&s.length===0?[]:m.getDefaultTagResult(this.config.inputList,s),this.setLabel=(e,s)=>{var i,h;if(this.isImgError||!this.basicResult&&this.dependToolName)return;const l=this.config.inputList;if(!l[e])return;const{subSelected:o}=l[e];if(e<l.length&&l[e].subSelected&&o&&s<o.length){const d=l[e].value;let r=(i=o[s])==null?void 0:i.value;const g=(h=l[e])==null?void 0:h.isMulti,u=this.tagResult.filter(f=>{const n=`${f.sourceID}`;return c.isSameSourceID(n,this.sourceID)})[0];if(u){let f=0;const{result:n}=u;u.sourceID===0&&(u.sourceID="0");for(const p in u.result)if(p===l[e].value){if(f++,g===!0){const a=n[p].split(";").filter(I=>I!==""),b=a.indexOf(r);b===-1?a.push(r):a.splice(b,1),r=a.join(";")}r===""?Object.keys(n).length===1?this.tagResult=this.tagResult.filter(a=>{const b=`${a.sourceID}`;return c.isDifferSourceID(b,this.sourceID)}):Object.keys(n).length>1&&delete n[p]:n[p]=r}f===0&&Object.assign(u.result,{[d]:r})}else this.tagResult=[{sourceID:this.sourceID,id:T(8,62),result:{[d]:r}}];this.render()}},this.clearResult=(e=!0,s)=>{s?this.tagResult=this.tagResult.map(i=>((i==null?void 0:i.result[s])&&delete i.result[s],i)):this.tagResult=[],this.render()},this.config=c.jsonParser(t.config),this.tagResult=[],this.labelSelectedList=[],this.setShowDefaultCursor(!0)}destroy(){this.clearTag(),super.destroy()}setResult(t){this.tagResult=t,this.render()}get currentPageResult(){return[this.currentTagResult]}get currentTagResult(){var t;return(t=this.tagResult.filter(e=>{const s=`${e.sourceID}`;return c.isSameSourceID(s,this.sourceID)})[0])!=null?t:{}}get sourceID(){return c.getSourceID(this.basicResult)}onKeyDown(t){if(!c.hotkeyFilter(t)||super.onKeyDown(t)===!1)return;let{keyCode:e}=t;if(e&&(e<=57&&e>=49||e<=105&&e>=97)){if(e>57?e-=97:e-=49,this.config.inputList.length===1){this.labelSelectedList=[0,e],this.setLabel(0,e),setTimeout(()=>{this.labelSelectedList=[],this.render()},500);return}this.labelSelectedList.length===1?(this.labelSelectedList=[this.labelSelectedList[0],e],this.setLabel(this.labelSelectedList[0],e),setTimeout(()=>{this.labelSelectedList=[],this.render()},500)):(this.labelSelectedList=[e],this.emit("expend"))}}clearTag(){var t;const e=(t=this.canvas)==null?void 0:t.parentNode,s=window.self.document.getElementById("tagToolTag");s&&e&&e.contains(s)&&(e==null||e.removeChild(s))}renderTag(){var t,e,s,i,h,l;if(this.clearTag(),!(((t=this.tagResult)==null?void 0:t.length)>0))return;const o=document.createElement("div"),d=m.getTagNameList((s=(e=this.currentTagResult)==null?void 0:e.result)!=null?s:{},this.config.inputList);o.innerHTML=(i=d.reduce((r,g)=>`${r}${g.keyName}: ${g.value.join(" \u3001 ")}
|
|
2
|
+
`,""))!=null?i:"",o.setAttribute("id","tagToolTag"),o.setAttribute("style",`
|
|
182
3
|
position: absolute;
|
|
183
4
|
top: 0;
|
|
184
5
|
right: 0;
|
|
@@ -195,21 +16,4 @@ class TagOperation extends BasicToolOperation {
|
|
|
195
16
|
background: rgba(102, 111, 255, 1);
|
|
196
17
|
opacity: 0.6;
|
|
197
18
|
clear: both;
|
|
198
|
-
`);
|
|
199
|
-
(_f = (_e = this.canvas) == null ? void 0 : _e.parentNode) == null ? void 0 : _f.appendChild(dom);
|
|
200
|
-
}
|
|
201
|
-
render() {
|
|
202
|
-
this.renderTag();
|
|
203
|
-
super.render();
|
|
204
|
-
this.emit("render");
|
|
205
|
-
}
|
|
206
|
-
exportData() {
|
|
207
|
-
let {tagResult} = this;
|
|
208
|
-
if (this.isImgError) {
|
|
209
|
-
tagResult = [];
|
|
210
|
-
}
|
|
211
|
-
return [tagResult, this.basicImgInfo];
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
export { TagOperation as default };
|
|
19
|
+
`),(l=(h=this.canvas)==null?void 0:h.parentNode)==null||l.appendChild(o)}render(){this.renderTag(),super.render(),this.emit("render")}exportData(){let{tagResult:t}=this;return this.isImgError&&(t=[]),[t,this.basicImgInfo]}}export{R as default};
|
|
@@ -1,201 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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;
|
|
1
|
+
import d from"../../constant/keyCode.js";import{TEXT_ATTRIBUTE_LINE_HEIGHT as c,TEXT_ATTRIBUTE_MAX_LENGTH as u}from"../../constant/tool.js";const h=30,x=164;class M{constructor(t){this.textKeyDown=a=>{switch(a.stopPropagation(),a.keyCode){case d.Enter:this.submitTextarea(),this.appendToContainer();break}};const{container:i,icon:e,color:r,getCurrentSelectedData:o,updateSelectedTextAttribute:n}=t,s=t.width||x;this.container=i,this.getCurrentSelectedData=o,this.updateSelectedTextAttribute=n,this._textAttributeDOM=this.initTextAttributeDOM(),this._iconDOM=this.initIconDOM(e),this._textDOM=this.initTextDOM(s,c),this._textareaDOM=this.initTextareaDOM(s,r),this.appendToContainer()}get isExit(){return this._textAttributeDOM?this.container.contains(this._textAttributeDOM):!1}get isExitTextareaDOM(){return this._textareaDOM?this.container.contains(this._textareaDOM):!1}updateIcon(t){this._iconDOM&&(this._iconDOM.innerHTML=t)}appendToContainer(){!this._textAttributeDOM||!this._textDOM||!this._iconDOM||(this.container.appendChild(this._textAttributeDOM),this._textAttributeDOM.appendChild(this._textDOM),this._textAttributeDOM.appendChild(this._iconDOM))}initTextAttributeDOM(){const t=document.createElement("div");return t.setAttribute("id","textArea"),t}initTextDOM(t,i){const e=document.createElement("span");return e.setAttribute("style",`
|
|
2
|
+
width: ${Math.max(t,h)}px;
|
|
3
|
+
line-height: ${i}px;
|
|
63
4
|
word-break: break-all;
|
|
64
5
|
white-space: pre-line;
|
|
65
6
|
font-style: italic;
|
|
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", `
|
|
7
|
+
`),e}initIconDOM(t){const i=document.createElement("div");return i.setAttribute("id","annotation_text"),i.innerHTML=t,i.addEventListener("mouseup",e=>{e.stopPropagation(),this.renderTextarea()}),i.addEventListener("mousedown",e=>{e.stopPropagation()}),i.addEventListener("contextmenu",e=>{e.stopPropagation()}),i.setAttribute("style",`
|
|
84
8
|
position: absolute;
|
|
85
9
|
left: -20px;
|
|
86
10
|
top: 4px;
|
|
87
11
|
cursor: pointer;
|
|
88
12
|
z-index: 10
|
|
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", `
|
|
13
|
+
`),i}initTextareaDOM(t,i){const e=document.createElement("textarea");return e.addEventListener("click",r=>{r.stopPropagation()}),e.addEventListener("mouseup",r=>{r.stopPropagation()}),e.setAttribute("style",`
|
|
101
14
|
background-color: transparent;
|
|
102
15
|
border-radius: 5px;
|
|
103
|
-
border-color: ${
|
|
16
|
+
border-color: ${i};
|
|
104
17
|
outline: none;
|
|
105
18
|
resize: none;
|
|
106
|
-
width: ${Math.max(
|
|
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", `
|
|
19
|
+
width: ${Math.max(t,30)}px;
|
|
20
|
+
`),e.setAttribute("maxLength",`${u}`),e}removeTextDOM(){!this._textAttributeDOM||this._textDOM&&this._textAttributeDOM.removeChild(this._textDOM)}removeIconDOM(){!this._textAttributeDOM||this._iconDOM&&this._textAttributeDOM.removeChild(this._iconDOM)}removeTextareaDOM(){var t,i;this._textareaDOM&&this._textAttributeDOM&&((t=this._textAttributeDOM)==null?void 0:t.contains(this._textareaDOM))&&((i=this._textAttributeDOM)==null||i.removeChild(this._textareaDOM))}submitTextarea(){var t;this._textareaDOM&&(this.updateSelectedTextAttribute((t=this._textareaDOM)==null?void 0:t.value),this.removeTextareaDOM(),this.clearTextAttribute())}clearTextAttribute(){this._textAttributeDOM&&this.container.contains(this._textAttributeDOM)&&this.container.removeChild(this._textAttributeDOM)}renderTextarea(){if(!this._textAttributeDOM||!this._textareaDOM)return;const t=this.getCurrentSelectedData();if(!t)return;const{width:i=x,textAttribute:e,color:r}=t;this._textareaDOM.value=`${e}`,this._textareaDOM.setAttribute("style",`
|
|
157
21
|
background-color: rgba(0,0,0,0.4);
|
|
158
22
|
border-radius: 5px;
|
|
159
|
-
border-color: ${
|
|
23
|
+
border-color: ${r};
|
|
160
24
|
outline: none;
|
|
161
25
|
resize: none;
|
|
162
26
|
font-style: italic;
|
|
163
27
|
font-weight: 900;
|
|
164
28
|
text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.6);
|
|
165
|
-
width: ${Math.max(
|
|
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", `
|
|
29
|
+
width: ${Math.max(i,h)}px;
|
|
30
|
+
`),this._textareaDOM.setAttribute("maxLength",`${u}`),this._textAttributeDOM.appendChild(this._textareaDOM),this.removeIconDOM(),this.removeTextDOM(),this._textareaDOM.focus(),this._textareaDOM.addEventListener("keydown",this.textKeyDown)}update(t,i){var e;const{left:r,top:o,color:n,width:s=x}=i,a=Math.max(s,h);(e=this._textAttributeDOM)==null||e.setAttribute("style",`
|
|
179
31
|
position: absolute;
|
|
180
|
-
width: ${
|
|
32
|
+
width: ${a}px;
|
|
181
33
|
font-size: 14px;
|
|
182
|
-
left:${
|
|
183
|
-
top: ${
|
|
184
|
-
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 };
|
|
34
|
+
left:${r}px;
|
|
35
|
+
top: ${o}px;
|
|
36
|
+
color: ${n};
|
|
37
|
+
`),this._textDOM&&(this._textDOM.innerHTML=`${t}`),this._textareaDOM&&(this._textareaDOM.style.width=`${a}px`,this._textareaDOM.style.borderColor=`${n}`)}changeSelected(){this.isExitTextareaDOM&&this.submitTextarea()}}export{M as default};
|
package/es/index.js
CHANGED
|
@@ -1,46 +1 @@
|
|
|
1
|
-
export {
|
|
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 };
|
|
1
|
+
export{RectOperation}from"./core/toolOperation/rectOperation.js";export{default as TagOperation}from"./core/toolOperation/tagOperation.js";export{default as PointOperation}from"./core/toolOperation/pointOperation.js";export{default as LineToolOperation}from"./core/toolOperation/LineToolOperation.js";export{default as TextToolOperation}from"./core/toolOperation/TextToolOperation.js";export{default as PolygonOperation}from"./core/toolOperation/polygonOperation.js";export{default as MeasureOperation}from"./core/toolOperation/measureOperation.js";export{BasicToolOperation}from"./core/toolOperation/basicToolOperation.js";export{default as ViewOperation}from"./core/toolOperation/ViewOperation.js";export{default as ScribbleTool}from"./core/toolOperation/ScribbleTool.js";export{default as PointCloud2dOperation}from"./core/toolOperation/pointCloud2dOperation.js";import*as t from"./constant/annotation.js";export{t as cAnnotation};import*as e from"./constant/annotationTask.js";export{e as cAnnotationTask};import*as r from"./constant/keyCode.js";export{r as cKeyCode};import*as a from"./constant/style.js";export{a as cStyle};import*as i from"./constant/tool.js";export{i as cTool};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";export{default as TagUtils}from"./utils/tool/TagUtils.js";export{default as uuid}from"./utils/uuid.js";import o from"./utils/tool/EnhanceCommonToolUtils.js";export{default as MarkerUtils}from"./utils/tool/MarkerUtils.js";export{default as RectUtils}from"./utils/tool/RectUtils.js";export{default as AxisUtils}from"./utils/tool/AxisUtils.js";export{default as DrawUtils}from"./utils/tool/DrawUtils.js";export{default as ImgUtils}from"./utils/ImgUtils.js";export{default as MathUtils}from"./utils/MathUtils.js";export{default as AttributeUtils}from"./utils/tool/AttributeUtils.js";export{default as ActionsHistory}from"./utils/ActionsHistory.js";export{default as DblClickEventListener}from"./utils/tool/DblClickEventListener.js";export{default as AnnotationEngine}from"./core/index.js";export{default as UnitUtils}from"./utils/tool/UnitUtils.js";export{default as StyleUtils}from"./utils/tool/StyleUtils.js";export{CanvasScheduler}from"./newCore/CanvasScheduler.js";export{PointCloud}from"./core/pointCloud/index.js";export{createThreeMatrix4,getCuboidFromPointCloudBox,lidar2image,pointCloudLidar2image,rotatePoint,transferKitti2Matrix}from"./core/pointCloud/matrix.js";export{PointCloudAnnotation}from"./core/pointCloud/annotation.js";const s=o,l=o;export{s as CommonToolUtils,l as toolUtils};
|