@realsee/dnalogel 3.46.1 → 3.47.0
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 +4 -0
- package/dist/Sculpt/Meshes/Polygon.d.ts +6 -0
- package/dist/Sculpt/Meshes/PolygonWithEdge.d.ts +8 -0
- package/dist/Sculpt/Meshes/Polyline.d.ts +7 -0
- package/dist/Sculpt/utils/three/ColoredMesh.d.ts +6 -0
- package/dist/index.cjs.js +39 -39
- package/dist/index.js +2161 -2118
- package/dist/index.umd.js +34 -34
- package/dist/shared-utils/five/getPosition.d.ts +2 -0
- package/dist/shared-utils/three/PointSelector/index.d.ts +14 -10
- package/dist/typings/typings.d.ts +2 -0
- package/libs/Sculpt/Meshes/Polygon.d.ts +6 -0
- package/libs/Sculpt/Meshes/Polygon.js +7 -4
- package/libs/Sculpt/Meshes/PolygonWithEdge.d.ts +8 -0
- package/libs/Sculpt/Meshes/PolygonWithEdge.js +38 -24
- package/libs/Sculpt/Meshes/Polyline.d.ts +7 -0
- package/libs/Sculpt/Meshes/Polyline.js +32 -23
- package/libs/Sculpt/Objects/Line/Editor.js +6 -6
- package/libs/Sculpt/Objects/Line/index.js +16 -16
- package/libs/Sculpt/Objects/Point/Editor.js +10 -10
- package/libs/Sculpt/Objects/Polygon/Editor.js +6 -6
- package/libs/Sculpt/Objects/Polygon/index.js +43 -37
- package/libs/Sculpt/Objects/Polyline/Editor.js +3 -3
- package/libs/Sculpt/Objects/Polyline/index.js +43 -43
- package/libs/Sculpt/utils/three/ColoredMesh.d.ts +6 -0
- package/libs/Sculpt/utils/three/ColoredMesh.js +39 -31
- package/libs/base/BasePlugin.js +1 -1
- package/libs/shared-utils/five/getPosition.d.ts +2 -0
- package/libs/shared-utils/five/getPosition.js +25 -30
- package/libs/shared-utils/logger.js +1 -1
- package/libs/shared-utils/three/PointSelector/index.d.ts +14 -10
- package/libs/shared-utils/three/PointSelector/index.js +74 -57
- package/libs/typings/typings.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,31 +1,35 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var v = Object.defineProperty, E = Object.defineProperties;
|
|
2
|
+
var w = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var f = Object.getOwnPropertySymbols;
|
|
4
|
+
var S = Object.prototype.hasOwnProperty, y = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var p = (n, s, e) => s in n ? v(n, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[s] = e, l = (n, s) => {
|
|
6
6
|
for (var e in s || (s = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var e of
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
var i = (
|
|
14
|
-
import { PointSelectorHelper as
|
|
7
|
+
S.call(s, e) && p(n, e, s[e]);
|
|
8
|
+
if (f)
|
|
9
|
+
for (var e of f(s))
|
|
10
|
+
y.call(s, e) && p(n, e, s[e]);
|
|
11
|
+
return n;
|
|
12
|
+
}, m = (n, s) => E(n, w(s));
|
|
13
|
+
var i = (n, s, e) => (p(n, typeof s != "symbol" ? s + "" : s, e), e);
|
|
14
|
+
import { PointSelectorHelper as I } from "./utils/PointSelectorHelper.js";
|
|
15
15
|
import { isTouchDevice as b } from "../../isTouchDevice.js";
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
import C from "hammerjs";
|
|
17
|
+
import * as u from "three";
|
|
18
|
+
import { Subscribe as H } from "../../Subscribe.js";
|
|
19
|
+
import { getIntersectByRaycaster as F, getVirtualIntersectByRaycaster as M } from "../../five/getPosition.js";
|
|
20
|
+
import { getRaycasterByNdcPosition as N } from "../../five/getRaycasterByNdcPosition.js";
|
|
21
|
+
const x = new u.Vector3(), d = () => !1;
|
|
22
|
+
class V extends H {
|
|
21
23
|
constructor(e, t) {
|
|
22
|
-
var a,
|
|
24
|
+
var a, o, c;
|
|
23
25
|
super();
|
|
24
26
|
/**
|
|
25
27
|
* @description: 不在 five canvas 上时为 true
|
|
26
28
|
*/
|
|
27
29
|
i(this, "outOfFive", !1);
|
|
28
30
|
i(this, "enabled", !1);
|
|
31
|
+
i(this, "actionIfNoModelUnderMouse", "virtualPoint");
|
|
32
|
+
i(this, "plane");
|
|
29
33
|
i(this, "pointSelectorHelper");
|
|
30
34
|
/** @deprecated directly use `pointSelector.on/off` instead */
|
|
31
35
|
i(this, "hook", this);
|
|
@@ -39,8 +43,9 @@ class M extends F {
|
|
|
39
43
|
/** 吸附点的半径 */
|
|
40
44
|
i(this, "adherePointsRadius", 0.1);
|
|
41
45
|
i(this, "lastFiveHelperVisible");
|
|
46
|
+
i(this, "lastIntersection");
|
|
42
47
|
i(this, "mousePosition");
|
|
43
|
-
i(this, "config");
|
|
48
|
+
i(this, "config", {});
|
|
44
49
|
/**
|
|
45
50
|
* @description: 主动触发一次选点
|
|
46
51
|
* @return: select 是否成功
|
|
@@ -63,26 +68,20 @@ class M extends F {
|
|
|
63
68
|
this.pointSelectorHelper.hide(), this.outOfFive = !0, this.emit("intersectionUpdate", null);
|
|
64
69
|
});
|
|
65
70
|
i(this, "onTap", (e) => {
|
|
66
|
-
|
|
71
|
+
e != null && e.center && (this.mousePosition = {
|
|
67
72
|
clientX: e.center.x,
|
|
68
73
|
clientY: e.center.y
|
|
69
|
-
}),
|
|
70
|
-
return;
|
|
71
|
-
const t = d(this.five, this.mouseNdcPosition, { virtualPoint: this.virtualPoint });
|
|
72
|
-
t != null && t.face && this.select(t);
|
|
74
|
+
}), this.select();
|
|
73
75
|
});
|
|
74
76
|
/**
|
|
75
77
|
* 1. 如果之前没有长按行为「即没有长按点时」-> 滑动全景
|
|
76
78
|
* 2. 如果有长按点,把长按点位置更新为当前位置
|
|
77
79
|
*/
|
|
78
80
|
i(this, "onPan", (e) => {
|
|
79
|
-
|
|
81
|
+
this.pressDown && (e != null && e.center && (this.mousePosition = {
|
|
80
82
|
clientX: e.center.x,
|
|
81
83
|
clientY: e.center.y
|
|
82
|
-
}),
|
|
83
|
-
return;
|
|
84
|
-
const t = d(this.five, this.mouseNdcPosition, { virtualPoint: this.virtualPoint });
|
|
85
|
-
t != null && t.face && this.updatePointSelectorHelperIntersect(t);
|
|
84
|
+
}), this.mouseNdcPosition && this.updateByNdcPosition(this.mouseNdcPosition));
|
|
86
85
|
});
|
|
87
86
|
/**
|
|
88
87
|
* @description: 长按屏幕后,更新长按点的位置
|
|
@@ -93,8 +92,8 @@ class M extends F {
|
|
|
93
92
|
clientY: e.center.y
|
|
94
93
|
}), !this.mouseNdcPosition)
|
|
95
94
|
return;
|
|
96
|
-
const t =
|
|
97
|
-
|
|
95
|
+
const t = this.updateByNdcPosition(this.mouseNdcPosition);
|
|
96
|
+
this.pressDown = t;
|
|
98
97
|
});
|
|
99
98
|
/**
|
|
100
99
|
* @description: 手指抬起后,重置pressDown状态
|
|
@@ -106,11 +105,34 @@ class M extends F {
|
|
|
106
105
|
this.five.getElement() && (this.mousePosition = e, this.updateByNdcPosition(this.mouseNdcPosition));
|
|
107
106
|
});
|
|
108
107
|
/**
|
|
109
|
-
* @description:
|
|
108
|
+
* @description: 根据鼠标位置计算焦点位置并更新
|
|
110
109
|
*/
|
|
111
110
|
i(this, "updateByNdcPosition", (e) => {
|
|
112
|
-
|
|
113
|
-
this.
|
|
111
|
+
var h, a;
|
|
112
|
+
const t = N(this.five, e), r = F(this.five, t);
|
|
113
|
+
if (r)
|
|
114
|
+
return this.updatePointSelectorHelperIntersect(r), this.lastIntersection = r, !0;
|
|
115
|
+
if (this.plane) {
|
|
116
|
+
const o = t.ray.intersectPlane(this.plane, x);
|
|
117
|
+
if (o) {
|
|
118
|
+
const c = {
|
|
119
|
+
distance: this.five.camera.position.distanceTo(o),
|
|
120
|
+
point: o.clone(),
|
|
121
|
+
object: new u.Object3D(),
|
|
122
|
+
face: new u.Face3(0, 0, 0, this.plane.normal.clone()),
|
|
123
|
+
raycaster: t,
|
|
124
|
+
isVirtual: !0
|
|
125
|
+
};
|
|
126
|
+
return this.updatePointSelectorHelperIntersect(c), !0;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (this.actionIfNoModelUnderMouse === "lastPoint")
|
|
130
|
+
return this.updatePointSelectorHelperIntersect(this.lastIntersection), !0;
|
|
131
|
+
if (this.actionIfNoModelUnderMouse === "virtualPoint") {
|
|
132
|
+
const o = M(t, (h = this.lastIntersection) == null ? void 0 : h.distance);
|
|
133
|
+
return o.face = new u.Face3(0, 0, 0, (a = this.lastIntersection) == null ? void 0 : a.face.normal), this.lastIntersection = o, this.updatePointSelectorHelperIntersect(o), !0;
|
|
134
|
+
} else if (this.actionIfNoModelUnderMouse === "disable")
|
|
135
|
+
return this.updatePointSelectorHelperIntersect(null), !1;
|
|
114
136
|
});
|
|
115
137
|
/**
|
|
116
138
|
* @description: 更新 pointSelectorHelper 的焦点位置
|
|
@@ -122,24 +144,24 @@ class M extends F {
|
|
|
122
144
|
}
|
|
123
145
|
this.onEnter(), this.five.getElement().style.cursor = "";
|
|
124
146
|
const t = l({}, e);
|
|
125
|
-
let
|
|
147
|
+
let r = !1;
|
|
126
148
|
if (typeof this.adherePoints == "function" && typeof this.adherePointsRadius == "number") {
|
|
127
|
-
for (const
|
|
128
|
-
if (
|
|
129
|
-
t.point =
|
|
149
|
+
for (const h of this.adherePoints({ intersection: e, pointSelectorInstance: this }))
|
|
150
|
+
if (h.distanceTo(e.point) < this.adherePointsRadius) {
|
|
151
|
+
t.point = h.clone(), r = !0;
|
|
130
152
|
break;
|
|
131
153
|
}
|
|
132
154
|
}
|
|
133
|
-
this.pointSelectorHelper.updateWithIntersect(t, { emitEvent: !1 }), this.emit("intersectionUpdate", t,
|
|
155
|
+
this.pointSelectorHelper.updateWithIntersect(t, { emitEvent: !1 }), this.emit("intersectionUpdate", t, r);
|
|
134
156
|
});
|
|
135
157
|
i(this, "mousePositionToNdcPosition", (e) => {
|
|
136
158
|
const t = this.five.getElement();
|
|
137
159
|
if (!t)
|
|
138
160
|
return null;
|
|
139
|
-
const { top:
|
|
161
|
+
const { top: r, left: h, width: a, height: o } = t.getBoundingClientRect(), { clientX: c, clientY: P } = e;
|
|
140
162
|
return {
|
|
141
|
-
x: (
|
|
142
|
-
y: 1 - (
|
|
163
|
+
x: (c - h) / a,
|
|
164
|
+
y: 1 - (P - r) / o
|
|
143
165
|
};
|
|
144
166
|
});
|
|
145
167
|
i(this, "onFiveWantsPanGesture", () => {
|
|
@@ -152,15 +174,15 @@ class M extends F {
|
|
|
152
174
|
i(this, "emitIntersectionUpdate", (e) => {
|
|
153
175
|
this.emit("intersectionUpdate", e);
|
|
154
176
|
});
|
|
155
|
-
this.five = e, this.config = t
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
const
|
|
177
|
+
this.five = e, this.config = l(l({}, this.config), t), this.actionIfNoModelUnderMouse = (a = t == null ? void 0 : t.actionIfNoModelUnderMouse) != null ? a : "virtualPoint";
|
|
178
|
+
const r = (o = t == null ? void 0 : t.mode) != null ? o : "auto";
|
|
179
|
+
r === "auto" ? this.mode = b ? "fixed" : "cursor" : this.mode = r;
|
|
180
|
+
const h = {
|
|
159
181
|
autoFixPCPosition: this.mode === "cursor",
|
|
160
182
|
initialPosition: this.mode === "fixed" ? { left: "35%", top: "20%" } : void 0
|
|
161
183
|
};
|
|
162
|
-
this.pointSelectorHelper = new
|
|
163
|
-
magnifierParams: l(l({},
|
|
184
|
+
this.pointSelectorHelper = new I(this.five, m(l({}, t == null ? void 0 : t.helper), {
|
|
185
|
+
magnifierParams: l(l({}, h), (c = t == null ? void 0 : t.helper) == null ? void 0 : c.magnifierParams)
|
|
164
186
|
})), this.pointSelectorHelper.hide();
|
|
165
187
|
}
|
|
166
188
|
get position() {
|
|
@@ -169,11 +191,6 @@ class M extends F {
|
|
|
169
191
|
get mouseNdcPosition() {
|
|
170
192
|
return this.mousePosition ? this.mousePositionToNdcPosition(this.mousePosition) : null;
|
|
171
193
|
}
|
|
172
|
-
get virtualPoint() {
|
|
173
|
-
var t;
|
|
174
|
-
const e = (t = this.config.virtualPoint) != null ? t : !0;
|
|
175
|
-
return typeof e == "boolean" ? e : Array.isArray(e) ? e.includes(this.five.state.mode) : !0;
|
|
176
|
-
}
|
|
177
194
|
enable() {
|
|
178
195
|
if (this.enabled)
|
|
179
196
|
return;
|
|
@@ -181,14 +198,14 @@ class M extends F {
|
|
|
181
198
|
const e = this.five.getElement();
|
|
182
199
|
if (!e)
|
|
183
200
|
throw new Error("five element not found");
|
|
184
|
-
this.hammer || (this.hammer = new
|
|
201
|
+
this.hammer || (this.hammer = new C(e)), this.mode === "cursor" ? (this.five.on("wantsPanGesture", this.onFiveWantsPanGesture), this.five.on("wantsMoveToPano", d), this.five.on("wantsChangeMode", d), this.five.on("wantsTapGesture", d), e.addEventListener("mousemove", this.updateByMousePosition), e.addEventListener("wheel", this.updateByMousePosition), e.addEventListener("mouseenter", this.onEnter), e.addEventListener("mouseout", this.onLeave), this.hammer.on("tap", this.onTap), this.hammer.on("pan", this.onPan), this.hammer.on("press", this.onPress), this.hammer.on("panend", this.onPanEnd)) : this.mode === "fixed" && (this.five.on("panoArrived", this.renderScreenCenter), this.five.on("panGesture", this.renderScreenCenter), this.five.on("interiaPan", this.renderScreenCenter), this.renderScreenCenter(), this.pointSelectorHelper.show()), this.pointSelectorHelper.hooks.on("intersectionUpdate", this.emitIntersectionUpdate), this.lastFiveHelperVisible = this.five.helperVisible, this.five.helperVisible = !1, this.emit("enable");
|
|
185
202
|
}
|
|
186
203
|
disable() {
|
|
187
204
|
if (!this.enabled)
|
|
188
205
|
return;
|
|
189
206
|
this.enabled = !1, this.pointSelectorHelper.disable(), this.five.getElement().style.cursor = "";
|
|
190
207
|
const e = this.five.getElement();
|
|
191
|
-
this.five.off("wantsPanGesture", this.onFiveWantsPanGesture), this.five.off("wantsMoveToPano",
|
|
208
|
+
this.five.off("wantsPanGesture", this.onFiveWantsPanGesture), this.five.off("wantsMoveToPano", d), this.five.off("wantsChangeMode", d), this.five.off("wantsTapGesture", d), this.five.helperVisible = this.lastFiveHelperVisible, e == null || e.removeEventListener("mousemove", this.updateByMousePosition), e == null || e.removeEventListener("wheel", this.updateByMousePosition), e == null || e.removeEventListener("mouseenter", this.onEnter), e == null || e.removeEventListener("mouseout", this.onLeave), this.hammer.off("tap", this.onTap), this.hammer.off("pan", this.onPan), this.hammer.off("press", this.onPress), this.hammer.off("panend", this.onPanEnd), this.five.off("panoArrived", this.renderScreenCenter), this.five.off("panGesture", this.renderScreenCenter), this.five.off("interiaPan", this.renderScreenCenter), this.pointSelectorHelper.hooks.off("intersectionUpdate", this.emitIntersectionUpdate), this.emit("disable");
|
|
192
209
|
}
|
|
193
210
|
dispose() {
|
|
194
211
|
this.disable(), this.pointSelectorHelper.dispose();
|
|
@@ -198,5 +215,5 @@ class M extends F {
|
|
|
198
215
|
}
|
|
199
216
|
}
|
|
200
217
|
export {
|
|
201
|
-
|
|
218
|
+
V as PointSelector
|
|
202
219
|
};
|