@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.
- 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/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,68 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import StyleUtils from './StyleUtils.js';
|
|
3
|
-
|
|
4
|
-
class RenderDomClass {
|
|
5
|
-
constructor(props) {
|
|
6
|
-
this._domMap = new Map();
|
|
7
|
-
this._container = props.container;
|
|
8
|
-
this._height = props.height;
|
|
9
|
-
}
|
|
10
|
-
wheelChange(e) {
|
|
11
|
-
e.stopPropagation();
|
|
12
|
-
}
|
|
13
|
-
clearTag(id) {
|
|
14
|
-
const parentNode = this._container;
|
|
15
|
-
const oldDom = window.self.document.getElementById(id);
|
|
16
|
-
if (oldDom && parentNode && parentNode.contains(oldDom)) {
|
|
17
|
-
oldDom.removeEventListener("wheel", this.wheelChange);
|
|
18
|
-
parentNode == null ? void 0 : parentNode.removeChild(oldDom);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
render(annotations) {
|
|
22
|
-
const oldKeys = Array.from(this._domMap.keys());
|
|
23
|
-
const newKeys = annotations.map((v) => v.id);
|
|
24
|
-
annotations.forEach((v) => {
|
|
25
|
-
const {text, textMaxWidth, color = "white", background = "rgba(0, 0, 0, 0.6)", style} = v;
|
|
26
|
-
if (this._domMap.has(v.id)) {
|
|
27
|
-
const dom = this._domMap.get(v.id);
|
|
28
|
-
if (dom) {
|
|
29
|
-
dom.innerHTML = text;
|
|
30
|
-
}
|
|
31
|
-
} else {
|
|
32
|
-
const dom = DrawUtils.drawTagByDom(this._container, text, v.id);
|
|
33
|
-
if (dom) {
|
|
34
|
-
dom.setAttribute("style", `
|
|
1
|
+
import d from"./DrawUtils.js";import c from"./StyleUtils.js";class p{constructor(t){this._domMap=new Map,this._container=t.container,this._height=t.height}wheelChange(t){t.stopPropagation()}clearTag(t){const o=this._container,a=window.self.document.getElementById(t);a&&o&&o.contains(a)&&(a.removeEventListener("wheel",this.wheelChange),o==null||o.removeChild(a))}render(t){const o=Array.from(this._domMap.keys()),a=t.map(e=>e.id);t.forEach(e=>{const{text:s,textMaxWidth:r,color:n="white",background:h="rgba(0, 0, 0, 0.6)",style:l}=e;if(this._domMap.has(e.id)){const i=this._domMap.get(e.id);i&&(i.innerHTML=s)}else{const i=d.drawTagByDom(this._container,s,e.id);i&&(i.setAttribute("style",`
|
|
35
2
|
position: absolute;
|
|
36
3
|
top: 0;
|
|
37
4
|
right: 0;
|
|
38
5
|
z-index: 20;
|
|
39
6
|
padding: 8px 20px;
|
|
40
7
|
font-size: 15px;
|
|
41
|
-
max-width: ${
|
|
42
|
-
color: ${
|
|
8
|
+
max-width: ${r}px;
|
|
9
|
+
color: ${n};
|
|
43
10
|
text-align: left;
|
|
44
11
|
line-height: 32px;
|
|
45
12
|
word-break: break-all;
|
|
46
13
|
white-space: pre-wrap;
|
|
47
|
-
background: ${
|
|
14
|
+
background: ${h};
|
|
48
15
|
opacity: 0.9;
|
|
49
|
-
max-height: ${this._height
|
|
16
|
+
max-height: ${this._height*.8}px;
|
|
50
17
|
overflow-y: scroll;
|
|
51
18
|
clear: both;
|
|
52
|
-
${
|
|
53
|
-
`);
|
|
54
|
-
dom.addEventListener("wheel", this.wheelChange);
|
|
55
|
-
this._domMap.set(v.id, dom);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
oldKeys.forEach((key) => {
|
|
60
|
-
if (newKeys.indexOf(key) === -1) {
|
|
61
|
-
this.clearTag(key);
|
|
62
|
-
this._domMap.delete(key);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export { RenderDomClass as default };
|
|
19
|
+
${c.getStyle2String(l)}
|
|
20
|
+
`),i.addEventListener("wheel",this.wheelChange),this._domMap.set(e.id,i))}}),o.forEach(e=>{a.indexOf(e)===-1&&(this.clearTag(e),this._domMap.delete(e))})}}export{p as default};
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { EMessage } from '../../locales/constants.js';
|
|
3
|
-
|
|
4
|
-
const INVALID_PAGE_CLASS_NAME = "bee-invalid-page";
|
|
5
|
-
class RenderDomUtils {
|
|
6
|
-
static renderInvalidPage(container, size, lang) {
|
|
7
|
-
const invalidDOM = document.createElement("div");
|
|
8
|
-
invalidDOM.setAttribute("style", `
|
|
1
|
+
import n from"../../locales/index.js";import{EMessage as s}from"../../locales/constants.js";const o="bee-invalid-page";class l{static renderInvalidPage(i,t,a){const e=document.createElement("div");return e.setAttribute("style",`
|
|
9
2
|
position: absolute;
|
|
10
3
|
left: 0px;
|
|
11
4
|
top: 0px;
|
|
12
|
-
width: ${
|
|
13
|
-
height: ${
|
|
5
|
+
width: ${t.width}px;
|
|
6
|
+
height: ${t.height}px;
|
|
14
7
|
background: rgba(255, 87, 34, 1);
|
|
15
8
|
overflow: hidden;
|
|
16
9
|
color: white;
|
|
@@ -20,12 +13,4 @@ class RenderDomUtils {
|
|
|
20
13
|
font-size: 30px;
|
|
21
14
|
opacity: 0.7;
|
|
22
15
|
z-index: 30;
|
|
23
|
-
`);
|
|
24
|
-
invalidDOM.innerHTML = Locale.getMessagesByLocale(EMessage.InvalidImage, lang);
|
|
25
|
-
invalidDOM.className = INVALID_PAGE_CLASS_NAME;
|
|
26
|
-
container.appendChild(invalidDOM);
|
|
27
|
-
return invalidDOM;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { RenderDomUtils as default };
|
|
16
|
+
`),e.innerHTML=n.getMessagesByLocale(s.InvalidImage,a),e.className=o,i.appendChild(e),e}}export{l as default};
|
|
@@ -1,29 +1 @@
|
|
|
1
|
-
class
|
|
2
|
-
static getStrokeAndFill(toolStyle, valid = true, options = {}) {
|
|
3
|
-
const {isSelected = false, isHover = false} = options;
|
|
4
|
-
if (isSelected) {
|
|
5
|
-
return {
|
|
6
|
-
stroke: valid ? toolStyle.validSelected.stroke : toolStyle.invalidSelected.stroke,
|
|
7
|
-
fill: valid ? toolStyle.validSelected.fill : toolStyle.invalidSelected.fill
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
if (isHover) {
|
|
11
|
-
return {
|
|
12
|
-
stroke: valid ? toolStyle.validHover.stroke : toolStyle.invalidHover.stroke,
|
|
13
|
-
fill: valid ? toolStyle.validHover.fill : toolStyle.invalidHover.fill
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
stroke: valid ? toolStyle.valid.stroke : toolStyle.invalid.stroke,
|
|
18
|
-
fill: valid ? toolStyle.valid.fill : toolStyle.invalid.fill
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
static getStyle2String(style) {
|
|
22
|
-
if (!style) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
return Object.entries(style).reduce((acc, cur) => `${acc} ${cur[0]}: ${cur[1]};`, "");
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export { StyleUtils as default };
|
|
1
|
+
class d{static getStrokeAndFill(e,i=!0,r={}){const{isSelected:s=!1,isHover:l=!1}=r;return s?{stroke:i?e.validSelected.stroke:e.invalidSelected.stroke,fill:i?e.validSelected.fill:e.invalidSelected.fill}:l?{stroke:i?e.validHover.stroke:e.invalidHover.stroke,fill:i?e.validHover.fill:e.invalidHover.fill}:{stroke:i?e.valid.stroke:e.invalid.stroke,fill:i?e.valid.fill:e.invalid.fill}}static getStyle2String(e){if(!!e)return Object.entries(e).reduce((i,r)=>`${i} ${r[0]}: ${r[1]};`,"")}}export{d as default};
|
|
@@ -1,127 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
class TagUtil {
|
|
20
|
-
static getTagKeyName(key, labelInfoSet) {
|
|
21
|
-
var _a, _b;
|
|
22
|
-
if (!labelInfoSet) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
return (_b = (_a = labelInfoSet.find((v) => v.value === key)) == null ? void 0 : _a.key) != null ? _b : "";
|
|
26
|
-
}
|
|
27
|
-
static getTagName([key = "", value = ""], labelInfoSet) {
|
|
28
|
-
if (!labelInfoSet) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
for (const i of labelInfoSet) {
|
|
32
|
-
if (i.value === key) {
|
|
33
|
-
if (!i.subSelected) {
|
|
34
|
-
console.error("\u6807\u7B7E\u89E3\u6790\u9519\u8BEF", key, value);
|
|
35
|
-
return "";
|
|
36
|
-
}
|
|
37
|
-
for (const j of i.subSelected) {
|
|
38
|
-
if (j.value === value) {
|
|
39
|
-
return j.key;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
static getTagNameList(result, labelInfoSet) {
|
|
46
|
-
if (Object.keys(result).length <= 0) {
|
|
47
|
-
return [];
|
|
48
|
-
}
|
|
49
|
-
return Object.entries(result).reduce((acc, cur) => {
|
|
50
|
-
const [key, value] = cur;
|
|
51
|
-
if (value && value.length > 0) {
|
|
52
|
-
const valueList = value.split(";");
|
|
53
|
-
const nameList = {
|
|
54
|
-
keyName: this.getTagKeyName(key, labelInfoSet),
|
|
55
|
-
value: valueList.map((v) => this.getTagName([key, v], labelInfoSet))
|
|
56
|
-
};
|
|
57
|
-
return [...acc, nameList];
|
|
58
|
-
}
|
|
59
|
-
return acc;
|
|
60
|
-
}, []).filter((v) => v);
|
|
61
|
-
}
|
|
62
|
-
static getTagnameListWithoutConfig(result) {
|
|
63
|
-
if (Object.keys(result).length <= 0) {
|
|
64
|
-
return [];
|
|
65
|
-
}
|
|
66
|
-
return Object.entries(result).reduce((acc, cur) => {
|
|
67
|
-
const [key, value] = cur;
|
|
68
|
-
const valueList = value.split(";");
|
|
69
|
-
const nameList = {
|
|
70
|
-
keyName: key,
|
|
71
|
-
value: valueList
|
|
72
|
-
};
|
|
73
|
-
return [...acc, nameList];
|
|
74
|
-
}, []).filter((v) => v);
|
|
75
|
-
}
|
|
76
|
-
static judgeResultIsInInputList(key, value, inputList) {
|
|
77
|
-
if (!key || !value || !inputList) {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
const a = inputList.filter((v) => {
|
|
81
|
-
if (v.value === key && v.subSelected) {
|
|
82
|
-
const resultValue = value == null ? void 0 : value.split(";");
|
|
83
|
-
return (v == null ? void 0 : v.subSelected.filter((i) => resultValue.indexOf(i.value) > -1).length) > 0;
|
|
84
|
-
}
|
|
85
|
-
return false;
|
|
86
|
-
});
|
|
87
|
-
return a.length > 0;
|
|
88
|
-
}
|
|
89
|
-
static getDefaultResultByConfig(inputList) {
|
|
90
|
-
return inputList.reduce((acc, cur) => {
|
|
91
|
-
if (cur.subSelected) {
|
|
92
|
-
cur.subSelected.forEach((data) => {
|
|
93
|
-
var _a;
|
|
94
|
-
if (data.isDefault) {
|
|
95
|
-
const originResult = (_a = acc[cur.value]) != null ? _a : "";
|
|
96
|
-
let originResultList = [];
|
|
97
|
-
if (originResult.length > 0) {
|
|
98
|
-
originResultList = originResult.split(";");
|
|
99
|
-
}
|
|
100
|
-
originResultList.push(data.value);
|
|
101
|
-
acc[cur.value] = originResultList.join(";");
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
return acc;
|
|
106
|
-
}, {});
|
|
107
|
-
}
|
|
108
|
-
static getDefaultTagResult(inputList, basicResultList) {
|
|
109
|
-
const defaultResult = this.getDefaultResultByConfig(inputList);
|
|
110
|
-
if (basicResultList.length > 0) {
|
|
111
|
-
return basicResultList.map((v) => ({
|
|
112
|
-
id: uuid(),
|
|
113
|
-
sourceID: v.id,
|
|
114
|
-
result: __spreadValues({}, defaultResult)
|
|
115
|
-
}));
|
|
116
|
-
}
|
|
117
|
-
return [
|
|
118
|
-
{
|
|
119
|
-
id: uuid(),
|
|
120
|
-
sourceID: "",
|
|
121
|
-
result: __spreadValues({}, defaultResult)
|
|
122
|
-
}
|
|
123
|
-
];
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export { TagUtil as default };
|
|
1
|
+
import a from"../uuid.js";var p=Object.defineProperty,o=Object.getOwnPropertySymbols,m=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable,f=(l,t,e)=>t in l?p(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e,c=(l,t)=>{for(var e in t||(t={}))m.call(t,e)&&f(l,e,t[e]);if(o)for(var e of o(t))v.call(t,e)&&f(l,e,t[e]);return l};class y{static getTagKeyName(t,e){var r,i;if(!!e)return(i=(r=e.find(u=>u.value===t))==null?void 0:r.key)!=null?i:""}static getTagName([t="",e=""],r){if(!!r){for(const i of r)if(i.value===t){if(!i.subSelected)return console.error("\u6807\u7B7E\u89E3\u6790\u9519\u8BEF",t,e),"";for(const u of i.subSelected)if(u.value===e)return u.key}}}static getTagNameList(t,e){return Object.keys(t).length<=0?[]:Object.entries(t).reduce((r,i)=>{const[u,n]=i;if(n&&n.length>0){const s=n.split(";"),g={keyName:this.getTagKeyName(u,e),value:s.map(d=>this.getTagName([u,d],e))};return[...r,g]}return r},[]).filter(r=>r)}static getTagnameListWithoutConfig(t){return Object.keys(t).length<=0?[]:Object.entries(t).reduce((e,r)=>{const[i,u]=r,n=u.split(";"),s={keyName:i,value:n};return[...e,s]},[]).filter(e=>e)}static judgeResultIsInInputList(t,e,r){return!t||!e||!r?!1:r.filter(u=>{if(u.value===t&&u.subSelected){const n=e==null?void 0:e.split(";");return(u==null?void 0:u.subSelected.filter(s=>n.indexOf(s.value)>-1).length)>0}return!1}).length>0}static getDefaultResultByConfig(t){return t.reduce((e,r)=>(r.subSelected&&r.subSelected.forEach(i=>{var u;if(i.isDefault){const n=(u=e[r.value])!=null?u:"";let s=[];n.length>0&&(s=n.split(";")),s.push(i.value),e[r.value]=s.join(";")}}),e),{})}static getDefaultTagResult(t,e){const r=this.getDefaultResultByConfig(t);return e.length>0?e.map(i=>({id:a(),sourceID:i.id,result:c({},r)})):[{id:a(),sourceID:"",result:c({},r)}]}}export{y as default};
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
class
|
|
2
|
-
static deg2rad(angleDeg) {
|
|
3
|
-
return angleDeg * Math.PI / 180;
|
|
4
|
-
}
|
|
5
|
-
static rad2deg(angleRad) {
|
|
6
|
-
return angleRad * 180 / Math.PI;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { UnitUtils as default };
|
|
1
|
+
class a{static deg2rad(t){return t*Math.PI/180}static rad2deg(t){return t*180/Math.PI}}export{a as default};
|
|
@@ -1,70 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import MathUtils from '../MathUtils.js';
|
|
3
|
-
|
|
4
|
-
const ZOOM_LEVEL = [1, 5, 10, 20, 30, 50, 80, 100].concat(Array.from({length: 9}).map((i, index) => (index + 2) * 100));
|
|
5
|
-
class ZoomUtils {
|
|
6
|
-
}
|
|
7
|
-
ZoomUtils.zoomChanged = (zoom, isZoomIn, growthMode = EGrowthMode.Linear) => {
|
|
8
|
-
switch (growthMode) {
|
|
9
|
-
case EGrowthMode.Intelligence: {
|
|
10
|
-
const maxZoom = Math.max(...ZOOM_LEVEL);
|
|
11
|
-
const minZoom = Math.min(...ZOOM_LEVEL);
|
|
12
|
-
const zoomIndex = ZOOM_LEVEL.slice(0, ZOOM_LEVEL.length).findIndex((i, index) => zoom >= i && (zoom < ZOOM_LEVEL[index + 1] || i === maxZoom));
|
|
13
|
-
let newZoom;
|
|
14
|
-
if (zoomIndex === -1) {
|
|
15
|
-
if (zoom >= minZoom && zoom <= maxZoom) {
|
|
16
|
-
newZoom = isZoomIn ? maxZoom : minZoom;
|
|
17
|
-
} else {
|
|
18
|
-
newZoom = isZoomIn ? minZoom : zoom;
|
|
19
|
-
}
|
|
20
|
-
} else {
|
|
21
|
-
const newZoomIndex = isZoomIn ? zoomIndex + 1 : zoomIndex - (ZOOM_LEVEL.includes(zoom) ? 1 : 0);
|
|
22
|
-
newZoom = ZOOM_LEVEL[MathUtils.withinRange(newZoomIndex, [0, ZOOM_LEVEL.length - 1])];
|
|
23
|
-
}
|
|
24
|
-
return newZoom;
|
|
25
|
-
}
|
|
26
|
-
default: {
|
|
27
|
-
const ratio = isZoomIn ? 2 : 1 / 2;
|
|
28
|
-
return zoom * ratio;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
ZoomUtils.wheelChangePos = (imgNode, coord, operator, oldCurrentPos, options = {}) => {
|
|
33
|
-
const {zoom = 1, innerZoom = 1, basicZoom = 1, zoomMax = 1e3, rotate = 0} = options;
|
|
34
|
-
const {x, y} = oldCurrentPos;
|
|
35
|
-
const ratio = parseFloat((zoom + 1 / 10).toFixed(1)) / 5;
|
|
36
|
-
if (imgNode && coord) {
|
|
37
|
-
let {width, height} = imgNode;
|
|
38
|
-
if ([90, 270].includes(rotate)) {
|
|
39
|
-
width = imgNode.height;
|
|
40
|
-
height = imgNode.width;
|
|
41
|
-
}
|
|
42
|
-
const imgWidth = width * innerZoom;
|
|
43
|
-
const imgHeight = height * innerZoom;
|
|
44
|
-
const offsetLeft = coord.x - x;
|
|
45
|
-
const offsetTop = coord.y - y;
|
|
46
|
-
const ratioX = offsetLeft / imgWidth;
|
|
47
|
-
const ratioY = offsetTop / imgHeight;
|
|
48
|
-
let currentZoom = zoom + operator * ratio;
|
|
49
|
-
currentZoom = MathUtils.withinRange(currentZoom, [basicZoom, zoomMax]);
|
|
50
|
-
const changeX = width * currentZoom * ratioX;
|
|
51
|
-
const changeY = height * currentZoom * ratioY;
|
|
52
|
-
const currentX = x + (offsetLeft - changeX);
|
|
53
|
-
const currentY = y + (offsetTop - changeY);
|
|
54
|
-
return {
|
|
55
|
-
zoom: currentZoom,
|
|
56
|
-
currentPos: {
|
|
57
|
-
x: currentX,
|
|
58
|
-
y: currentY
|
|
59
|
-
},
|
|
60
|
-
imgInfo: {
|
|
61
|
-
width: width * currentZoom,
|
|
62
|
-
height: height * currentZoom
|
|
63
|
-
},
|
|
64
|
-
ratio
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
return null;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export { ZoomUtils as default };
|
|
1
|
+
import{EGrowthMode as p}from"../../constant/annotation.js";import Z from"../MathUtils.js";const e=[1,5,10,20,30,50,80,100].concat(Array.from({length:9}).map((t,n)=>(n+2)*100));class m{}m.zoomChanged=(t,n,f=p.Linear)=>{switch(f){case p.Intelligence:{const o=Math.max(...e),r=Math.min(...e),c=e.slice(0,e.length).findIndex((a,g)=>t>=a&&(t<e[g+1]||a===o));let s;if(c===-1)t>=r&&t<=o?s=n?o:r:s=n?r:t;else{const a=n?c+1:c-(e.includes(t)?1:0);s=e[Z.withinRange(a,[0,e.length-1])]}return s}default:{const o=n?2:1/2;return t*o}}},m.wheelChangePos=(t,n,f,o,r={})=>{const{zoom:c=1,innerZoom:s=1,basicZoom:a=1,zoomMax:g=1e3,rotate:y=0}=r,{x:u,y:x}=o,d=parseFloat((c+1/10).toFixed(1))/5;if(t&&n){let{width:h,height:l}=t;[90,270].includes(y)&&(h=t.height,l=t.width);const L=h*s,E=l*s,w=n.x-u,M=n.y-x,U=w/L,X=M/E;let i=c+f*d;i=Z.withinRange(i,[a,g]);const Y=h*i*U,j=l*i*X,C=u+(w-Y),F=x+(M-j);return{zoom:i,currentPos:{x:C,y:F},imgInfo:{width:h*i,height:l*i},ratio:d}}return null};export{m as default};
|
|
@@ -1,126 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
-
function createSmoothCurvePoints(points, tension = 0.5, closed = false, numberOfSegments = 16) {
|
|
23
|
-
if (points.length < 4) {
|
|
24
|
-
return points;
|
|
25
|
-
}
|
|
26
|
-
const result = [];
|
|
27
|
-
const ps = points.slice(0);
|
|
28
|
-
let x;
|
|
29
|
-
let y;
|
|
30
|
-
let t1x;
|
|
31
|
-
let t2x;
|
|
32
|
-
let t1y;
|
|
33
|
-
let t2y;
|
|
34
|
-
let c1;
|
|
35
|
-
let c2;
|
|
36
|
-
let c3;
|
|
37
|
-
let c4;
|
|
38
|
-
let st;
|
|
39
|
-
let t;
|
|
40
|
-
let i;
|
|
41
|
-
if (closed) {
|
|
42
|
-
ps.unshift(points[points.length - 1]);
|
|
43
|
-
ps.unshift(points[points.length - 2]);
|
|
44
|
-
ps.unshift(points[points.length - 1]);
|
|
45
|
-
ps.unshift(points[points.length - 2]);
|
|
46
|
-
ps.push(points[0]);
|
|
47
|
-
ps.push(points[1]);
|
|
48
|
-
} else {
|
|
49
|
-
ps.unshift(points[1]);
|
|
50
|
-
ps.unshift(points[0]);
|
|
51
|
-
ps.push(points[points.length - 2]);
|
|
52
|
-
ps.push(points[points.length - 1]);
|
|
53
|
-
}
|
|
54
|
-
for (i = 2; i < ps.length - 4; i += 2) {
|
|
55
|
-
t1x = (ps[i + 2] - ps[i - 2]) * tension;
|
|
56
|
-
t2x = (ps[i + 4] - ps[i - 0]) * tension;
|
|
57
|
-
t1y = (ps[i + 3] - ps[i - 1]) * tension;
|
|
58
|
-
t2y = (ps[i + 5] - ps[i + 1]) * tension;
|
|
59
|
-
for (t = 0; t <= numberOfSegments; t++) {
|
|
60
|
-
st = t / numberOfSegments;
|
|
61
|
-
c1 = 2 * Math.pow(st, 3) - 3 * Math.pow(st, 2) + 1;
|
|
62
|
-
c2 = -(2 * Math.pow(st, 3)) + 3 * Math.pow(st, 2);
|
|
63
|
-
c3 = Math.pow(st, 3) - 2 * Math.pow(st, 2) + st;
|
|
64
|
-
c4 = Math.pow(st, 3) - Math.pow(st, 2);
|
|
65
|
-
x = c1 * ps[i] + c2 * ps[i + 2] + c3 * t1x + c4 * t2x;
|
|
66
|
-
y = c1 * ps[i + 1] + c2 * ps[i + 3] + c3 * t1y + c4 * t2y;
|
|
67
|
-
result.push(x);
|
|
68
|
-
result.push(y);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
const formatResult = [];
|
|
72
|
-
for (let j = 0; j < result.length - 1; j += 2) {
|
|
73
|
-
formatResult.push({
|
|
74
|
-
x: result[j],
|
|
75
|
-
y: result[j + 1]
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
if (closed) {
|
|
79
|
-
for (let j = 0; j < numberOfSegments + 1; j++) {
|
|
80
|
-
const d = formatResult.shift();
|
|
81
|
-
formatResult.push(d);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return formatResult;
|
|
85
|
-
}
|
|
86
|
-
const createSmoothCurvePointsFromPointList = (pointList, numberOfSegments = 16) => createSmoothCurvePoints(pointList.reduce((acc, cur) => {
|
|
87
|
-
return [...acc, cur.x, cur.y];
|
|
88
|
-
}, []), 0.5, false, numberOfSegments);
|
|
89
|
-
function isInPolygon(checkPoint, polygonPoints, lineType = ELineTypes.Line) {
|
|
90
|
-
let counter = 0;
|
|
91
|
-
let i;
|
|
92
|
-
let xinters;
|
|
93
|
-
let p1;
|
|
94
|
-
let p2;
|
|
95
|
-
polygonPoints = [...polygonPoints];
|
|
96
|
-
if (lineType === ELineTypes.Curve) {
|
|
97
|
-
polygonPoints = createSmoothCurvePoints(polygonPoints.reduce((acc, cur) => {
|
|
98
|
-
return [...acc, cur.x, cur.y];
|
|
99
|
-
}, []), 0.5, true, SEGMENT_NUMBER);
|
|
100
|
-
}
|
|
101
|
-
[p1] = polygonPoints;
|
|
102
|
-
const pointCount = polygonPoints.length;
|
|
103
|
-
for (i = 1; i <= pointCount; i++) {
|
|
104
|
-
p2 = polygonPoints[i % pointCount];
|
|
105
|
-
if (checkPoint.x > Math.min(p1.x, p2.x) && checkPoint.x <= Math.max(p1.x, p2.x)) {
|
|
106
|
-
if (checkPoint.y <= Math.max(p1.y, p2.y)) {
|
|
107
|
-
if (p1.x !== p2.x) {
|
|
108
|
-
xinters = (checkPoint.x - p1.x) * (p2.y - p1.y) / (p2.x - p1.x) + p1.y;
|
|
109
|
-
if (p1.y === p2.y || checkPoint.y <= xinters) {
|
|
110
|
-
counter++;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
p1 = p2;
|
|
116
|
-
}
|
|
117
|
-
if (counter % 2 === 0) {
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
return true;
|
|
121
|
-
}
|
|
122
|
-
function getPolygonPointUnderZoom(pointList, zoom = 1) {
|
|
123
|
-
return pointList.map((v) => __spreadProps(__spreadValues({}, v), {x: v.x * zoom, y: v.y * zoom}));
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export { createSmoothCurvePoints, createSmoothCurvePointsFromPointList, getPolygonPointUnderZoom, isInPolygon };
|
|
1
|
+
import{ELineTypes as g,SEGMENT_NUMBER as E}from"../../constant/tool.js";var C=Object.defineProperty,I=Object.defineProperties,L=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable,P=(e,t,l)=>t in e?C(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,b=(e,t)=>{for(var l in t||(t={}))N.call(t,l)&&P(e,l,t[l]);if(O)for(var l of O(t))S.call(t,l)&&P(e,l,t[l]);return e},D=(e,t)=>I(e,L(t));function v(e,t=.5,l=!1,s=16){if(e.length<4)return e;const h=[],r=e.slice(0);let f,u,n,y,p,d,w,i,M,m,o,c,a;for(l?(r.unshift(e[e.length-1]),r.unshift(e[e.length-2]),r.unshift(e[e.length-1]),r.unshift(e[e.length-2]),r.push(e[0]),r.push(e[1])):(r.unshift(e[1]),r.unshift(e[0]),r.push(e[e.length-2]),r.push(e[e.length-1])),a=2;a<r.length-4;a+=2)for(n=(r[a+2]-r[a-2])*t,y=(r[a+4]-r[a-0])*t,p=(r[a+3]-r[a-1])*t,d=(r[a+5]-r[a+1])*t,c=0;c<=s;c++)o=c/s,w=2*Math.pow(o,3)-3*Math.pow(o,2)+1,i=-(2*Math.pow(o,3))+3*Math.pow(o,2),M=Math.pow(o,3)-2*Math.pow(o,2)+o,m=Math.pow(o,3)-Math.pow(o,2),f=w*r[a]+i*r[a+2]+M*n+m*y,u=w*r[a+1]+i*r[a+3]+M*p+m*d,h.push(f),h.push(u);const _=[];for(let x=0;x<h.length-1;x+=2)_.push({x:h[x],y:h[x+1]});if(l)for(let x=0;x<s+1;x++){const j=_.shift();_.push(j)}return _}const R=(e,t=16)=>v(e.reduce((l,s)=>[...l,s.x,s.y],[]),.5,!1,t);function T(e,t,l=g.Line){let s=0,h,r,f,u;t=[...t],l===g.Curve&&(t=v(t.reduce((y,p)=>[...y,p.x,p.y],[]),.5,!0,E)),[f]=t;const n=t.length;for(h=1;h<=n;h++)u=t[h%n],e.x>Math.min(f.x,u.x)&&e.x<=Math.max(f.x,u.x)&&e.y<=Math.max(f.y,u.y)&&f.x!==u.x&&(r=(e.x-f.x)*(u.y-f.y)/(u.x-f.x)+f.y,(f.y===u.y||e.y<=r)&&s++),f=u;return s%2!=0}function U(e,t=1){return e.map(l=>D(b({},l),{x:l.x*t,y:l.y*t}))}export{v as createSmoothCurvePoints,R as createSmoothCurvePointsFromPointList,U as getPolygonPointUnderZoom,T as isInPolygon};
|
package/es/utils/uuid.js
CHANGED
|
@@ -1,24 +1 @@
|
|
|
1
|
-
function
|
|
2
|
-
const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");
|
|
3
|
-
const id = [];
|
|
4
|
-
let i;
|
|
5
|
-
radix = radix || chars.length;
|
|
6
|
-
if (len) {
|
|
7
|
-
for (i = 0; i < len; i++) {
|
|
8
|
-
id[i] = chars[0 | Math.random() * radix];
|
|
9
|
-
}
|
|
10
|
-
} else {
|
|
11
|
-
let r;
|
|
12
|
-
id[8] = id[13] = id[18] = id[23] = "-";
|
|
13
|
-
id[14] = "4";
|
|
14
|
-
for (i = 0; i < 36; i++) {
|
|
15
|
-
if (!id[i]) {
|
|
16
|
-
r = 0 | Math.random() * 16;
|
|
17
|
-
id[i] = chars[i === 19 ? r & 3 | 8 : r];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return id.join("");
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { uuid as default };
|
|
1
|
+
function i(f=8,n=62){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),o=[];let t;if(n=n||e.length,f)for(t=0;t<f;t++)o[t]=e[0|Math.random()*n];else{let r;for(o[8]=o[13]=o[18]=o[23]="-",o[14]="4",t=0;t<36;t++)o[t]||(r=0|Math.random()*16,o[t]=e[t===19?r&3|8:r])}return o.join("")}export{i as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labelbee/lb-annotation",
|
|
3
|
-
"version": "1.14.0-alpha.
|
|
3
|
+
"version": "1.14.0-alpha.5",
|
|
4
4
|
"description": "Annotation tool collection",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"annotation",
|
|
@@ -94,11 +94,10 @@
|
|
|
94
94
|
"typescript": "^4.2.3"
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"@labelbee/lb-utils": "
|
|
97
|
+
"@labelbee/lb-utils": "1.7.0-alpha.5",
|
|
98
98
|
"@turf/turf": "5.1.6",
|
|
99
99
|
"color-rgba": "^2.3.0",
|
|
100
100
|
"lodash": "^4.17.20",
|
|
101
101
|
"three": ">=0.141.0"
|
|
102
|
-
}
|
|
103
|
-
"gitHead": "8387be3b500f75c181f38b73ea85fcc8a2543c26"
|
|
102
|
+
}
|
|
104
103
|
}
|