@labelbee/lb-annotation 1.14.0-alpha.2 → 1.14.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/MathUtilsWorker.js +8 -1
- package/dist/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +35 -2
- package/dist/_virtual/filterBoxWorker.js +8 -1
- package/dist/_virtual/highlightWorker.js +8 -1
- package/dist/assets/attributeIcon/icon_canvasEdit0.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_canvasEdit1.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_canvasEdit2.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_canvasEdit3.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_canvasEdit4.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_canvasEdit5.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_canvasEdit6.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_canvasEdit7.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_canvasEdit8.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_canvasEdit_miss.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -5
- package/dist/assets/attributeIcon/icon_cuboidLeft.svg.js +5 -7
- package/dist/assets/attributeIcon/icon_cuboidMore.svg.js +5 -5
- package/dist/assets/attributeIcon/icon_cuboidRight.svg.js +5 -5
- package/dist/assets/attributeIcon/icon_cuboidTop.svg.js +5 -12
- package/dist/assets/attributeIcon/icon_editFEN.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_editHUANG.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_editLAN.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_editLV.svg.js +5 -1
- package/dist/assets/attributeIcon/icon_editQING.svg.js +5 -1
- package/dist/constant/annotation.js +127 -1
- package/dist/constant/annotationTask.js +30 -1
- package/dist/constant/defaultConfig.js +266 -1
- package/dist/constant/keyCode.js +38 -1
- package/dist/constant/style.js +98 -1
- package/dist/constant/tool.js +236 -1
- package/dist/core/index.js +150 -1
- package/dist/core/pointCloud/OrbitControls.js +665 -1
- package/dist/core/pointCloud/PCDLoader.js +260 -2
- package/dist/core/pointCloud/annotation.js +215 -1
- package/dist/core/pointCloud/cache.js +53 -1
- package/dist/core/pointCloud/index.js +991 -5
- package/dist/core/pointCloud/matrix.js +138 -1
- package/dist/core/pointCloud/segmentation.js +144 -0
- package/dist/core/pointCloud/selector/Sse3dLassoSelector.js +26 -0
- package/dist/core/pointCloud/selector/Sse3dSelector.js +16 -0
- package/dist/core/scheduler.js +233 -1
- package/dist/core/toolOperation/LineToolOperation.js +1434 -1
- package/dist/core/toolOperation/ScribbleTool.js +292 -1
- package/dist/core/toolOperation/TextToolOperation.js +131 -1
- package/dist/core/toolOperation/ViewOperation.js +556 -1
- package/dist/core/toolOperation/basicToolOperation.js +881 -1
- package/dist/core/toolOperation/checkOperation.js +208 -1
- package/dist/core/toolOperation/cuboidOperation.js +754 -1
- package/dist/core/toolOperation/cuboidToggleButtonClass.js +152 -7
- package/dist/core/toolOperation/eventListener.js +37 -1
- package/dist/core/toolOperation/measureOperation.js +41 -1
- package/dist/core/toolOperation/pointCloud2dOperation.js +365 -1
- package/dist/core/toolOperation/pointOperation.js +696 -1
- package/dist/core/toolOperation/polygonOperation.js +1251 -1
- package/dist/core/toolOperation/rectOperation.js +1233 -1
- package/dist/core/toolOperation/segmentByRect.js +174 -1
- package/dist/core/toolOperation/tagOperation.js +201 -3
- package/dist/core/toolOperation/textAttributeClass.js +182 -16
- package/dist/index.js +185 -1
- package/dist/locales/constants.js +24 -1
- package/dist/locales/en_US/message.js +25 -1
- package/dist/locales/index.js +19 -1
- package/dist/locales/zh_CN/message.js +25 -1
- package/dist/newCore/CanvasScheduler.js +35 -1
- package/dist/types/core/pointCloud/segmentation.d.ts +0 -0
- package/dist/types/core/pointCloud/selector/Sse3dLassoSelector.d.ts +0 -0
- package/dist/types/core/pointCloud/selector/Sse3dSelector.d.ts +0 -0
- package/dist/utils/ActionsHistory.js +84 -1
- package/dist/utils/ImgUtils.js +23 -1
- package/dist/utils/MathUtils.js +385 -2
- package/dist/utils/VectorUtils.js +25 -1
- package/dist/utils/tool/AttributeUtils.js +218 -1
- package/dist/utils/tool/AxisUtils.js +340 -1
- package/dist/utils/tool/CanvasUtils.js +62 -1
- package/dist/utils/tool/CommonToolUtils.js +174 -1
- package/dist/utils/tool/CuboidUtils.js +704 -1
- package/dist/utils/tool/DblClickEventListener.js +102 -1
- package/dist/utils/tool/DrawUtils.js +492 -3
- package/dist/utils/tool/EnhanceCommonToolUtils.js +53 -1
- package/dist/utils/tool/ImgPosUtils.js +58 -1
- package/dist/utils/tool/LineToolUtils.js +261 -1
- package/dist/utils/tool/MarkerUtils.js +56 -1
- package/dist/utils/tool/PolygonUtils.js +460 -1
- package/dist/utils/tool/RectUtils.js +155 -1
- package/dist/utils/tool/RenderDomClass.js +57 -7
- package/dist/utils/tool/RenderDomUtils.js +21 -4
- package/dist/utils/tool/StyleUtils.js +31 -1
- package/dist/utils/tool/TagUtils.js +129 -1
- package/dist/utils/tool/UnitUtils.js +12 -1
- package/dist/utils/tool/ZoomUtils.js +72 -1
- package/dist/utils/tool/polygonTool.js +133 -1
- package/dist/utils/uuid.js +26 -1
- package/es/_virtual/MathUtilsWorker.js +6 -1
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +12 -0
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +7 -0
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +31 -2
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +11 -0
- package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +18 -0
- package/es/_virtual/filterBoxWorker.js +6 -1
- package/es/_virtual/highlightWorker.js +6 -1
- package/es/assets/attributeIcon/icon_canvasEdit0.svg.js +3 -1
- package/es/assets/attributeIcon/icon_canvasEdit1.svg.js +3 -1
- package/es/assets/attributeIcon/icon_canvasEdit2.svg.js +3 -1
- package/es/assets/attributeIcon/icon_canvasEdit3.svg.js +3 -1
- package/es/assets/attributeIcon/icon_canvasEdit4.svg.js +3 -1
- package/es/assets/attributeIcon/icon_canvasEdit5.svg.js +3 -1
- package/es/assets/attributeIcon/icon_canvasEdit6.svg.js +3 -1
- package/es/assets/attributeIcon/icon_canvasEdit7.svg.js +3 -1
- package/es/assets/attributeIcon/icon_canvasEdit8.svg.js +3 -1
- package/es/assets/attributeIcon/icon_canvasEdit_miss.svg.js +3 -1
- package/es/assets/attributeIcon/icon_cuboidFAB.svg.js +3 -5
- package/es/assets/attributeIcon/icon_cuboidLeft.svg.js +3 -7
- package/es/assets/attributeIcon/icon_cuboidMore.svg.js +3 -5
- package/es/assets/attributeIcon/icon_cuboidRight.svg.js +3 -5
- package/es/assets/attributeIcon/icon_cuboidTop.svg.js +3 -12
- package/es/assets/attributeIcon/icon_editFEN.svg.js +3 -1
- package/es/assets/attributeIcon/icon_editHUANG.svg.js +3 -1
- package/es/assets/attributeIcon/icon_editLAN.svg.js +3 -1
- package/es/assets/attributeIcon/icon_editLV.svg.js +3 -1
- package/es/assets/attributeIcon/icon_editQING.svg.js +3 -1
- package/es/constant/annotation.js +113 -1
- package/es/constant/annotationTask.js +25 -1
- package/es/constant/defaultConfig.js +260 -1
- package/es/constant/keyCode.js +36 -1
- package/es/constant/style.js +74 -1
- package/es/constant/tool.js +220 -1
- package/es/core/index.js +148 -1
- package/es/core/pointCloud/OrbitControls.js +661 -1
- package/es/core/pointCloud/PCDLoader.js +256 -2
- package/es/core/pointCloud/annotation.js +211 -1
- package/es/core/pointCloud/cache.js +49 -1
- package/es/core/pointCloud/index.js +962 -5
- package/es/core/pointCloud/matrix.js +109 -1
- package/es/core/pointCloud/segmentation.js +120 -0
- package/es/core/pointCloud/selector/Sse3dLassoSelector.js +24 -0
- package/es/core/pointCloud/selector/Sse3dSelector.js +14 -0
- package/es/core/scheduler.js +228 -1
- package/es/core/toolOperation/LineToolOperation.js +1421 -1
- package/es/core/toolOperation/ScribbleTool.js +290 -1
- package/es/core/toolOperation/TextToolOperation.js +129 -1
- package/es/core/toolOperation/ViewOperation.js +549 -1
- package/es/core/toolOperation/basicToolOperation.js +877 -1
- package/es/core/toolOperation/checkOperation.js +206 -1
- package/es/core/toolOperation/cuboidOperation.js +752 -1
- package/es/core/toolOperation/cuboidToggleButtonClass.js +150 -7
- package/es/core/toolOperation/eventListener.js +35 -1
- package/es/core/toolOperation/measureOperation.js +39 -1
- package/es/core/toolOperation/pointCloud2dOperation.js +359 -1
- package/es/core/toolOperation/pointOperation.js +690 -1
- package/es/core/toolOperation/polygonOperation.js +1245 -1
- package/es/core/toolOperation/rectOperation.js +1228 -1
- package/es/core/toolOperation/scribbleTool2.js +249 -0
- package/es/core/toolOperation/segmentByRect.js +172 -1
- package/es/core/toolOperation/tagOperation.js +199 -3
- package/es/core/toolOperation/textAttributeClass.js +180 -16
- package/es/index.js +46 -1
- package/es/locales/constants.js +22 -1
- package/es/locales/en_US/message.js +23 -1
- package/es/locales/index.js +17 -1
- package/es/locales/zh_CN/message.js +23 -1
- package/es/newCore/CanvasScheduler.js +31 -1
- package/es/utils/ActionsHistory.js +78 -1
- package/es/utils/ImgUtils.js +21 -1
- package/es/utils/MathUtils.js +380 -2
- package/es/utils/VectorUtils.js +23 -1
- package/es/utils/tool/AttributeUtils.js +212 -1
- package/es/utils/tool/AxisUtils.js +335 -1
- package/es/utils/tool/CanvasUtils.js +60 -1
- package/es/utils/tool/CommonToolUtils.js +172 -1
- package/es/utils/tool/CuboidUtils.js +680 -1
- package/es/utils/tool/DblClickEventListener.js +100 -1
- package/es/utils/tool/DrawUtils.js +490 -3
- package/es/utils/tool/EnhanceCommonToolUtils.js +48 -1
- package/es/utils/tool/ImgPosUtils.js +56 -1
- package/es/utils/tool/LineToolUtils.js +255 -1
- package/es/utils/tool/MarkerUtils.js +54 -1
- package/es/utils/tool/PolygonUtils.js +458 -1
- package/es/utils/tool/RectUtils.js +153 -1
- package/es/utils/tool/RenderDomClass.js +55 -7
- package/es/utils/tool/RenderDomUtils.js +19 -4
- package/es/utils/tool/StyleUtils.js +29 -1
- package/es/utils/tool/TagUtils.js +127 -1
- package/es/utils/tool/UnitUtils.js +10 -1
- package/es/utils/tool/ZoomUtils.js +70 -1
- package/es/utils/tool/polygonTool.js +126 -1
- package/es/utils/uuid.js +24 -1
- package/package.json +7 -5
|
@@ -1,20 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var DrawUtils = require('./DrawUtils.js');
|
|
4
|
+
var StyleUtils = require('./StyleUtils.js');
|
|
5
|
+
|
|
6
|
+
class RenderDomClass {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
this._domMap = new Map();
|
|
9
|
+
this._container = props.container;
|
|
10
|
+
this._height = props.height;
|
|
11
|
+
}
|
|
12
|
+
wheelChange(e) {
|
|
13
|
+
e.stopPropagation();
|
|
14
|
+
}
|
|
15
|
+
clearTag(id) {
|
|
16
|
+
const parentNode = this._container;
|
|
17
|
+
const oldDom = window.self.document.getElementById(id);
|
|
18
|
+
if (oldDom && parentNode && parentNode.contains(oldDom)) {
|
|
19
|
+
oldDom.removeEventListener("wheel", this.wheelChange);
|
|
20
|
+
parentNode == null ? void 0 : parentNode.removeChild(oldDom);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
render(annotations) {
|
|
24
|
+
const oldKeys = Array.from(this._domMap.keys());
|
|
25
|
+
const newKeys = annotations.map((v) => v.id);
|
|
26
|
+
annotations.forEach((v) => {
|
|
27
|
+
const {text, textMaxWidth, color = "white", background = "rgba(0, 0, 0, 0.6)", style} = v;
|
|
28
|
+
if (this._domMap.has(v.id)) {
|
|
29
|
+
const dom = this._domMap.get(v.id);
|
|
30
|
+
if (dom) {
|
|
31
|
+
dom.innerHTML = text;
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
const dom = DrawUtils.drawTagByDom(this._container, text, v.id);
|
|
35
|
+
if (dom) {
|
|
36
|
+
dom.setAttribute("style", `
|
|
2
37
|
position: absolute;
|
|
3
38
|
top: 0;
|
|
4
39
|
right: 0;
|
|
5
40
|
z-index: 20;
|
|
6
41
|
padding: 8px 20px;
|
|
7
42
|
font-size: 15px;
|
|
8
|
-
max-width: ${
|
|
9
|
-
color: ${
|
|
43
|
+
max-width: ${textMaxWidth}px;
|
|
44
|
+
color: ${color};
|
|
10
45
|
text-align: left;
|
|
11
46
|
line-height: 32px;
|
|
12
47
|
word-break: break-all;
|
|
13
48
|
white-space: pre-wrap;
|
|
14
|
-
background: ${
|
|
49
|
+
background: ${background};
|
|
15
50
|
opacity: 0.9;
|
|
16
|
-
max-height: ${this._height
|
|
51
|
+
max-height: ${this._height * 0.8}px;
|
|
17
52
|
overflow-y: scroll;
|
|
18
53
|
clear: both;
|
|
19
|
-
${StyleUtils.getStyle2String(
|
|
20
|
-
`)
|
|
54
|
+
${StyleUtils.getStyle2String(style)}
|
|
55
|
+
`);
|
|
56
|
+
dom.addEventListener("wheel", this.wheelChange);
|
|
57
|
+
this._domMap.set(v.id, dom);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
oldKeys.forEach((key) => {
|
|
62
|
+
if (newKeys.indexOf(key) === -1) {
|
|
63
|
+
this.clearTag(key);
|
|
64
|
+
this._domMap.delete(key);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
module.exports = RenderDomClass;
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('../../locales/index.js');
|
|
4
|
+
var constants = require('../../locales/constants.js');
|
|
5
|
+
|
|
6
|
+
const INVALID_PAGE_CLASS_NAME = "bee-invalid-page";
|
|
7
|
+
class RenderDomUtils {
|
|
8
|
+
static renderInvalidPage(container, size, lang) {
|
|
9
|
+
const invalidDOM = document.createElement("div");
|
|
10
|
+
invalidDOM.setAttribute("style", `
|
|
2
11
|
position: absolute;
|
|
3
12
|
left: 0px;
|
|
4
13
|
top: 0px;
|
|
5
|
-
width: ${
|
|
6
|
-
height: ${
|
|
14
|
+
width: ${size.width}px;
|
|
15
|
+
height: ${size.height}px;
|
|
7
16
|
background: rgba(255, 87, 34, 1);
|
|
8
17
|
overflow: hidden;
|
|
9
18
|
color: white;
|
|
@@ -13,4 +22,12 @@
|
|
|
13
22
|
font-size: 30px;
|
|
14
23
|
opacity: 0.7;
|
|
15
24
|
z-index: 30;
|
|
16
|
-
`)
|
|
25
|
+
`);
|
|
26
|
+
invalidDOM.innerHTML = index.getMessagesByLocale(constants.EMessage.InvalidImage, lang);
|
|
27
|
+
invalidDOM.className = INVALID_PAGE_CLASS_NAME;
|
|
28
|
+
container.appendChild(invalidDOM);
|
|
29
|
+
return invalidDOM;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
module.exports = RenderDomUtils;
|
|
@@ -1 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
class StyleUtils {
|
|
4
|
+
static getStrokeAndFill(toolStyle, valid = true, options = {}) {
|
|
5
|
+
const {isSelected = false, isHover = false} = options;
|
|
6
|
+
if (isSelected) {
|
|
7
|
+
return {
|
|
8
|
+
stroke: valid ? toolStyle.validSelected.stroke : toolStyle.invalidSelected.stroke,
|
|
9
|
+
fill: valid ? toolStyle.validSelected.fill : toolStyle.invalidSelected.fill
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
if (isHover) {
|
|
13
|
+
return {
|
|
14
|
+
stroke: valid ? toolStyle.validHover.stroke : toolStyle.invalidHover.stroke,
|
|
15
|
+
fill: valid ? toolStyle.validHover.fill : toolStyle.invalidHover.fill
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
stroke: valid ? toolStyle.valid.stroke : toolStyle.invalid.stroke,
|
|
20
|
+
fill: valid ? toolStyle.valid.fill : toolStyle.invalid.fill
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
static getStyle2String(style) {
|
|
24
|
+
if (!style) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
return Object.entries(style).reduce((acc, cur) => `${acc} ${cur[0]}: ${cur[1]};`, "");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = StyleUtils;
|
|
@@ -1 +1,129 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var uuid = require('../uuid.js');
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
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
|
+
class TagUtil {
|
|
22
|
+
static getTagKeyName(key, labelInfoSet) {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
if (!labelInfoSet) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
return (_b = (_a = labelInfoSet.find((v) => v.value === key)) == null ? void 0 : _a.key) != null ? _b : "";
|
|
28
|
+
}
|
|
29
|
+
static getTagName([key = "", value = ""], labelInfoSet) {
|
|
30
|
+
if (!labelInfoSet) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
for (const i of labelInfoSet) {
|
|
34
|
+
if (i.value === key) {
|
|
35
|
+
if (!i.subSelected) {
|
|
36
|
+
console.error("\u6807\u7B7E\u89E3\u6790\u9519\u8BEF", key, value);
|
|
37
|
+
return "";
|
|
38
|
+
}
|
|
39
|
+
for (const j of i.subSelected) {
|
|
40
|
+
if (j.value === value) {
|
|
41
|
+
return j.key;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
static getTagNameList(result, labelInfoSet) {
|
|
48
|
+
if (Object.keys(result).length <= 0) {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
return Object.entries(result).reduce((acc, cur) => {
|
|
52
|
+
const [key, value] = cur;
|
|
53
|
+
if (value && value.length > 0) {
|
|
54
|
+
const valueList = value.split(";");
|
|
55
|
+
const nameList = {
|
|
56
|
+
keyName: this.getTagKeyName(key, labelInfoSet),
|
|
57
|
+
value: valueList.map((v) => this.getTagName([key, v], labelInfoSet))
|
|
58
|
+
};
|
|
59
|
+
return [...acc, nameList];
|
|
60
|
+
}
|
|
61
|
+
return acc;
|
|
62
|
+
}, []).filter((v) => v);
|
|
63
|
+
}
|
|
64
|
+
static getTagnameListWithoutConfig(result) {
|
|
65
|
+
if (Object.keys(result).length <= 0) {
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
return Object.entries(result).reduce((acc, cur) => {
|
|
69
|
+
const [key, value] = cur;
|
|
70
|
+
const valueList = value.split(";");
|
|
71
|
+
const nameList = {
|
|
72
|
+
keyName: key,
|
|
73
|
+
value: valueList
|
|
74
|
+
};
|
|
75
|
+
return [...acc, nameList];
|
|
76
|
+
}, []).filter((v) => v);
|
|
77
|
+
}
|
|
78
|
+
static judgeResultIsInInputList(key, value, inputList) {
|
|
79
|
+
if (!key || !value || !inputList) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
const a = inputList.filter((v) => {
|
|
83
|
+
if (v.value === key && v.subSelected) {
|
|
84
|
+
const resultValue = value == null ? void 0 : value.split(";");
|
|
85
|
+
return (v == null ? void 0 : v.subSelected.filter((i) => resultValue.indexOf(i.value) > -1).length) > 0;
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
});
|
|
89
|
+
return a.length > 0;
|
|
90
|
+
}
|
|
91
|
+
static getDefaultResultByConfig(inputList) {
|
|
92
|
+
return inputList.reduce((acc, cur) => {
|
|
93
|
+
if (cur.subSelected) {
|
|
94
|
+
cur.subSelected.forEach((data) => {
|
|
95
|
+
var _a;
|
|
96
|
+
if (data.isDefault) {
|
|
97
|
+
const originResult = (_a = acc[cur.value]) != null ? _a : "";
|
|
98
|
+
let originResultList = [];
|
|
99
|
+
if (originResult.length > 0) {
|
|
100
|
+
originResultList = originResult.split(";");
|
|
101
|
+
}
|
|
102
|
+
originResultList.push(data.value);
|
|
103
|
+
acc[cur.value] = originResultList.join(";");
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return acc;
|
|
108
|
+
}, {});
|
|
109
|
+
}
|
|
110
|
+
static getDefaultTagResult(inputList, basicResultList) {
|
|
111
|
+
const defaultResult = this.getDefaultResultByConfig(inputList);
|
|
112
|
+
if (basicResultList.length > 0) {
|
|
113
|
+
return basicResultList.map((v) => ({
|
|
114
|
+
id: uuid(),
|
|
115
|
+
sourceID: v.id,
|
|
116
|
+
result: __spreadValues({}, defaultResult)
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
return [
|
|
120
|
+
{
|
|
121
|
+
id: uuid(),
|
|
122
|
+
sourceID: "",
|
|
123
|
+
result: __spreadValues({}, defaultResult)
|
|
124
|
+
}
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
module.exports = TagUtil;
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
class UnitUtils {
|
|
4
|
+
static deg2rad(angleDeg) {
|
|
5
|
+
return angleDeg * Math.PI / 180;
|
|
6
|
+
}
|
|
7
|
+
static rad2deg(angleRad) {
|
|
8
|
+
return angleRad * 180 / Math.PI;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
module.exports = UnitUtils;
|
|
@@ -1 +1,72 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var annotation = require('../../constant/annotation.js');
|
|
4
|
+
var MathUtils = require('../MathUtils.js');
|
|
5
|
+
|
|
6
|
+
const ZOOM_LEVEL = [1, 5, 10, 20, 30, 50, 80, 100].concat(Array.from({length: 9}).map((i, index) => (index + 2) * 100));
|
|
7
|
+
class ZoomUtils {
|
|
8
|
+
}
|
|
9
|
+
ZoomUtils.zoomChanged = (zoom, isZoomIn, growthMode = annotation.EGrowthMode.Linear) => {
|
|
10
|
+
switch (growthMode) {
|
|
11
|
+
case annotation.EGrowthMode.Intelligence: {
|
|
12
|
+
const maxZoom = Math.max(...ZOOM_LEVEL);
|
|
13
|
+
const minZoom = Math.min(...ZOOM_LEVEL);
|
|
14
|
+
const zoomIndex = ZOOM_LEVEL.slice(0, ZOOM_LEVEL.length).findIndex((i, index) => zoom >= i && (zoom < ZOOM_LEVEL[index + 1] || i === maxZoom));
|
|
15
|
+
let newZoom;
|
|
16
|
+
if (zoomIndex === -1) {
|
|
17
|
+
if (zoom >= minZoom && zoom <= maxZoom) {
|
|
18
|
+
newZoom = isZoomIn ? maxZoom : minZoom;
|
|
19
|
+
} else {
|
|
20
|
+
newZoom = isZoomIn ? minZoom : zoom;
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
const newZoomIndex = isZoomIn ? zoomIndex + 1 : zoomIndex - (ZOOM_LEVEL.includes(zoom) ? 1 : 0);
|
|
24
|
+
newZoom = ZOOM_LEVEL[MathUtils["default"].withinRange(newZoomIndex, [0, ZOOM_LEVEL.length - 1])];
|
|
25
|
+
}
|
|
26
|
+
return newZoom;
|
|
27
|
+
}
|
|
28
|
+
default: {
|
|
29
|
+
const ratio = isZoomIn ? 2 : 1 / 2;
|
|
30
|
+
return zoom * ratio;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
ZoomUtils.wheelChangePos = (imgNode, coord, operator, oldCurrentPos, options = {}) => {
|
|
35
|
+
const {zoom = 1, innerZoom = 1, basicZoom = 1, zoomMax = 1e3, rotate = 0} = options;
|
|
36
|
+
const {x, y} = oldCurrentPos;
|
|
37
|
+
const ratio = parseFloat((zoom + 1 / 10).toFixed(1)) / 5;
|
|
38
|
+
if (imgNode && coord) {
|
|
39
|
+
let {width, height} = imgNode;
|
|
40
|
+
if ([90, 270].includes(rotate)) {
|
|
41
|
+
width = imgNode.height;
|
|
42
|
+
height = imgNode.width;
|
|
43
|
+
}
|
|
44
|
+
const imgWidth = width * innerZoom;
|
|
45
|
+
const imgHeight = height * innerZoom;
|
|
46
|
+
const offsetLeft = coord.x - x;
|
|
47
|
+
const offsetTop = coord.y - y;
|
|
48
|
+
const ratioX = offsetLeft / imgWidth;
|
|
49
|
+
const ratioY = offsetTop / imgHeight;
|
|
50
|
+
let currentZoom = zoom + operator * ratio;
|
|
51
|
+
currentZoom = MathUtils["default"].withinRange(currentZoom, [basicZoom, zoomMax]);
|
|
52
|
+
const changeX = width * currentZoom * ratioX;
|
|
53
|
+
const changeY = height * currentZoom * ratioY;
|
|
54
|
+
const currentX = x + (offsetLeft - changeX);
|
|
55
|
+
const currentY = y + (offsetTop - changeY);
|
|
56
|
+
return {
|
|
57
|
+
zoom: currentZoom,
|
|
58
|
+
currentPos: {
|
|
59
|
+
x: currentX,
|
|
60
|
+
y: currentY
|
|
61
|
+
},
|
|
62
|
+
imgInfo: {
|
|
63
|
+
width: width * currentZoom,
|
|
64
|
+
height: height * currentZoom
|
|
65
|
+
},
|
|
66
|
+
ratio
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
module.exports = ZoomUtils;
|
|
@@ -1 +1,133 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tool = require('../../constant/tool.js');
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __defProps = Object.defineProperties;
|
|
9
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
10
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
13
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
|
|
14
|
+
var __spreadValues = (a, b) => {
|
|
15
|
+
for (var prop in b || (b = {}))
|
|
16
|
+
if (__hasOwnProp.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
if (__getOwnPropSymbols)
|
|
19
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
20
|
+
if (__propIsEnum.call(b, prop))
|
|
21
|
+
__defNormalProp(a, prop, b[prop]);
|
|
22
|
+
}
|
|
23
|
+
return a;
|
|
24
|
+
};
|
|
25
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
26
|
+
function createSmoothCurvePoints(points, tension = 0.5, closed = false, numberOfSegments = 16) {
|
|
27
|
+
if (points.length < 4) {
|
|
28
|
+
return points;
|
|
29
|
+
}
|
|
30
|
+
const result = [];
|
|
31
|
+
const ps = points.slice(0);
|
|
32
|
+
let x;
|
|
33
|
+
let y;
|
|
34
|
+
let t1x;
|
|
35
|
+
let t2x;
|
|
36
|
+
let t1y;
|
|
37
|
+
let t2y;
|
|
38
|
+
let c1;
|
|
39
|
+
let c2;
|
|
40
|
+
let c3;
|
|
41
|
+
let c4;
|
|
42
|
+
let st;
|
|
43
|
+
let t;
|
|
44
|
+
let i;
|
|
45
|
+
if (closed) {
|
|
46
|
+
ps.unshift(points[points.length - 1]);
|
|
47
|
+
ps.unshift(points[points.length - 2]);
|
|
48
|
+
ps.unshift(points[points.length - 1]);
|
|
49
|
+
ps.unshift(points[points.length - 2]);
|
|
50
|
+
ps.push(points[0]);
|
|
51
|
+
ps.push(points[1]);
|
|
52
|
+
} else {
|
|
53
|
+
ps.unshift(points[1]);
|
|
54
|
+
ps.unshift(points[0]);
|
|
55
|
+
ps.push(points[points.length - 2]);
|
|
56
|
+
ps.push(points[points.length - 1]);
|
|
57
|
+
}
|
|
58
|
+
for (i = 2; i < ps.length - 4; i += 2) {
|
|
59
|
+
t1x = (ps[i + 2] - ps[i - 2]) * tension;
|
|
60
|
+
t2x = (ps[i + 4] - ps[i - 0]) * tension;
|
|
61
|
+
t1y = (ps[i + 3] - ps[i - 1]) * tension;
|
|
62
|
+
t2y = (ps[i + 5] - ps[i + 1]) * tension;
|
|
63
|
+
for (t = 0; t <= numberOfSegments; t++) {
|
|
64
|
+
st = t / numberOfSegments;
|
|
65
|
+
c1 = 2 * Math.pow(st, 3) - 3 * Math.pow(st, 2) + 1;
|
|
66
|
+
c2 = -(2 * Math.pow(st, 3)) + 3 * Math.pow(st, 2);
|
|
67
|
+
c3 = Math.pow(st, 3) - 2 * Math.pow(st, 2) + st;
|
|
68
|
+
c4 = Math.pow(st, 3) - Math.pow(st, 2);
|
|
69
|
+
x = c1 * ps[i] + c2 * ps[i + 2] + c3 * t1x + c4 * t2x;
|
|
70
|
+
y = c1 * ps[i + 1] + c2 * ps[i + 3] + c3 * t1y + c4 * t2y;
|
|
71
|
+
result.push(x);
|
|
72
|
+
result.push(y);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const formatResult = [];
|
|
76
|
+
for (let j = 0; j < result.length - 1; j += 2) {
|
|
77
|
+
formatResult.push({
|
|
78
|
+
x: result[j],
|
|
79
|
+
y: result[j + 1]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (closed) {
|
|
83
|
+
for (let j = 0; j < numberOfSegments + 1; j++) {
|
|
84
|
+
const d = formatResult.shift();
|
|
85
|
+
formatResult.push(d);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return formatResult;
|
|
89
|
+
}
|
|
90
|
+
const createSmoothCurvePointsFromPointList = (pointList, numberOfSegments = 16) => createSmoothCurvePoints(pointList.reduce((acc, cur) => {
|
|
91
|
+
return [...acc, cur.x, cur.y];
|
|
92
|
+
}, []), 0.5, false, numberOfSegments);
|
|
93
|
+
function isInPolygon(checkPoint, polygonPoints, lineType = tool.ELineTypes.Line) {
|
|
94
|
+
let counter = 0;
|
|
95
|
+
let i;
|
|
96
|
+
let xinters;
|
|
97
|
+
let p1;
|
|
98
|
+
let p2;
|
|
99
|
+
polygonPoints = [...polygonPoints];
|
|
100
|
+
if (lineType === tool.ELineTypes.Curve) {
|
|
101
|
+
polygonPoints = createSmoothCurvePoints(polygonPoints.reduce((acc, cur) => {
|
|
102
|
+
return [...acc, cur.x, cur.y];
|
|
103
|
+
}, []), 0.5, true, tool.SEGMENT_NUMBER);
|
|
104
|
+
}
|
|
105
|
+
[p1] = polygonPoints;
|
|
106
|
+
const pointCount = polygonPoints.length;
|
|
107
|
+
for (i = 1; i <= pointCount; i++) {
|
|
108
|
+
p2 = polygonPoints[i % pointCount];
|
|
109
|
+
if (checkPoint.x > Math.min(p1.x, p2.x) && checkPoint.x <= Math.max(p1.x, p2.x)) {
|
|
110
|
+
if (checkPoint.y <= Math.max(p1.y, p2.y)) {
|
|
111
|
+
if (p1.x !== p2.x) {
|
|
112
|
+
xinters = (checkPoint.x - p1.x) * (p2.y - p1.y) / (p2.x - p1.x) + p1.y;
|
|
113
|
+
if (p1.y === p2.y || checkPoint.y <= xinters) {
|
|
114
|
+
counter++;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
p1 = p2;
|
|
120
|
+
}
|
|
121
|
+
if (counter % 2 === 0) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
function getPolygonPointUnderZoom(pointList, zoom = 1) {
|
|
127
|
+
return pointList.map((v) => __spreadProps(__spreadValues({}, v), {x: v.x * zoom, y: v.y * zoom}));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
exports.createSmoothCurvePoints = createSmoothCurvePoints;
|
|
131
|
+
exports.createSmoothCurvePointsFromPointList = createSmoothCurvePointsFromPointList;
|
|
132
|
+
exports.getPolygonPointUnderZoom = getPolygonPointUnderZoom;
|
|
133
|
+
exports.isInPolygon = isInPolygon;
|
package/dist/utils/uuid.js
CHANGED
|
@@ -1 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function uuid(len = 8, radix = 62) {
|
|
4
|
+
const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");
|
|
5
|
+
const id = [];
|
|
6
|
+
let i;
|
|
7
|
+
radix = radix || chars.length;
|
|
8
|
+
if (len) {
|
|
9
|
+
for (i = 0; i < len; i++) {
|
|
10
|
+
id[i] = chars[0 | Math.random() * radix];
|
|
11
|
+
}
|
|
12
|
+
} else {
|
|
13
|
+
let r;
|
|
14
|
+
id[8] = id[13] = id[18] = id[23] = "-";
|
|
15
|
+
id[14] = "4";
|
|
16
|
+
for (i = 0; i < 36; i++) {
|
|
17
|
+
if (!id[i]) {
|
|
18
|
+
r = 0 | Math.random() * 16;
|
|
19
|
+
id[i] = chars[i === 19 ? r & 3 | 8 : r];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return id.join("");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = uuid;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
import{createBase64WorkerFactory
|
|
1
|
+
import { createBase64WorkerFactory } from './_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js';
|
|
2
|
+
|
|
3
|
+
var WorkerFactory = createBase64WorkerFactory('Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICd1c2Ugc3RyaWN0JzsKCiAgdmFyIF9fZGVmUHJvcCA9IE9iamVjdC5kZWZpbmVQcm9wZXJ0eTsKICB2YXIgX19nZXRPd25Qcm9wU3ltYm9scyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHM7CiAgdmFyIF9faGFzT3duUHJvcCA9IE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHk7CiAgdmFyIF9fcHJvcElzRW51bSA9IE9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGU7CiAgdmFyIF9fZGVmTm9ybWFsUHJvcCA9IChvYmosIGtleSwgdmFsdWUpID0+IGtleSBpbiBvYmogPyBfX2RlZlByb3Aob2JqLCBrZXksIHtlbnVtZXJhYmxlOiB0cnVlLCBjb25maWd1cmFibGU6IHRydWUsIHdyaXRhYmxlOiB0cnVlLCB2YWx1ZX0pIDogb2JqW2tleV0gPSB2YWx1ZTsKICB2YXIgX19zcHJlYWRWYWx1ZXMgPSAoYSwgYikgPT4gewogICAgZm9yICh2YXIgcHJvcCBpbiBiIHx8IChiID0ge30pKQogICAgICBpZiAoX19oYXNPd25Qcm9wLmNhbGwoYiwgcHJvcCkpCiAgICAgICAgX19kZWZOb3JtYWxQcm9wKGEsIHByb3AsIGJbcHJvcF0pOwogICAgaWYgKF9fZ2V0T3duUHJvcFN5bWJvbHMpCiAgICAgIGZvciAodmFyIHByb3Agb2YgX19nZXRPd25Qcm9wU3ltYm9scyhiKSkgewogICAgICAgIGlmIChfX3Byb3BJc0VudW0uY2FsbChiLCBwcm9wKSkKICAgICAgICAgIF9fZGVmTm9ybWFsUHJvcChhLCBwcm9wLCBiW3Byb3BdKTsKICAgICAgfQogICAgcmV0dXJuIGE7CiAgfTsKICBjbGFzcyBDb21tb25Ub29sVXRpbHMgewogICAgc3RhdGljIGZpbmRBbGxMaW5lKHBvaW50TGlzdCwgaXNDbG9zZSA9IHRydWUpIHsKICAgICAgY29uc3QgYXJyID0gW107CiAgICAgIGNvbnN0IG5ld1BvaW50ID0gWy4uLnBvaW50TGlzdF07CiAgICAgIGlmIChuZXdQb2ludC5sZW5ndGggPj0gMyAmJiBpc0Nsb3NlID09PSB0cnVlKSB7CiAgICAgICAgbmV3UG9pbnQucHVzaChfX3NwcmVhZFZhbHVlcyh7fSwgbmV3UG9pbnRbMF0pKTsKICAgICAgfQogICAgICBmb3IgKGxldCBpID0gMDsgaSA8IG5ld1BvaW50Lmxlbmd0aDsgaSsrKSB7CiAgICAgICAgaWYgKG5ld1BvaW50W2kgKyAxXSkgewogICAgICAgICAgYXJyLnB1c2goewogICAgICAgICAgICBwb2ludDE6IG5ld1BvaW50W2ldLAogICAgICAgICAgICBwb2ludDI6IG5ld1BvaW50W2kgKyAxXSwKICAgICAgICAgICAgcG9pbnRJbmRleDogaQogICAgICAgICAgfSk7CiAgICAgICAgfQogICAgICB9CiAgICAgIHJldHVybiBhcnI7CiAgICB9CiAgfQogIGNsYXNzIE1hdGhVdGlscyB7CiAgICBzdGF0aWMgaXNJblJhbmdlKHZhbHVlLCByYW5nZSkgewogICAgICBjb25zdCBtaW4gPSBNYXRoLm1pbiguLi5yYW5nZSk7CiAgICAgIGNvbnN0IG1heCA9IE1hdGgubWF4KC4uLnJhbmdlKTsKICAgICAgY29uc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0gdmVjdG9yMi54ICogdmVjdG9yMS55OwogICAgfQogICAgc3RhdGljIGdldEZvb3RPZlBlcnBlbmRpY3VsYXIocHQsIGJlZ2luLCBlbmQsIHVzZUF4aXNSYW5nZSA9IGZhbHNlKSB7CiAgICAgIGxldCByZXRWYWwgPSB7eDogMCwgeTogMH07CiAgICAgIGNvbnN0IGR4ID0gYmVnaW4ueCAtIGVuZC54OwogICAgICBjb25zdCBkeSA9IGJlZ2luLnkgLSBlbmQueTsKICAgICAgaWYgKE1hdGguYWJzKGR4KSA8IDFlLTggJiYgTWF0aC5hYnMoZHkpIDwgMWUtOCkgewogICAgICAgIHJldFZhbCA9IGJlZ2luOwogICAgICAgIHJldHVybiByZXRWYWw7CiAgICAgIH0KICAgICAgbGV0IHUgPSAocHQueCAtIGJlZ2luLngpICogKGJlZ2luLnggLSBlbmQueCkgKyAocHQueSAtIGJlZ2luLnkpICogKGJlZ2luLnkgLSBlbmQueSk7CiAgICAgIHUgLz0gZHggKiBkeCArIGR5ICogZHk7CiAgICAgIHJldFZhbC54ID0gYmVnaW4ueCArIHUgKiBkeDsKICAgICAgcmV0VmFsLnkgPSBiZWdpbi55ICsgdSAqIGR5OwogICAgICBjb25zdCBsZW5ndGggPSB0aGlzLmdldExpbmVMZW5ndGgocHQsIHJldFZhbCk7CiAgICAgIGNvbnN0IHJhdGlvID0gMjsKICAgICAgaWYgKGxlbmd0aCA+IDIpIHsKICAgICAgICByZXR1cm4gewogICAgICAgICAgZm9vdFBvaW50OiByZXRWYWwsCiAgICAgICAgICBsZW5ndGg6IEluZmluaXR5CiAgICAgICAgfTsKICAgICAgfQogICAgICBjb25zdCBmcm9tWCA9IE1hdGgubWluKGJlZ2luLngsIGVuZC54KTsKICAgICAgY29uc3QgdG9YID0gTWF0aC5tYXgoYmVnaW4ueCwgZW5kLngpOwogICAgICBjb25zdCBmcm9tWSA9IE1hdGgubWluKGJlZ2luLnksIGVuZC55KTsKICAgICAgY29uc3QgdG9ZID0gTWF0aC5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lZ21lbnRzID0gMjA7CiAgICBsZXQgaXNDbG9zZU5vZGUgPSBmYWxzZTsKICAgIHBvbHlnb25MaXN0LmZvckVhY2goKHYpID0+IHsKICAgICAgaWYgKGlzQ2xvc2VOb2RlKSB7CiAgICAgICAgcmV0dXJuOwogICAgICB9CiAgICAgIGlmICghdi5wb2ludExpc3QpIHsKICAgICAgICByZXR1cm47CiAgICAgIH0KICAgICAgc3dpdGNoIChsaW5lVHlwZSkgewogICAgICAgIGNhc2UgMDoKICAgICAgICAgIHsKICAgICAgICAgICAgY29uc3QgYWxsTGluZSA9IENvbW1vblRvb2xVdGlscy5maW5kQWxsTGluZSh2LnBvaW50TGlzdCwgaXNDbG9zZSk7CiAgICAgICAgICAgIGFsbExpbmUuZm9yRWFjaCgobGluZSwgbGluZUluZGV4KSA9PiB7CiAgICAgICAgICAgICAgaWYgKGlzQ2xvc2VOb2RlKSB7CiAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGNvbnN0IHR3b1BvaW50RGlzdGFuY2UxID0gTWF0aFV0aWxzLmdldExpbmVMZW5ndGgobGluZS5wb2ludDEsIGNvb3JkaW5hdGUpOwogICAgICAgICAgICAgIGNvbnN0IHR3b1BvaW50RGlzdGFuY2UyID0gTWF0aFV0aWxzLmdldExpbmVMZW5ndGgobGluZS5wb2ludDIsIGNvb3JkaW5hdGUpOwogICAgICAgICAgICAgIGlmIChNYXRoVXRpbHMuaXNPdXRPZlJhbmdlKGNvb3JkaW5hdGUsIGxpbmUucG9pbnQxLCBsaW5lLnBvaW50MiwgcmFuZ2UpKSB7CiAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGxldCB7bGVuZ3RoLCBmb290UG9pbnR9ID0gTWF0aFV0aWxzLmdldEZvb3RPZlBlcnBlbmRpY3VsYXIoY29vcmRpbmF0ZSwgbGluZS5wb2ludDEsIGxpbmUucG9pbnQyKTsKICAgICAgICAgICAgICBpZiAodHdvUG9pbnREaXN0YW5jZTEgPCByYW5nZSAqIDIpIHsKICAgICAgICAgICAgICAgIGZvb3RQb2ludCA9IGxpbmUucG9pbnQxOwogICAgICAgICAgICAgICAgbGVuZ3RoID0gdHdvUG9pbnREaXN0YW5jZTE7CiAgICAgICAgICAgICAgICBpc0Nsb3NlTm9kZSA9IHRydWU7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmICh0d29Qb2ludERpc3RhbmNlMiA8IHJhbmdlICogMikgewogICAgICAgICAgICAgICAgZm9vdFBvaW50ID0gbGluZS5wb2ludDI7CiAgICAgICAgICAgICAgICBsZW5ndGggPSB0d29Qb2ludERpc3RhbmNlMjsKICAgICAgICAgICAgICAgIGlzQ2xvc2VOb2RlID0gdHJ1ZTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgaWYgKGxlbmd0aCA8IG1pbiAmJiBsZW5ndGggPCByYW5nZSkgewogICAgICAgICAgICAgICAgY2xvc2VzdFBvbHlnb25JRCA9IHYuaWQ7CiAgICAgICAgICAgICAgICBjbG9zZXN0RWRnZUluZGV4ID0gbGluZUluZGV4OwogICAgICAgICAgICAgICAgbWluID0gbGVuZ3RoOwogICAgICAgICAgICAgICAgZHJvcEZvb3QgPSBmb290UG9pbnQ7CiAgICAgICAgICAgICAgICBoYXNDbG9zZWQgPSB0cnVlOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICB9CiAgICAgICAgICBicmVhazsKICAgICAgICBjYXNlIDE6CiAgICAgICAgICB7CiAgICAgICAgICAgIGNvbnN0IHBvaW50cyA9IHRoaXMuY3JlYXRlU21vb3RoQ3VydmVQb2ludHModi5wb2ludExpc3QucmVkdWNlKChhY2MsIGN1cikgPT4gewogICAgICAgICAgICAgIHJldHVybiBbLi4uYWNjLCBjdXIueCwgY3VyLnldOwogICAgICAgICAgICB9LCBbXSksIDAuNSwgaXNDbG9zZSwgbnVtYmVyT2ZTZWdtZW50cyk7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AgIGp1ZGdlSXNDb25uZWN0UG9pbnQocG9pbnQsIG5ld1BvbHlnb25MaXN0KTsKICAgICAgICAgIH0pOwogICAgICAgIH0pOwogICAgICB9KTsKICAgICAgcG9zdE1lc3NhZ2Uoe2Nvbm5lY3Rpb25Qb2ludHN9KTsKICAgIH0gY2F0Y2ggKEUpIHsKICAgICAgY29uc29sZS5lcnJvcihFKTsKICAgICAgcG9zdE1lc3NhZ2Uoe2Nvbm5lY3Rpb25Qb2ludHM6IFtdfSk7CiAgICB9CiAgfTsKCn0pKCk7Cgo=', null, false);
|
|
4
|
+
/* eslint-enable */
|
|
5
|
+
|
|
6
|
+
export { WorkerFactory as default };
|
package/es/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createBase64WorkerFactory as createBase64WorkerFactory$1 } from './_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js';
|
|
2
|
+
import { createBase64WorkerFactory as createBase64WorkerFactory$2 } from './_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js';
|
|
3
|
+
import { isNodeJS } from './_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js';
|
|
4
|
+
|
|
5
|
+
function createBase64WorkerFactory(base64, sourcemapArg, enableUnicodeArg) {
|
|
6
|
+
if (isNodeJS()) {
|
|
7
|
+
return createBase64WorkerFactory$1(base64, sourcemapArg, enableUnicodeArg);
|
|
8
|
+
}
|
|
9
|
+
return createBase64WorkerFactory$2(base64, sourcemapArg, enableUnicodeArg);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { createBase64WorkerFactory };
|
package/es/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js
CHANGED
|
@@ -1,2 +1,31 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
1
|
+
function decodeBase64(base64, enableUnicode) {
|
|
2
|
+
var binaryString = atob(base64);
|
|
3
|
+
if (enableUnicode) {
|
|
4
|
+
var binaryView = new Uint8Array(binaryString.length);
|
|
5
|
+
for (var i = 0, n = binaryString.length; i < n; ++i) {
|
|
6
|
+
binaryView[i] = binaryString.charCodeAt(i);
|
|
7
|
+
}
|
|
8
|
+
return String.fromCharCode.apply(null, new Uint16Array(binaryView.buffer));
|
|
9
|
+
}
|
|
10
|
+
return binaryString;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function createURL(base64, sourcemapArg, enableUnicodeArg) {
|
|
14
|
+
var sourcemap = sourcemapArg === undefined ? null : sourcemapArg;
|
|
15
|
+
var enableUnicode = enableUnicodeArg === undefined ? false : enableUnicodeArg;
|
|
16
|
+
var source = decodeBase64(base64, enableUnicode);
|
|
17
|
+
var start = source.indexOf('\n', 10) + 1;
|
|
18
|
+
var body = source.substring(start) + (sourcemap ? '\/\/# sourceMappingURL=' + sourcemap : '');
|
|
19
|
+
var blob = new Blob([body], { type: 'application/javascript' });
|
|
20
|
+
return URL.createObjectURL(blob);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function createBase64WorkerFactory(base64, sourcemapArg, enableUnicodeArg) {
|
|
24
|
+
var url;
|
|
25
|
+
return function WorkerFactory(options) {
|
|
26
|
+
url = url || createURL(base64, sourcemapArg, enableUnicodeArg);
|
|
27
|
+
return new Worker(url, options);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { createBase64WorkerFactory };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var WorkerClass = null;
|
|
2
|
+
|
|
3
|
+
try {
|
|
4
|
+
var WorkerThreads =
|
|
5
|
+
typeof module !== 'undefined' && typeof module.require === 'function' && module.require('worker_threads') ||
|
|
6
|
+
typeof __non_webpack_require__ === 'function' && __non_webpack_require__('worker_threads') ||
|
|
7
|
+
typeof require === 'function' && require('worker_threads');
|
|
8
|
+
WorkerClass = WorkerThreads.Worker;
|
|
9
|
+
} catch(e) {} // eslint-disable-line
|
|
10
|
+
|
|
11
|
+
export { WorkerClass };
|
package/es/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WorkerClass } from './_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js';
|
|
2
|
+
|
|
3
|
+
function decodeBase64(base64, enableUnicode) {
|
|
4
|
+
return Buffer.from(base64, 'base64').toString(enableUnicode ? 'utf16' : 'utf8');
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function createBase64WorkerFactory(base64, sourcemapArg, enableUnicodeArg) {
|
|
8
|
+
var sourcemap = sourcemapArg === undefined ? null : sourcemapArg;
|
|
9
|
+
var enableUnicode = enableUnicodeArg === undefined ? false : enableUnicodeArg;
|
|
10
|
+
var source = decodeBase64(base64, enableUnicode);
|
|
11
|
+
var start = source.indexOf('\n', 10) + 1;
|
|
12
|
+
var body = source.substring(start) + (sourcemap ? '\/\/# sourceMappingURL=' + sourcemap : '');
|
|
13
|
+
return function WorkerFactory(options) {
|
|
14
|
+
return new WorkerClass(body, Object.assign({}, options, { eval: true }));
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { createBase64WorkerFactory };
|