@realsee/dnalogel 3.48.0 → 3.48.2
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/CHANGELOG.md +6 -0
- package/dist/Sculpt/Objects/Base/index.d.ts +16 -0
- package/dist/Sculpt/Objects/Line/index.d.ts +12 -1
- package/dist/Sculpt/Objects/Polygon/index.d.ts +12 -1
- package/dist/Sculpt/Objects/Polyline/index.d.ts +12 -1
- package/dist/Sculpt/index.d.ts +10 -3
- package/dist/index.cjs.js +57 -57
- package/dist/index.js +5011 -4885
- package/dist/index.umd.js +50 -50
- package/dist/shared-utils/promise/withResolvers.d.ts +10 -0
- package/dist/shared-utils/three/Magnifier.d.ts +1 -1
- package/dist/shared-utils/three/PointSelector/utils/PointSelectorHelper.d.ts +4 -1
- package/libs/Sculpt/Meshes/Line.js +15 -15
- package/libs/Sculpt/Meshes/Polygon.js +20 -20
- package/libs/Sculpt/Objects/Base/index.d.ts +16 -0
- package/libs/Sculpt/Objects/Base/index.js +58 -32
- package/libs/Sculpt/Objects/Box/index.js +31 -34
- package/libs/Sculpt/Objects/Circle/index.js +36 -39
- package/libs/Sculpt/Objects/Line/index.d.ts +12 -1
- package/libs/Sculpt/Objects/Line/index.js +104 -75
- package/libs/Sculpt/Objects/Point/index.js +13 -16
- package/libs/Sculpt/Objects/Polygon/index.d.ts +12 -1
- package/libs/Sculpt/Objects/Polygon/index.js +112 -84
- package/libs/Sculpt/Objects/Polyline/index.d.ts +12 -1
- package/libs/Sculpt/Objects/Polyline/index.js +97 -68
- package/libs/Sculpt/Objects/Prism/index.js +20 -23
- package/libs/Sculpt/Objects/Rectangle/index.js +36 -39
- package/libs/Sculpt/index.d.ts +10 -3
- package/libs/Sculpt/index.js +80 -65
- package/libs/base/BasePlugin.js +1 -1
- package/libs/index.js +127 -126
- package/libs/shared-utils/logger.js +1 -1
- package/libs/shared-utils/promise/withResolvers.d.ts +10 -0
- package/libs/shared-utils/promise/withResolvers.js +13 -0
- package/libs/shared-utils/tag.js +9 -9
- package/libs/shared-utils/three/Magnifier.d.ts +1 -1
- package/libs/shared-utils/three/Magnifier.js +12 -12
- package/libs/shared-utils/three/PointSelector/utils/PointSelectorHelper.d.ts +4 -1
- package/libs/shared-utils/three/PointSelector/utils/PointSelectorHelper.js +9 -9
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface PromiseWithResolvers<T> {
|
|
2
|
+
promise: Promise<T>;
|
|
3
|
+
resolve: (value: T | PromiseLike<T>) => void;
|
|
4
|
+
reject: (reason?: any) => void;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* @description Promise.withResolvers polyfill
|
|
8
|
+
*/
|
|
9
|
+
export declare function withResolvers<T>(): PromiseWithResolvers<T>;
|
|
10
|
+
export {};
|
|
@@ -57,13 +57,13 @@ export declare class Magnifier {
|
|
|
57
57
|
y: number;
|
|
58
58
|
}): void;
|
|
59
59
|
resetOffset(): void;
|
|
60
|
+
render(): void;
|
|
60
61
|
protected getRenderCenter(): THREE.Vector3 | {
|
|
61
62
|
x: number;
|
|
62
63
|
y: number;
|
|
63
64
|
};
|
|
64
65
|
private _appendTo;
|
|
65
66
|
private autoFixPCPosition;
|
|
66
|
-
private render;
|
|
67
67
|
private initStyle;
|
|
68
68
|
private getPanOffset;
|
|
69
69
|
private onPanstart;
|
|
@@ -27,7 +27,10 @@ export declare class PointSelectorHelper {
|
|
|
27
27
|
position: PointIntersection | undefined;
|
|
28
28
|
magnifier: Magnifier | null;
|
|
29
29
|
pointHelper: PointHelperAbstract | null;
|
|
30
|
-
|
|
30
|
+
state: {
|
|
31
|
+
enabled: boolean;
|
|
32
|
+
visible: boolean;
|
|
33
|
+
};
|
|
31
34
|
private group;
|
|
32
35
|
constructor(five: Five, options?: PointSelectorHelperConfig);
|
|
33
36
|
show: () => void;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var _ = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var k = Object.prototype.hasOwnProperty,
|
|
2
|
+
var m = Object.getOwnPropertySymbols;
|
|
3
|
+
var k = Object.prototype.hasOwnProperty, p = Object.prototype.propertyIsEnumerable;
|
|
4
4
|
var f = (o, s, e) => s in o ? _(o, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[s] = e, y = (o, s) => {
|
|
5
5
|
for (var e in s || (s = {}))
|
|
6
6
|
k.call(s, e) && f(o, e, s[e]);
|
|
7
|
-
if (
|
|
8
|
-
for (var e of
|
|
9
|
-
|
|
7
|
+
if (m)
|
|
8
|
+
for (var e of m(s))
|
|
9
|
+
p.call(s, e) && f(o, e, s[e]);
|
|
10
10
|
return o;
|
|
11
11
|
};
|
|
12
12
|
var l = (o, s, e) => (f(o, typeof s != "symbol" ? s + "" : s, e), e);
|
|
13
13
|
import * as u from "three";
|
|
14
|
-
import { DEFAULT_LINE_COLOR as
|
|
14
|
+
import { DEFAULT_LINE_COLOR as b, DEFAULT_LINE_WIDTH as S, DEFAULT_HIGHLIGHT_OPACITY as D } from "../typings/style.js";
|
|
15
15
|
import { LineGeometry as L, LineMaterial as w, THREE_Line2 as I } from "../../shared-utils/five/FiveLine.js";
|
|
16
16
|
import { anyPositionToVector3 as H } from "../../shared-utils/positionToVector3.js";
|
|
17
17
|
import { IObject3D as R } from "../../shared-utils/three/IObject3D.js";
|
|
@@ -21,7 +21,7 @@ import { centerPoint as C } from "../../shared-utils/three/centerPoint.js";
|
|
|
21
21
|
import { LightTag as x } from "../../shared-utils/tag.js";
|
|
22
22
|
import { removeAllTag as v } from "../utils/removeAllTag.js";
|
|
23
23
|
import { getLengthHTML as W } from "../utils/Meshes/getLengthHTML.js";
|
|
24
|
-
import { applyObjectMatrixWorld as
|
|
24
|
+
import { applyObjectMatrixWorld as T } from "../../shared-utils/three/applyObjectMatrixWorld.js";
|
|
25
25
|
import "../../shared-utils/three/THREESphere.js";
|
|
26
26
|
import "animejs";
|
|
27
27
|
import { notNil as c } from "../../shared-utils/isNil.js";
|
|
@@ -66,14 +66,14 @@ class Q extends R {
|
|
|
66
66
|
l(this, "lastRenderLengthItem");
|
|
67
67
|
this.paramsStyle = e != null ? e : {};
|
|
68
68
|
const i = new L(), t = new E({
|
|
69
|
-
color: new u.Color((h = e == null ? void 0 : e.lineColor) != null ? h :
|
|
70
|
-
linewidth: (r = e == null ? void 0 : e.lineWidth) != null ? r :
|
|
69
|
+
color: new u.Color((h = e == null ? void 0 : e.lineColor) != null ? h : b),
|
|
70
|
+
linewidth: (r = e == null ? void 0 : e.lineWidth) != null ? r : S,
|
|
71
71
|
dashScale: 40,
|
|
72
72
|
opacity: (d = e == null ? void 0 : e.opacity) != null ? d : 1,
|
|
73
73
|
transparent: !0,
|
|
74
74
|
dashed: (a = e == null ? void 0 : e.dashed) != null ? a : !1
|
|
75
75
|
}), n = new E({
|
|
76
|
-
color: new u.Color((g = e == null ? void 0 : e.lineColor) != null ? g :
|
|
76
|
+
color: new u.Color((g = e == null ? void 0 : e.lineColor) != null ? g : b),
|
|
77
77
|
linewidth: t.linewidth * 0.9,
|
|
78
78
|
dashScale: t.dashScale,
|
|
79
79
|
opacity: t.opacity * 0.8,
|
|
@@ -118,7 +118,7 @@ class Q extends R {
|
|
|
118
118
|
updateMatrixWorld(e) {
|
|
119
119
|
var i;
|
|
120
120
|
if (super.updateMatrixWorld(e), this.points) {
|
|
121
|
-
const t = (i =
|
|
121
|
+
const t = (i = T(this, this.points)) == null ? void 0 : i.map((n) => n.toArray().join(",")).join(",");
|
|
122
122
|
t !== this.lastRenderLengthItem && (this.updateLengthItems(), this.lastRenderLengthItem = t);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
@@ -145,7 +145,7 @@ class Q extends R {
|
|
|
145
145
|
i ? t === "depthTest" ? (this.line.material.depthTest = !1, this.backLine.visible = !1) : t === "translucence" && (this.line.material.depthTest = !0, this.backLine.visible = !0, this.line.material.opacity === 1 ? this.backLine.material.setDashed(!0) : this.backLine.material.setDashed(this.line.material.dashed)) : (this.line.material.depthTest = !0, this.backLine.visible = !1), this.needsRender = !0;
|
|
146
146
|
}
|
|
147
147
|
highlight() {
|
|
148
|
-
this.highlighted || (this.highlighted = !0, this.opacityBeforeHighlight = this.line.material.opacity, this.line.material.opacity = this.opacityBeforeHighlight *
|
|
148
|
+
this.highlighted || (this.highlighted = !0, this.opacityBeforeHighlight = this.line.material.opacity, this.line.material.opacity = this.opacityBeforeHighlight * D, this.backLine.material.opacity = this.backLine.material.opacity * D, this.needsRender = !0);
|
|
149
149
|
}
|
|
150
150
|
unhighlight() {
|
|
151
151
|
this.highlighted && (this.highlighted = !1, this.line.material.opacity = this.opacityBeforeHighlight, this.backLine.material.opacity = 0.2, this.needsRender = !0);
|
|
@@ -158,10 +158,10 @@ class Q extends R {
|
|
|
158
158
|
return e();
|
|
159
159
|
if (!this.five)
|
|
160
160
|
return console.error("Five not found");
|
|
161
|
-
const i =
|
|
161
|
+
const i = this.points.map((t, n) => {
|
|
162
162
|
if (n !== 0)
|
|
163
|
-
return [
|
|
164
|
-
}).filter(c);
|
|
163
|
+
return [this.points[n - 1], t];
|
|
164
|
+
}).filter(c).map((t) => T(this, t));
|
|
165
165
|
i.forEach(([t, n], h) => {
|
|
166
166
|
var a;
|
|
167
167
|
const r = C(t, n);
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
var
|
|
1
|
+
var f = Object.defineProperty, d = Object.defineProperties;
|
|
2
2
|
var y = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var m = Object.getOwnPropertySymbols;
|
|
4
4
|
var u = Object.prototype.hasOwnProperty, c = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var a = (i, t, e) => t in i ?
|
|
5
|
+
var a = (i, t, e) => t in i ? f(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, h = (i, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
7
|
u.call(t, e) && a(i, e, t[e]);
|
|
8
8
|
if (m)
|
|
9
9
|
for (var e of m(t))
|
|
10
10
|
c.call(t, e) && a(i, e, t[e]);
|
|
11
11
|
return i;
|
|
12
|
-
}, g = (i, t) =>
|
|
12
|
+
}, g = (i, t) => d(i, y(t));
|
|
13
13
|
var r = (i, t, e) => (a(i, typeof t != "symbol" ? t + "" : t, e), e);
|
|
14
14
|
import * as l from "three";
|
|
15
15
|
import { generatePolygonGeometry as I } from "../../shared-utils/three/generatePolygonGeometry.js";
|
|
16
16
|
import { DEFAULT_HIGHLIGHT_OPACITY as H } from "../typings/style.js";
|
|
17
17
|
import { anyPositionToVector3 as P } from "../../shared-utils/positionToVector3.js";
|
|
18
|
-
import { ColoredMesh as
|
|
19
|
-
import { getGeometryInfo as
|
|
18
|
+
import { ColoredMesh as _ } from "../utils/three/ColoredMesh.js";
|
|
19
|
+
import { getGeometryInfo as A } from "../../shared-utils/three/geometryUtil.js";
|
|
20
20
|
import { LightTag as S } from "../../shared-utils/tag.js";
|
|
21
21
|
import { getLengthHTML as M } from "../utils/Meshes/getLengthHTML.js";
|
|
22
|
-
import { applyObjectMatrixWorld as
|
|
22
|
+
import { applyObjectMatrixWorld as B } from "../../shared-utils/three/applyObjectMatrixWorld.js";
|
|
23
23
|
const p = new l.BufferGeometry();
|
|
24
24
|
p.name = "blankGeometry";
|
|
25
25
|
p.isBlank = !0;
|
|
26
|
-
class
|
|
26
|
+
class L extends _ {
|
|
27
27
|
constructor(e) {
|
|
28
28
|
super(e);
|
|
29
29
|
r(this, "name", "PolygonMesh");
|
|
@@ -50,25 +50,25 @@ class R extends A {
|
|
|
50
50
|
return (e = this.geometryInfo) == null ? void 0 : e.center;
|
|
51
51
|
}
|
|
52
52
|
get geometryInfo() {
|
|
53
|
-
return this.geometryInfoNeedUpdate && (this._geometryInfo =
|
|
53
|
+
return this.geometryInfoNeedUpdate && (this.isBlank ? this._geometryInfo = null : this._geometryInfo = A(this.geometry), this.geometryInfoNeedUpdate = !1), this._geometryInfo;
|
|
54
54
|
}
|
|
55
55
|
get five() {
|
|
56
|
-
var e,
|
|
57
|
-
return (
|
|
56
|
+
var e, s;
|
|
57
|
+
return (s = (e = window.globalModules) == null ? void 0 : e.five) != null ? s : window.$five;
|
|
58
58
|
}
|
|
59
59
|
updateMatrixWorld(e) {
|
|
60
60
|
if (super.updateMatrixWorld(e), this.center) {
|
|
61
|
-
const
|
|
62
|
-
|
|
61
|
+
const s = B(this, this.center).toArray().join(",");
|
|
62
|
+
s !== this.lastRenderAreaItem && (this.updateAreaItems(), this.lastRenderAreaItem = s);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
setStyle(e) {
|
|
66
66
|
this._paramsStyle = h(h({}, this._paramsStyle), e), super.setStyle(this._paramsStyle), this.updateAreaItems();
|
|
67
67
|
}
|
|
68
68
|
setPoints(e) {
|
|
69
|
-
var
|
|
70
|
-
const
|
|
71
|
-
this.points =
|
|
69
|
+
var o;
|
|
70
|
+
const s = e.map(P);
|
|
71
|
+
this.points = s, this.geometry = (o = I(this.points)) != null ? o : p, this.planeHelperNeedUpdate = !0, this.geometryInfoNeedUpdate = !0, this.updateAreaItems();
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
* @description: 获取一个点投影在当前平面上的点
|
|
@@ -86,7 +86,7 @@ class R extends A {
|
|
|
86
86
|
this.points.length >= 3 ? this.planeHelper = new l.Plane().setFromCoplanarPoints(this.points[0], this.points[1], this.points[2]) : this.planeHelper = null, this.planeHelperNeedUpdate = !1;
|
|
87
87
|
}
|
|
88
88
|
updateAreaItems() {
|
|
89
|
-
var
|
|
89
|
+
var o;
|
|
90
90
|
const e = () => {
|
|
91
91
|
var n;
|
|
92
92
|
(n = this.areaDom) == null || n.destroy(), this.areaDom = void 0;
|
|
@@ -95,14 +95,14 @@ class R extends A {
|
|
|
95
95
|
return e();
|
|
96
96
|
if (!this.five)
|
|
97
97
|
return console.error("Five not found");
|
|
98
|
-
this.areaDom = (
|
|
98
|
+
this.areaDom = (o = this.areaDom) != null ? o : (() => {
|
|
99
99
|
const n = new S(this.five);
|
|
100
100
|
return n.intersectCheck = !1, n;
|
|
101
101
|
})(), this.areaDom.setPosition(this.center);
|
|
102
|
-
const
|
|
103
|
-
|
|
102
|
+
const s = this.geometryInfo.area.toFixed(2);
|
|
103
|
+
s === "0.00" ? this.areaDom.container.innerHTML = "" : this.areaDom.container.innerHTML = M(s + "m²");
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
export {
|
|
107
|
-
|
|
107
|
+
L as PolygonMesh
|
|
108
108
|
};
|
|
@@ -64,6 +64,22 @@ Config extends BaseObjectConfig = BaseObjectConfig> extends IObject3D {
|
|
|
64
64
|
constructor(data?: Partial<ImportData>, config?: Partial<Config>);
|
|
65
65
|
on: <T extends keyof FiveDomEventMap>(event: T, callback: FiveDomEventMap[T], config?: EventHandlerConfig) => void;
|
|
66
66
|
off: (event?: keyof FiveDomEventMap, callback?: (e: import("../../../shared-utils/five/FiveDomEvents").FiveDomEvent) => any, ...args: any[]) => void;
|
|
67
|
+
/**
|
|
68
|
+
* @description 撤销
|
|
69
|
+
*/
|
|
70
|
+
undo(): void;
|
|
71
|
+
/**
|
|
72
|
+
* @description 重做
|
|
73
|
+
*/
|
|
74
|
+
redo(): void;
|
|
75
|
+
/**
|
|
76
|
+
* @description 是否可以撤销
|
|
77
|
+
*/
|
|
78
|
+
canUndo(): void;
|
|
79
|
+
/**
|
|
80
|
+
* @description 是否可以重做
|
|
81
|
+
*/
|
|
82
|
+
canRedo(): void;
|
|
67
83
|
/**
|
|
68
84
|
* @description 停止创建当前物体,等同于`esc`
|
|
69
85
|
*/
|
|
@@ -1,49 +1,51 @@
|
|
|
1
1
|
var a = Object.defineProperty;
|
|
2
2
|
var u = Object.getOwnPropertySymbols;
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var f = Object.prototype.hasOwnProperty, g = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var l = (o, t, e) => t in o ? a(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, p = (o, t) => {
|
|
5
5
|
for (var e in t || (t = {}))
|
|
6
|
-
|
|
6
|
+
f.call(t, e) && l(o, e, t[e]);
|
|
7
7
|
if (u)
|
|
8
8
|
for (var e of u(t))
|
|
9
|
-
g.call(t, e) &&
|
|
10
|
-
return
|
|
9
|
+
g.call(t, e) && l(o, e, t[e]);
|
|
10
|
+
return o;
|
|
11
11
|
};
|
|
12
|
-
var
|
|
13
|
-
import { hotkeys as
|
|
14
|
-
import { Sculpt as
|
|
12
|
+
var r = (o, t, e) => (l(o, typeof t != "symbol" ? t + "" : t, e), e);
|
|
13
|
+
import { hotkeys as c } from "../../../vendor/hotkeys-js/dist/hotkeys.esm.js";
|
|
14
|
+
import { Sculpt as n } from "../../index.js";
|
|
15
15
|
import { IObject3D as b } from "../../../shared-utils/three/IObject3D.js";
|
|
16
16
|
import { applyObjectMatrixWorld as y } from "../../../shared-utils/three/applyObjectMatrixWorld.js";
|
|
17
|
-
import { removeAllTag as
|
|
18
|
-
const
|
|
19
|
-
class
|
|
20
|
-
constructor(e,
|
|
17
|
+
import { removeAllTag as M } from "../../utils/removeAllTag.js";
|
|
18
|
+
const m = /* @__PURE__ */ new Map();
|
|
19
|
+
class x extends b {
|
|
20
|
+
constructor(e, s) {
|
|
21
21
|
super();
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
r(this, "name", "Sculpt");
|
|
23
|
+
r(this, "isSculptObject", !0);
|
|
24
|
+
r(this, "draggable");
|
|
25
25
|
/**
|
|
26
26
|
* @description 是否被选中
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
r(this, "selected");
|
|
29
29
|
/**
|
|
30
30
|
* @description 配置
|
|
31
31
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
e != null && e.id && (this.uuid = e.id), this.config =
|
|
37
|
-
|
|
38
|
-
}),
|
|
32
|
+
r(this, "config");
|
|
33
|
+
r(this, "editor");
|
|
34
|
+
r(this, "on", (e, s, i) => n.modules.fiveDomEvents.addEventListener(this, e, s, i));
|
|
35
|
+
r(this, "off", (...e) => n.modules.fiveDomEvents.removeEventListener(this, ...e));
|
|
36
|
+
e != null && e.id && (this.uuid = e.id), this.config = p({ canEdit: !0, occlusionVisibility: !0, occlusionMode: "translucence" }, s), e != null && e.style && (e.style.occlusionVisibility = this.config.occlusionVisibility, e.style.occlusionMode = this.config.occlusionMode), this.addEventListener("removed", () => {
|
|
37
|
+
M(this);
|
|
38
|
+
}), c("esc", () => {
|
|
39
|
+
this.stopCreating();
|
|
40
|
+
}), this.config.canEdit && (c("backspace, delete", () => {
|
|
39
41
|
this.selected && this.delete();
|
|
40
42
|
}), this.on("click", () => {
|
|
41
|
-
var
|
|
43
|
+
var h, d;
|
|
42
44
|
if (this.pointSelector.enabled)
|
|
43
45
|
return;
|
|
44
|
-
let i =
|
|
45
|
-
i && (i.selected = !1, i.unhighlight(), (
|
|
46
|
-
}),
|
|
46
|
+
let i = m.get(this.parent.uuid);
|
|
47
|
+
i && (i.selected = !1, i.unhighlight(), (h = i.editor) == null || h.disable()), m.set(this.parent.uuid, this), this.selected = !0, this.highlight(), (d = this.editor) == null || d.enable();
|
|
48
|
+
}), c("esc", () => {
|
|
47
49
|
var i;
|
|
48
50
|
this.selected = !1, this.unhighlight(), !this.pointSelector.enabled && ((i = this.editor) == null || i.disable());
|
|
49
51
|
}));
|
|
@@ -55,13 +57,37 @@ class D extends b {
|
|
|
55
57
|
};
|
|
56
58
|
}
|
|
57
59
|
get pointSelector() {
|
|
58
|
-
return
|
|
60
|
+
return n.modules.pointSelector;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @description 撤销
|
|
64
|
+
*/
|
|
65
|
+
undo() {
|
|
66
|
+
throw new Error("Method not implemented.");
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @description 重做
|
|
70
|
+
*/
|
|
71
|
+
redo() {
|
|
72
|
+
throw new Error("Method not implemented.");
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* @description 是否可以撤销
|
|
76
|
+
*/
|
|
77
|
+
canUndo() {
|
|
78
|
+
throw new Error("Method not implemented.");
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* @description 是否可以重做
|
|
82
|
+
*/
|
|
83
|
+
canRedo() {
|
|
84
|
+
throw new Error("Method not implemented.");
|
|
59
85
|
}
|
|
60
86
|
/**
|
|
61
87
|
* @description 停止创建当前物体,等同于`esc`
|
|
62
88
|
*/
|
|
63
89
|
stopCreating() {
|
|
64
|
-
|
|
90
|
+
n.modules.pointSelector.disable();
|
|
65
91
|
}
|
|
66
92
|
/**
|
|
67
93
|
* @description 从场景中删除当前物体,并且移除事件监听
|
|
@@ -84,10 +110,10 @@ class D extends b {
|
|
|
84
110
|
return this.updateMatrixWorld(), y(this, e);
|
|
85
111
|
}
|
|
86
112
|
applyObjectQuaternion(e) {
|
|
87
|
-
const
|
|
88
|
-
return Array.isArray(e) ? e.map((i) => i.clone().applyQuaternion(
|
|
113
|
+
const s = this.quaternion.clone();
|
|
114
|
+
return Array.isArray(e) ? e.map((i) => i.clone().applyQuaternion(s)) : e.clone().applyQuaternion(s);
|
|
89
115
|
}
|
|
90
116
|
}
|
|
91
117
|
export {
|
|
92
|
-
|
|
118
|
+
x as BaseObject
|
|
93
119
|
};
|
|
@@ -1,53 +1,50 @@
|
|
|
1
1
|
var E = Object.defineProperty, v = Object.defineProperties;
|
|
2
|
-
var
|
|
2
|
+
var H = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var u = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var b = (o, e, t) => e in o ? E(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t,
|
|
4
|
+
var O = Object.prototype.hasOwnProperty, C = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var b = (o, e, t) => e in o ? E(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t, m = (o, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
|
|
7
|
+
O.call(e, t) && b(o, t, e[t]);
|
|
8
8
|
if (u)
|
|
9
9
|
for (var t of u(e))
|
|
10
|
-
|
|
10
|
+
C.call(e, t) && b(o, t, e[t]);
|
|
11
11
|
return o;
|
|
12
|
-
}, M = (o, e) => v(o,
|
|
12
|
+
}, M = (o, e) => v(o, H(e));
|
|
13
13
|
var d = (o, e, t) => (b(o, typeof e != "symbol" ? e + "" : e, t), t);
|
|
14
|
-
var
|
|
14
|
+
var f = (o, e, t) => new Promise((n, i) => {
|
|
15
15
|
var a = (s) => {
|
|
16
16
|
try {
|
|
17
17
|
r(t.next(s));
|
|
18
18
|
} catch (h) {
|
|
19
19
|
i(h);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, c = (s) => {
|
|
22
22
|
try {
|
|
23
23
|
r(t.throw(s));
|
|
24
24
|
} catch (h) {
|
|
25
25
|
i(h);
|
|
26
26
|
}
|
|
27
|
-
}, r = (s) => s.done ? n(s.value) : Promise.resolve(s.value).then(a,
|
|
27
|
+
}, r = (s) => s.done ? n(s.value) : Promise.resolve(s.value).then(a, c);
|
|
28
28
|
r((t = t.apply(o, e)).next());
|
|
29
29
|
});
|
|
30
|
-
import {
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import { BoxEditor as N } from "./Editor.js";
|
|
30
|
+
import { BaseObject as L } from "../Base/index.js";
|
|
31
|
+
import * as W from "three";
|
|
32
|
+
import { BoxEditor as j } from "./Editor.js";
|
|
34
33
|
import { BoxMesh as w } from "../../Meshes/Box.js";
|
|
35
|
-
import { createRectangle as
|
|
36
|
-
import { LineMesh as
|
|
37
|
-
import { getNormal as
|
|
38
|
-
import { rayOnLine as
|
|
34
|
+
import { createRectangle as N } from "../Rectangle/index.js";
|
|
35
|
+
import { LineMesh as R } from "../../Meshes/Line.js";
|
|
36
|
+
import { getNormal as T } from "../../../shared-utils/three/getNormal.js";
|
|
37
|
+
import { rayOnLine as U } from "../../utils/three/rayOnLine.js";
|
|
39
38
|
import { vector3ToArray as B } from "../../../shared-utils/three/vector3ToArray.js";
|
|
40
|
-
class
|
|
39
|
+
class Q extends L {
|
|
41
40
|
constructor(t, n) {
|
|
42
41
|
super(t, n);
|
|
43
42
|
d(this, "type", "Box");
|
|
44
43
|
d(this, "boxMesh");
|
|
45
|
-
this.editor = new
|
|
46
|
-
this.stopCreating();
|
|
47
|
-
});
|
|
44
|
+
this.editor = new j(this), t && (this.boxMesh = new w(m(m({}, t.style), t)), this.add(this.boxMesh));
|
|
48
45
|
}
|
|
49
46
|
get data() {
|
|
50
|
-
return M(
|
|
47
|
+
return M(m({}, this.baseData), {
|
|
51
48
|
points: B(this.applyObjectMatrixWorld(this.boxMesh.bottomPlane.points)),
|
|
52
49
|
heightPoint: B(this.applyObjectMatrixWorld(this.boxMesh.heightPoint)),
|
|
53
50
|
style: {
|
|
@@ -66,40 +63,40 @@ class X extends W {
|
|
|
66
63
|
(t = this.boxMesh) == null || t.unhighlight();
|
|
67
64
|
}
|
|
68
65
|
create(t) {
|
|
69
|
-
return
|
|
66
|
+
return f(this, null, function* () {
|
|
70
67
|
this.removeChildren(), this.boxMesh = new w(t), this.add(this.boxMesh), yield z(this.boxMesh, this.pointSelector), this.editor.enable();
|
|
71
68
|
});
|
|
72
69
|
}
|
|
73
70
|
}
|
|
74
71
|
function z(o, e) {
|
|
75
|
-
return
|
|
76
|
-
return yield
|
|
72
|
+
return f(this, null, function* () {
|
|
73
|
+
return yield N(o.bottomPlane, e), new Promise((t, n) => {
|
|
77
74
|
const i = o.parent;
|
|
78
75
|
if (!i) {
|
|
79
76
|
n(new Error("No container"));
|
|
80
77
|
return;
|
|
81
78
|
}
|
|
82
|
-
const a = new
|
|
79
|
+
const a = new R(), c = T(o.bottomPlane.points).normalize(), r = o.bottomPlane.builtPoints.at(-1), s = r.clone().add(c.clone().multiplyScalar(10)), h = r.clone().sub(c.clone().multiplyScalar(10));
|
|
83
80
|
a.setPoints([s, h]), i.add(a), e.enable();
|
|
84
|
-
const
|
|
81
|
+
const p = (l) => {
|
|
85
82
|
g(), t();
|
|
86
83
|
}, x = (l) => {
|
|
87
84
|
if (!(l != null && l.raycaster))
|
|
88
85
|
return;
|
|
89
|
-
const
|
|
86
|
+
const y = U({
|
|
90
87
|
raycaster: l.raycaster,
|
|
91
|
-
line: new
|
|
88
|
+
line: new W.Line3(s, h)
|
|
92
89
|
});
|
|
93
|
-
|
|
90
|
+
y && o.setPoints({ heightPoint: y });
|
|
94
91
|
}, g = () => {
|
|
95
|
-
e.off("select",
|
|
96
|
-
},
|
|
92
|
+
e.off("select", p), e.off("intersectionUpdate", x), e.off("disable", P), e.disable(), i == null || i.remove(a);
|
|
93
|
+
}, P = () => {
|
|
97
94
|
g(), i == null || i.remove(o), n(new Error("Cancelled"));
|
|
98
95
|
};
|
|
99
|
-
e.on("select",
|
|
96
|
+
e.on("select", p), e.on("intersectionUpdate", x), e.on("disable", P);
|
|
100
97
|
});
|
|
101
98
|
});
|
|
102
99
|
}
|
|
103
100
|
export {
|
|
104
|
-
|
|
101
|
+
Q as Box
|
|
105
102
|
};
|
|
@@ -1,52 +1,49 @@
|
|
|
1
|
-
var
|
|
1
|
+
var C = Object.defineProperty, x = Object.defineProperties;
|
|
2
2
|
var O = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var M = Object.getOwnPropertySymbols;
|
|
4
4
|
var T = Object.prototype.hasOwnProperty, j = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var
|
|
5
|
+
var m = (t, r, e) => r in t ? C(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e, d = (t, r) => {
|
|
6
6
|
for (var e in r || (r = {}))
|
|
7
|
-
T.call(r, e) &&
|
|
7
|
+
T.call(r, e) && m(t, e, r[e]);
|
|
8
8
|
if (M)
|
|
9
9
|
for (var e of M(r))
|
|
10
|
-
j.call(r, e) &&
|
|
10
|
+
j.call(r, e) && m(t, e, r[e]);
|
|
11
11
|
return t;
|
|
12
12
|
}, g = (t, r) => x(t, O(r));
|
|
13
|
-
var f = (t, r, e) => (
|
|
14
|
-
var w = (t, r, e) => new Promise((
|
|
13
|
+
var f = (t, r, e) => (m(t, typeof r != "symbol" ? r + "" : r, e), e);
|
|
14
|
+
var w = (t, r, e) => new Promise((c, i) => {
|
|
15
15
|
var a = (n) => {
|
|
16
16
|
try {
|
|
17
|
-
|
|
17
|
+
o(e.next(n));
|
|
18
18
|
} catch (h) {
|
|
19
19
|
i(h);
|
|
20
20
|
}
|
|
21
21
|
}, s = (n) => {
|
|
22
22
|
try {
|
|
23
|
-
|
|
23
|
+
o(e.throw(n));
|
|
24
24
|
} catch (h) {
|
|
25
25
|
i(h);
|
|
26
26
|
}
|
|
27
|
-
},
|
|
28
|
-
|
|
27
|
+
}, o = (n) => n.done ? c(n.value) : Promise.resolve(n.value).then(a, s);
|
|
28
|
+
o((e = e.apply(t, r)).next());
|
|
29
29
|
});
|
|
30
|
-
import {
|
|
31
|
-
import { BaseObject as H } from "../Base/index.js";
|
|
30
|
+
import { BaseObject as A } from "../Base/index.js";
|
|
32
31
|
import * as y from "three";
|
|
33
|
-
import { PolylineMesh as
|
|
34
|
-
import { CircleEditor as
|
|
32
|
+
import { PolylineMesh as H } from "../../Meshes/Polyline.js";
|
|
33
|
+
import { CircleEditor as N } from "./Editor.js";
|
|
35
34
|
import { CircleWithEdgeMesh as b } from "../../Meshes/CircleWithEdge.js";
|
|
36
|
-
import { vector3ToArray as
|
|
37
|
-
class
|
|
38
|
-
constructor(e,
|
|
39
|
-
super(e,
|
|
35
|
+
import { vector3ToArray as E } from "../../../shared-utils/three/vector3ToArray.js";
|
|
36
|
+
class R extends A {
|
|
37
|
+
constructor(e, c) {
|
|
38
|
+
super(e, c);
|
|
40
39
|
f(this, "type", "Circle");
|
|
41
40
|
f(this, "circleMesh");
|
|
42
|
-
this.editor = new
|
|
43
|
-
this.stopCreating();
|
|
44
|
-
});
|
|
41
|
+
this.editor = new N(this), e && (this.circleMesh = new b(d(d({}, e.style), e)), this.add(this.circleMesh));
|
|
45
42
|
}
|
|
46
43
|
get data() {
|
|
47
|
-
return g(
|
|
48
|
-
center:
|
|
49
|
-
normal:
|
|
44
|
+
return g(d({}, this.baseData), {
|
|
45
|
+
center: E(this.applyObjectMatrixWorld(this.circleMesh.center)),
|
|
46
|
+
normal: E(this.applyObjectQuaternion(this.circleMesh.normal)),
|
|
50
47
|
radius: this.circleMesh.radius,
|
|
51
48
|
style: {
|
|
52
49
|
color: this.circleMesh.color.getHex()
|
|
@@ -66,21 +63,21 @@ class V extends H {
|
|
|
66
63
|
this.children.forEach((i) => {
|
|
67
64
|
i.parent === this && this.remove(i);
|
|
68
65
|
}), this.children.length = 0;
|
|
69
|
-
const
|
|
70
|
-
this.circleMesh =
|
|
66
|
+
const c = new b(e);
|
|
67
|
+
this.circleMesh = c, this.add(this.circleMesh), yield U(this.circleMesh, this.pointSelector), this.editor.enable();
|
|
71
68
|
});
|
|
72
69
|
}
|
|
73
70
|
}
|
|
74
|
-
function
|
|
75
|
-
return new Promise((e,
|
|
71
|
+
function U(t, r) {
|
|
72
|
+
return new Promise((e, c) => {
|
|
76
73
|
const i = t.parent;
|
|
77
74
|
if (!i) {
|
|
78
|
-
|
|
75
|
+
c(new Error("No container"));
|
|
79
76
|
return;
|
|
80
77
|
}
|
|
81
|
-
const a = new
|
|
78
|
+
const a = new H({ dashed: !0 });
|
|
82
79
|
i.add(a), r.enable();
|
|
83
|
-
let s,
|
|
80
|
+
let s, o;
|
|
84
81
|
const n = (l) => {
|
|
85
82
|
if (l) {
|
|
86
83
|
if (!s) {
|
|
@@ -90,25 +87,25 @@ function W(t, r) {
|
|
|
90
87
|
};
|
|
91
88
|
return;
|
|
92
89
|
}
|
|
93
|
-
s &&
|
|
90
|
+
s && o && (p(), e());
|
|
94
91
|
}
|
|
95
92
|
}, h = (l) => {
|
|
96
93
|
if (!l || !s)
|
|
97
94
|
return;
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
100
|
-
const
|
|
101
|
-
t.setPoints({ center: s.point, normal: s.normal, radius:
|
|
95
|
+
const P = new y.Plane().setFromNormalAndCoplanarPoint(s.normal, s.point);
|
|
96
|
+
if (o = l.raycaster.ray.intersectPlane(P, new y.Vector3()), o) {
|
|
97
|
+
const v = s.point.distanceTo(o);
|
|
98
|
+
t.setPoints({ center: s.point, normal: s.normal, radius: v });
|
|
102
99
|
}
|
|
103
100
|
}, p = () => {
|
|
104
101
|
r.off("select", n), r.off("intersectionUpdate", h), r.off("disable", u), r.disable(), i == null || i.remove(a);
|
|
105
102
|
}, u = () => {
|
|
106
|
-
p(), i == null || i.remove(t, a),
|
|
103
|
+
p(), i == null || i.remove(t, a), c(new Error("Cancelled"));
|
|
107
104
|
};
|
|
108
105
|
r.on("select", n), r.on("intersectionUpdate", h), r.on("disable", u);
|
|
109
106
|
});
|
|
110
107
|
}
|
|
111
108
|
export {
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
R as Circle,
|
|
110
|
+
U as createCircle
|
|
114
111
|
};
|