@thatopen/components 2.0.13 → 2.0.15
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/core/Components/index.d.ts +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +226 -163
- package/dist/namespace.d.ts +1439 -1355
- package/dist/utils/vertex-picker.d.ts +92 -8
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ var kn = Object.defineProperty;
|
|
|
2
2
|
var Wn = (l, e, t) => e in l ? kn(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
|
|
3
3
|
var I = (l, e, t) => (Wn(l, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
4
|
import * as g from "three";
|
|
5
|
-
import { BufferAttribute as
|
|
5
|
+
import { BufferAttribute as Ln, Vector3 as M, Vector2 as fe, Plane as Fi, Line3 as Pt, Triangle as ue, Sphere as Xn, Matrix4 as yt, Box3 as Ot, BackSide as Zn, DoubleSide as Pn, FrontSide as wi, Mesh as v, Ray as Qn, Raycaster as jn, Quaternion as Lt, Object3D as ri, Euler as qn, MeshBasicMaterial as yn, LineBasicMaterial as Kn, CylinderGeometry as ct, BoxGeometry as rt, BufferGeometry as Di, Float32BufferAttribute as Ui, OctahedronGeometry as Ze, Line as Dt, SphereGeometry as $n, TorusGeometry as me, PlaneGeometry as Jn } from "three";
|
|
6
6
|
import * as Vt from "@thatopen/fragments";
|
|
7
7
|
import { Serializer as to } from "@thatopen/fragments";
|
|
8
8
|
import * as b from "web-ifc";
|
|
@@ -19,7 +19,7 @@ function oo(l, e = ArrayBuffer) {
|
|
|
19
19
|
function ro(l, e) {
|
|
20
20
|
if (!l.index) {
|
|
21
21
|
const t = l.attributes.position.count, s = e.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer, i = oo(t, s);
|
|
22
|
-
l.setIndex(new
|
|
22
|
+
l.setIndex(new Ln(i, 1));
|
|
23
23
|
for (let o = 0; o < t; o++)
|
|
24
24
|
i[o] = o;
|
|
25
25
|
}
|
|
@@ -97,8 +97,8 @@ function Gs(l, e, t, s, i = null) {
|
|
|
97
97
|
for (let R = e * 6, F = (e + t) * 6; R < F; R += 6) {
|
|
98
98
|
const f = l[R + 0], T = l[R + 1], O = f - T, _ = f + T;
|
|
99
99
|
O < o && (o = O), _ > a && (a = _), C && f < d && (d = f), C && f > p && (p = f);
|
|
100
|
-
const S = l[R + 2], N = l[R + 3],
|
|
101
|
-
|
|
100
|
+
const S = l[R + 2], N = l[R + 3], P = S - N, w = S + N;
|
|
101
|
+
P < n && (n = P), w > c && (c = w), C && S < h && (h = S), C && S > A && (A = S);
|
|
102
102
|
const y = l[R + 4], U = l[R + 5], x = y - U, B = y + U;
|
|
103
103
|
x < r && (r = x), B > E && (E = B), C && y < u && (u = y), C && y > m && (m = y);
|
|
104
104
|
}
|
|
@@ -190,11 +190,11 @@ function uo(l, e, t, s, i, o) {
|
|
|
190
190
|
}
|
|
191
191
|
for (let f = 0; f < F; f++) {
|
|
192
192
|
const T = C[f], O = T.count, _ = i - T.count, S = T.leftCacheBounds, N = T.rightCacheBounds;
|
|
193
|
-
let
|
|
194
|
-
O !== 0 && (
|
|
193
|
+
let P = 0;
|
|
194
|
+
O !== 0 && (P = Re(S) / a);
|
|
195
195
|
let w = 0;
|
|
196
196
|
_ !== 0 && (w = Re(N) / a);
|
|
197
|
-
const y = bi + Ys * (
|
|
197
|
+
const y = bi + Ys * (P * O + w * _);
|
|
198
198
|
y < c && (n = h, c = y, r = T.candidate);
|
|
199
199
|
}
|
|
200
200
|
} else {
|
|
@@ -221,11 +221,11 @@ function uo(l, e, t, s, i, o) {
|
|
|
221
221
|
for (let F = 0; F < Mt - 1; F++) {
|
|
222
222
|
const f = Ut[F], T = f.count, O = f.bounds, S = Ut[F + 1].rightCacheBounds;
|
|
223
223
|
T !== 0 && (R === 0 ? Bi(O, je) : Yi(O, je, je)), R += T;
|
|
224
|
-
let N = 0,
|
|
224
|
+
let N = 0, P = 0;
|
|
225
225
|
R !== 0 && (N = Re(je) / a);
|
|
226
226
|
const w = i - R;
|
|
227
|
-
w !== 0 && (
|
|
228
|
-
const y = bi + Ys * (N * R +
|
|
227
|
+
w !== 0 && (P = Re(S) / a);
|
|
228
|
+
const y = bi + Ys * (N * R + P * w);
|
|
229
229
|
y < c && (n = h, c = y, r = f.candidate);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
@@ -314,14 +314,14 @@ function To(l, e) {
|
|
|
314
314
|
const N = uo(f.boundingData, _, p, T, O, r);
|
|
315
315
|
if (N.axis === -1)
|
|
316
316
|
return R(T + O), f.offset = T, f.count = O, f;
|
|
317
|
-
const
|
|
318
|
-
if (
|
|
317
|
+
const P = A(E, s, p, T, O, N);
|
|
318
|
+
if (P === T || P === T + O)
|
|
319
319
|
R(T + O), f.offset = T, f.count = O;
|
|
320
320
|
else {
|
|
321
321
|
f.splitAxis = N.axis;
|
|
322
|
-
const w = new qe(), y = T, U =
|
|
322
|
+
const w = new qe(), y = T, U = P - T;
|
|
323
323
|
f.left = w, w.boundingData = new Float32Array(6), Gs(p, y, U, w.boundingData, u), F(w, y, U, u, S + 1);
|
|
324
|
-
const x = new qe(), B =
|
|
324
|
+
const x = new qe(), B = P, H = O - U;
|
|
325
325
|
f.right = x, x.boundingData = new Float32Array(6), Gs(p, B, H, x.boundingData, u), F(x, B, H, u, S + 1);
|
|
326
326
|
}
|
|
327
327
|
return f;
|
|
@@ -440,7 +440,7 @@ const Ro = function() {
|
|
|
440
440
|
}
|
|
441
441
|
};
|
|
442
442
|
}(), Ao = function() {
|
|
443
|
-
const l = new M(), e = new M(), t = new Fi(), s = new
|
|
443
|
+
const l = new M(), e = new M(), t = new Fi(), s = new Pt();
|
|
444
444
|
return function(o, n) {
|
|
445
445
|
const { radius: r, center: a } = o, { a: c, b: E, c: d } = n;
|
|
446
446
|
if (s.start = c, s.end = E, s.closestPointToPoint(a, !0, l).distanceTo(a) <= r || (s.start = c, s.end = d, s.closestPointToPoint(a, !0, l).distanceTo(a) <= r) || (s.start = E, s.end = d, s.closestPointToPoint(a, !0, l).distanceTo(a) <= r))
|
|
@@ -476,7 +476,7 @@ class Ft extends ue {
|
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
478
|
Ft.prototype.closestPointToSegment = function() {
|
|
479
|
-
const l = new M(), e = new M(), t = new
|
|
479
|
+
const l = new M(), e = new M(), t = new Pt();
|
|
480
480
|
return function(i, o = null, n = null) {
|
|
481
481
|
const { start: r, end: a } = i, c = this.points;
|
|
482
482
|
let E, d = 1 / 0;
|
|
@@ -488,7 +488,7 @@ Ft.prototype.closestPointToSegment = function() {
|
|
|
488
488
|
};
|
|
489
489
|
}();
|
|
490
490
|
Ft.prototype.intersectsTriangle = function() {
|
|
491
|
-
const l = new Ft(), e = new Array(3), t = new Array(3), s = new wt(), i = new wt(), o = new M(), n = new M(), r = new M(), a = new M(), c = new M(), E = new
|
|
491
|
+
const l = new Ft(), e = new Array(3), t = new Array(3), s = new wt(), i = new wt(), o = new M(), n = new M(), r = new M(), a = new M(), c = new M(), E = new Pt(), d = new Pt(), h = new Pt(), u = new M();
|
|
492
492
|
function p(A, m, C) {
|
|
493
493
|
const R = A.points;
|
|
494
494
|
let F = 0, f = -1;
|
|
@@ -521,22 +521,22 @@ Ft.prototype.intersectsTriangle = function() {
|
|
|
521
521
|
const T = this.satBounds, O = this.satAxes;
|
|
522
522
|
t[0] = m.a, t[1] = m.b, t[2] = m.c;
|
|
523
523
|
for (let N = 0; N < 4; N++) {
|
|
524
|
-
const
|
|
525
|
-
if (s.setFromPoints(w, t),
|
|
524
|
+
const P = T[N], w = O[N];
|
|
525
|
+
if (s.setFromPoints(w, t), P.isSeparated(s))
|
|
526
526
|
return !1;
|
|
527
527
|
}
|
|
528
528
|
const _ = m.satBounds, S = m.satAxes;
|
|
529
529
|
e[0] = this.a, e[1] = this.b, e[2] = this.c;
|
|
530
530
|
for (let N = 0; N < 4; N++) {
|
|
531
|
-
const
|
|
532
|
-
if (s.setFromPoints(w, e),
|
|
531
|
+
const P = _[N], w = S[N];
|
|
532
|
+
if (s.setFromPoints(w, e), P.isSeparated(s))
|
|
533
533
|
return !1;
|
|
534
534
|
}
|
|
535
535
|
for (let N = 0; N < 4; N++) {
|
|
536
|
-
const
|
|
536
|
+
const P = O[N];
|
|
537
537
|
for (let w = 0; w < 4; w++) {
|
|
538
538
|
const y = S[w];
|
|
539
|
-
if (o.crossVectors(
|
|
539
|
+
if (o.crossVectors(P, y), s.setFromPoints(o, e), i.setFromPoints(o, t), s.isSeparated(i))
|
|
540
540
|
return !1;
|
|
541
541
|
}
|
|
542
542
|
}
|
|
@@ -556,8 +556,8 @@ Ft.prototype.intersectsTriangle = function() {
|
|
|
556
556
|
let U = h.start;
|
|
557
557
|
h.start = h.end, h.end = U;
|
|
558
558
|
}
|
|
559
|
-
const _ = d.start.dot(r), S = d.end.dot(r), N = h.start.dot(r),
|
|
560
|
-
return _ !==
|
|
559
|
+
const _ = d.start.dot(r), S = d.end.dot(r), N = h.start.dot(r), P = h.end.dot(r), w = S < N, y = _ < P;
|
|
560
|
+
return _ !== P && N !== S && w === y ? !1 : (C && (c.subVectors(d.start, h.start), c.dot(r) > 0 ? C.start.copy(d.start) : C.start.copy(h.start), c.subVectors(d.end, h.end), c.dot(r) < 0 ? C.end.copy(d.end) : C.end.copy(h.end)), !0);
|
|
561
561
|
}
|
|
562
562
|
};
|
|
563
563
|
}();
|
|
@@ -568,7 +568,7 @@ Ft.prototype.distanceToPoint = function() {
|
|
|
568
568
|
};
|
|
569
569
|
}();
|
|
570
570
|
Ft.prototype.distanceToTriangle = function() {
|
|
571
|
-
const l = new M(), e = new M(), t = ["a", "b", "c"], s = new
|
|
571
|
+
const l = new M(), e = new M(), t = ["a", "b", "c"], s = new Pt(), i = new Pt();
|
|
572
572
|
return function(n, r = null, a = null) {
|
|
573
573
|
const c = r || a ? s : null;
|
|
574
574
|
if (this.intersectsTriangle(n, c))
|
|
@@ -678,7 +678,7 @@ at.prototype.distanceToPoint = function() {
|
|
|
678
678
|
};
|
|
679
679
|
}();
|
|
680
680
|
at.prototype.distanceToBox = function() {
|
|
681
|
-
const l = ["x", "y", "z"], e = new Array(12).fill().map(() => new
|
|
681
|
+
const l = ["x", "y", "z"], e = new Array(12).fill().map(() => new Pt()), t = new Array(12).fill().map(() => new Pt()), s = new M(), i = new M();
|
|
682
682
|
return function(n, r = 0, a = null, c = null) {
|
|
683
683
|
if (this.needsUpdate && this.update(), this.intersectsBox(n))
|
|
684
684
|
return (a || c) && (n.getCenter(i), this.closestPointToPoint(i, s), n.closestPointToPoint(s, i), a && a.copy(s), c && c.copy(i)), 0;
|
|
@@ -697,8 +697,8 @@ at.prototype.distanceToBox = function() {
|
|
|
697
697
|
for (let R = 0; R <= 1; R++) {
|
|
698
698
|
const F = (m + 1) % 3, f = (m + 2) % 3, T = C << F | R << f, O = 1 << m | C << F | R << f, _ = u[T], S = u[O];
|
|
699
699
|
e[A].set(_, S);
|
|
700
|
-
const
|
|
701
|
-
x[
|
|
700
|
+
const P = l[m], w = l[F], y = l[f], U = t[A], x = U.start, B = U.end;
|
|
701
|
+
x[P] = d[P], x[w] = C ? d[w] : h[w], x[y] = R ? d[y] : h[w], B[P] = h[P], B[w] = C ? d[w] : h[w], B[y] = R ? d[y] : h[w], A++;
|
|
702
702
|
}
|
|
703
703
|
for (let m = 0; m <= 1; m++)
|
|
704
704
|
for (let C = 0; C <= 1; C++)
|
|
@@ -786,7 +786,7 @@ function ai(l, e, t, s, i = null, o = 0, n = 0) {
|
|
|
786
786
|
const h = Et(l, c), u = ft(E, a);
|
|
787
787
|
return K(l, r, Yt), s(h, u, !1, n, o + l, Yt);
|
|
788
788
|
} else {
|
|
789
|
-
let
|
|
789
|
+
let P = function(y) {
|
|
790
790
|
const { uint16Array: U, uint32Array: x } = Z;
|
|
791
791
|
let B = y * 2;
|
|
792
792
|
for (; !ht(B, U); )
|
|
@@ -810,7 +810,7 @@ function ai(l, e, t, s, i = null, o = 0, n = 0) {
|
|
|
810
810
|
const f = ht(p * 2, a), T = t(R, f, m, n + 1, o + p);
|
|
811
811
|
let O;
|
|
812
812
|
if (T === xi) {
|
|
813
|
-
const y =
|
|
813
|
+
const y = P(p), x = w(p) - y;
|
|
814
814
|
O = s(y, x, !0, n + 1, o + p, R);
|
|
815
815
|
} else
|
|
816
816
|
O = T && ai(
|
|
@@ -828,7 +828,7 @@ function ai(l, e, t, s, i = null, o = 0, n = 0) {
|
|
|
828
828
|
const _ = ht(A * 2, a), S = t(F, _, C, n + 1, o + A);
|
|
829
829
|
let N;
|
|
830
830
|
if (S === xi) {
|
|
831
|
-
const y =
|
|
831
|
+
const y = P(A), x = w(A) - y;
|
|
832
832
|
N = s(y, x, !0, n + 1, o + A, F);
|
|
833
833
|
} else
|
|
834
834
|
N = S && ai(
|
|
@@ -865,12 +865,12 @@ function So(l, e, t = {}, s = 0, i = 1 / 0) {
|
|
|
865
865
|
const te = /* @__PURE__ */ new M(), ee = /* @__PURE__ */ new M(), se = /* @__PURE__ */ new M(), $e = /* @__PURE__ */ new fe(), Je = /* @__PURE__ */ new fe(), ts = /* @__PURE__ */ new fe(), Vi = /* @__PURE__ */ new M(), Gi = /* @__PURE__ */ new M(), zi = /* @__PURE__ */ new M(), es = /* @__PURE__ */ new M();
|
|
866
866
|
function No(l, e, t, s, i, o) {
|
|
867
867
|
let n;
|
|
868
|
-
return o === Zn ? n = l.intersectTriangle(s, t, e, !0, i) : n = l.intersectTriangle(e, t, s, o !==
|
|
868
|
+
return o === Zn ? n = l.intersectTriangle(s, t, e, !0, i) : n = l.intersectTriangle(e, t, s, o !== Pn, i), n === null ? null : {
|
|
869
869
|
distance: l.origin.distanceTo(i),
|
|
870
870
|
point: i.clone()
|
|
871
871
|
};
|
|
872
872
|
}
|
|
873
|
-
function
|
|
873
|
+
function Lo(l, e, t, s, i, o, n, r, a) {
|
|
874
874
|
te.fromBufferAttribute(e, o), ee.fromBufferAttribute(e, n), se.fromBufferAttribute(e, r);
|
|
875
875
|
const c = No(l, te, ee, se, es, a);
|
|
876
876
|
if (c) {
|
|
@@ -891,7 +891,7 @@ function xs(l, e, t, s, i) {
|
|
|
891
891
|
let n = o + 0, r = o + 1, a = o + 2;
|
|
892
892
|
const c = l.index;
|
|
893
893
|
l.index && (n = c.getX(n), r = c.getX(r), a = c.getX(a));
|
|
894
|
-
const { position: E, normal: d, uv: h, uv1: u } = l.attributes, p =
|
|
894
|
+
const { position: E, normal: d, uv: h, uv1: u } = l.attributes, p = Lo(t, E, d, h, u, n, r, a, e);
|
|
895
895
|
return p ? (p.faceIndex = s, i && i.push(p), p) : null;
|
|
896
896
|
}
|
|
897
897
|
function tt(l, e, t, s) {
|
|
@@ -899,7 +899,7 @@ function tt(l, e, t, s) {
|
|
|
899
899
|
let r = e, a = e + 1, c = e + 2;
|
|
900
900
|
t && (r = t.getX(r), a = t.getX(a), c = t.getX(c)), i.x = s.getX(r), i.y = s.getY(r), i.z = s.getZ(r), o.x = s.getX(a), o.y = s.getY(a), o.z = s.getZ(a), n.x = s.getX(c), n.y = s.getY(c), n.z = s.getZ(c);
|
|
901
901
|
}
|
|
902
|
-
function
|
|
902
|
+
function Po(l, e, t, s, i, o) {
|
|
903
903
|
const { geometry: n, _indirectBuffer: r } = l;
|
|
904
904
|
for (let a = s, c = s + i; a < c; a++)
|
|
905
905
|
xs(n, e, t, a, o);
|
|
@@ -934,7 +934,7 @@ function wo(l, e = null) {
|
|
|
934
934
|
if (r[A + 15] === Us) {
|
|
935
935
|
const C = n[h + 6], R = r[A + 14];
|
|
936
936
|
let F = 1 / 0, f = 1 / 0, T = 1 / 0, O = -1 / 0, _ = -1 / 0, S = -1 / 0;
|
|
937
|
-
for (let N = 3 * C,
|
|
937
|
+
for (let N = 3 * C, P = 3 * (C + R); N < P; N++) {
|
|
938
938
|
let w = s[N];
|
|
939
939
|
const y = i.getX(w), U = i.getY(w), x = i.getZ(w);
|
|
940
940
|
y < F && (F = y), y > O && (O = y), U < f && (f = U), U > _ && (_ = U), x < T && (T = x), x > S && (S = x);
|
|
@@ -945,11 +945,11 @@ function wo(l, e = null) {
|
|
|
945
945
|
let T = p, O = !1, _ = !1;
|
|
946
946
|
e ? T || (O = e.has(F), _ = e.has(f), T = !O && !_) : (O = !0, _ = !0);
|
|
947
947
|
const S = T || O, N = T || _;
|
|
948
|
-
let
|
|
949
|
-
S && (
|
|
948
|
+
let P = !1;
|
|
949
|
+
S && (P = d(C, u, T));
|
|
950
950
|
let w = !1;
|
|
951
951
|
N && (w = d(R, u, T));
|
|
952
|
-
const y =
|
|
952
|
+
const y = P || w;
|
|
953
953
|
if (y)
|
|
954
954
|
for (let U = 0; U < 3; U++) {
|
|
955
955
|
const x = C + U, B = R + U, H = a[x], q = a[x + 3], st = a[B], Q = a[B + 3];
|
|
@@ -996,7 +996,7 @@ function ci(l, e, t, s, i) {
|
|
|
996
996
|
const { float32Array: o, uint16Array: n, uint32Array: r } = Z, a = l * 2;
|
|
997
997
|
if (ht(a, n)) {
|
|
998
998
|
const E = Et(l, r), d = ft(a, n);
|
|
999
|
-
|
|
999
|
+
Po(e, t, s, E, d, i);
|
|
1000
1000
|
} else {
|
|
1001
1001
|
const E = pt(l);
|
|
1002
1002
|
Gt(E, o, s, ki) && ci(E, e, t, s, i);
|
|
@@ -1081,14 +1081,14 @@ function ko(l, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1081
1081
|
if (e.boundsTree)
|
|
1082
1082
|
return e.boundsTree.shapecast({
|
|
1083
1083
|
boundsTraverseOrder: (S) => Oe.distanceToBox(S),
|
|
1084
|
-
intersectsBounds: (S, N,
|
|
1084
|
+
intersectsBounds: (S, N, P) => P < R && P < n,
|
|
1085
1085
|
intersectsRange: (S, N) => {
|
|
1086
|
-
for (let
|
|
1087
|
-
tt(u, 3 *
|
|
1086
|
+
for (let P = S, w = S + N; P < w; P++) {
|
|
1087
|
+
tt(u, 3 * P, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1088
1088
|
for (let y = T, U = T + O; y < U; y++) {
|
|
1089
1089
|
tt(h, 3 * y, c, a), h.needsUpdate = !0;
|
|
1090
1090
|
const x = h.distanceToTriangle(u, p, m);
|
|
1091
|
-
if (x < R && (A.copy(p), C && C.copy(m), R = x, F = y, f =
|
|
1091
|
+
if (x < R && (A.copy(p), C && C.copy(m), R = x, F = y, f = P), x < o)
|
|
1092
1092
|
return !0;
|
|
1093
1093
|
}
|
|
1094
1094
|
}
|
|
@@ -1098,10 +1098,10 @@ function ko(l, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1098
1098
|
const _ = pe(e);
|
|
1099
1099
|
for (let S = 0, N = _; S < N; S++) {
|
|
1100
1100
|
tt(u, 3 * S, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1101
|
-
for (let
|
|
1102
|
-
tt(h, 3 *
|
|
1101
|
+
for (let P = T, w = T + O; P < w; P++) {
|
|
1102
|
+
tt(h, 3 * P, c, a), h.needsUpdate = !0;
|
|
1103
1103
|
const y = h.distanceToTriangle(u, p, m);
|
|
1104
|
-
if (y < R && (A.copy(p), C && C.copy(m), R = y, F =
|
|
1104
|
+
if (y < R && (A.copy(p), C && C.copy(m), R = y, F = P, f = S), y < o)
|
|
1105
1105
|
return !0;
|
|
1106
1106
|
}
|
|
1107
1107
|
}
|
|
@@ -1122,7 +1122,7 @@ function Wo(l, e = null) {
|
|
|
1122
1122
|
if (r[A + 15] === Us) {
|
|
1123
1123
|
const C = n[h + 6], R = r[A + 14];
|
|
1124
1124
|
let F = 1 / 0, f = 1 / 0, T = 1 / 0, O = -1 / 0, _ = -1 / 0, S = -1 / 0;
|
|
1125
|
-
for (let N = C,
|
|
1125
|
+
for (let N = C, P = C + R; N < P; N++) {
|
|
1126
1126
|
const w = 3 * l.resolveTriangleIndex(N);
|
|
1127
1127
|
for (let y = 0; y < 3; y++) {
|
|
1128
1128
|
let U = w + y;
|
|
@@ -1137,11 +1137,11 @@ function Wo(l, e = null) {
|
|
|
1137
1137
|
let T = p, O = !1, _ = !1;
|
|
1138
1138
|
e ? T || (O = e.has(F), _ = e.has(f), T = !O && !_) : (O = !0, _ = !0);
|
|
1139
1139
|
const S = T || O, N = T || _;
|
|
1140
|
-
let
|
|
1141
|
-
S && (
|
|
1140
|
+
let P = !1;
|
|
1141
|
+
S && (P = d(C, u, T));
|
|
1142
1142
|
let w = !1;
|
|
1143
1143
|
N && (w = d(R, u, T));
|
|
1144
|
-
const y =
|
|
1144
|
+
const y = P || w;
|
|
1145
1145
|
if (y)
|
|
1146
1146
|
for (let U = 0; U < 3; U++) {
|
|
1147
1147
|
const x = C + U, B = R + U, H = a[x], q = a[x + 3], st = a[B], Q = a[B + 3];
|
|
@@ -1246,16 +1246,16 @@ function tr(l, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1246
1246
|
const _ = e.boundsTree;
|
|
1247
1247
|
return _.shapecast({
|
|
1248
1248
|
boundsTraverseOrder: (S) => _e.distanceToBox(S),
|
|
1249
|
-
intersectsBounds: (S, N,
|
|
1249
|
+
intersectsBounds: (S, N, P) => P < R && P < n,
|
|
1250
1250
|
intersectsRange: (S, N) => {
|
|
1251
|
-
for (let
|
|
1252
|
-
const y = _.resolveTriangleIndex(
|
|
1251
|
+
for (let P = S, w = S + N; P < w; P++) {
|
|
1252
|
+
const y = _.resolveTriangleIndex(P);
|
|
1253
1253
|
tt(u, 3 * y, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1254
1254
|
for (let U = T, x = T + O; U < x; U++) {
|
|
1255
1255
|
const B = l.resolveTriangleIndex(U);
|
|
1256
1256
|
tt(h, 3 * B, c, a), h.needsUpdate = !0;
|
|
1257
1257
|
const H = h.distanceToTriangle(u, p, m);
|
|
1258
|
-
if (H < R && (A.copy(p), C && C.copy(m), R = H, F = U, f =
|
|
1258
|
+
if (H < R && (A.copy(p), C && C.copy(m), R = H, F = U, f = P), H < o)
|
|
1259
1259
|
return !0;
|
|
1260
1260
|
}
|
|
1261
1261
|
}
|
|
@@ -1265,11 +1265,11 @@ function tr(l, e, t, s = {}, i = {}, o = 0, n = 1 / 0) {
|
|
|
1265
1265
|
const _ = pe(e);
|
|
1266
1266
|
for (let S = 0, N = _; S < N; S++) {
|
|
1267
1267
|
tt(u, 3 * S, d, E), u.a.applyMatrix4(t), u.b.applyMatrix4(t), u.c.applyMatrix4(t), u.needsUpdate = !0;
|
|
1268
|
-
for (let
|
|
1269
|
-
const y = l.resolveTriangleIndex(
|
|
1268
|
+
for (let P = T, w = T + O; P < w; P++) {
|
|
1269
|
+
const y = l.resolveTriangleIndex(P);
|
|
1270
1270
|
tt(h, 3 * y, c, a), h.needsUpdate = !0;
|
|
1271
1271
|
const U = h.distanceToTriangle(u, p, m);
|
|
1272
|
-
if (U < R && (A.copy(p), C && C.copy(m), R = U, F =
|
|
1272
|
+
if (U < R && (A.copy(p), C && C.copy(m), R = U, F = P, f = S), U < o)
|
|
1273
1273
|
return !0;
|
|
1274
1274
|
}
|
|
1275
1275
|
}
|
|
@@ -1340,8 +1340,8 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1340
1340
|
else if (O) {
|
|
1341
1341
|
const S = vt.getPrimitive();
|
|
1342
1342
|
K(e, m, S), S.applyMatrix4(t);
|
|
1343
|
-
const N = pt(l),
|
|
1344
|
-
K(N, u, ae), K(
|
|
1343
|
+
const N = pt(l), P = Ct(l, p);
|
|
1344
|
+
K(N, u, ae), K(P, u, ce);
|
|
1345
1345
|
const w = S.intersectsBox(ae), y = S.intersectsBox(ce);
|
|
1346
1346
|
_ = w && Tt(
|
|
1347
1347
|
e,
|
|
@@ -1357,7 +1357,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1357
1357
|
!E
|
|
1358
1358
|
) || y && Tt(
|
|
1359
1359
|
e,
|
|
1360
|
-
|
|
1360
|
+
P,
|
|
1361
1361
|
s,
|
|
1362
1362
|
t,
|
|
1363
1363
|
i,
|
|
@@ -1371,8 +1371,8 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1371
1371
|
} else {
|
|
1372
1372
|
const S = pt(e), N = Ct(e, C);
|
|
1373
1373
|
K(S, m, Xs), K(N, m, Zs);
|
|
1374
|
-
const
|
|
1375
|
-
if (
|
|
1374
|
+
const P = c.intersectsBox(Xs), w = c.intersectsBox(Zs);
|
|
1375
|
+
if (P && w)
|
|
1376
1376
|
_ = Tt(
|
|
1377
1377
|
l,
|
|
1378
1378
|
S,
|
|
@@ -1398,7 +1398,7 @@ function Tt(l, e, t, s, i, o = 0, n = 0, r = 0, a = 0, c = null, E = !1) {
|
|
|
1398
1398
|
c,
|
|
1399
1399
|
E
|
|
1400
1400
|
);
|
|
1401
|
-
else if (
|
|
1401
|
+
else if (P)
|
|
1402
1402
|
if (T)
|
|
1403
1403
|
_ = Tt(
|
|
1404
1404
|
l,
|
|
@@ -1524,7 +1524,7 @@ class _i {
|
|
|
1524
1524
|
if (r._roots = o, r._indirectBuffer = n || null, s.setIndex) {
|
|
1525
1525
|
const a = t.getIndex();
|
|
1526
1526
|
if (a === null) {
|
|
1527
|
-
const c = new
|
|
1527
|
+
const c = new Ln(e.index, 1, !1);
|
|
1528
1528
|
t.setIndex(c);
|
|
1529
1529
|
} else
|
|
1530
1530
|
a.array !== i && (a.array.set(i), a.needsUpdate = !0);
|
|
@@ -1648,7 +1648,7 @@ class _i {
|
|
|
1648
1648
|
const p = (A, m, C, R, F, f, T, O) => {
|
|
1649
1649
|
for (let _ = C, S = C + R; _ < S; _++) {
|
|
1650
1650
|
u(_), E.a.applyMatrix4(t), E.b.applyMatrix4(t), E.c.applyMatrix4(t), E.needsUpdate = !0;
|
|
1651
|
-
for (let N = A,
|
|
1651
|
+
for (let N = A, P = A + m; N < P; N++)
|
|
1652
1652
|
if (c(N), n.needsUpdate = !0, o(n, E, N, _, F, f, T, O))
|
|
1653
1653
|
return !0;
|
|
1654
1654
|
}
|
|
@@ -1974,7 +1974,7 @@ class lr extends Ni {
|
|
|
1974
1974
|
this.three.children = [], this.onDisposed.trigger(), this.onDisposed.reset();
|
|
1975
1975
|
}
|
|
1976
1976
|
}
|
|
1977
|
-
const ms = 0, hr = 1, Er = new M(), Ji = new
|
|
1977
|
+
const ms = 0, hr = 1, Er = new M(), Ji = new Pt(), qs = new Fi(), tn = new M(), ls = new ue();
|
|
1978
1978
|
class dr {
|
|
1979
1979
|
constructor() {
|
|
1980
1980
|
this.tolerance = -1, this.faces = [], this.newFaces = [], this.assigned = new en(), this.unassigned = new en(), this.vertices = [];
|
|
@@ -2404,16 +2404,16 @@ function Tr(l) {
|
|
|
2404
2404
|
p.divideScalar(A), m /= A, C /= A, R /= A, F /= A, f /= A, T /= A, m -= p.x * p.x, C -= p.x * p.y, R -= p.x * p.z, F -= p.y * p.y, f -= p.y * p.z, T -= p.z * p.z;
|
|
2405
2405
|
const O = new g.Matrix3();
|
|
2406
2406
|
O.elements[0] = m, O.elements[1] = C, O.elements[2] = R, O.elements[3] = C, O.elements[4] = F, O.elements[5] = f, O.elements[6] = R, O.elements[7] = f, O.elements[8] = T, Cr(O, s);
|
|
2407
|
-
const _ = s.unitary, S = new g.Vector3(), N = new g.Vector3(),
|
|
2408
|
-
_.extractBasis(S, N,
|
|
2407
|
+
const _ = s.unitary, S = new g.Vector3(), N = new g.Vector3(), P = new g.Vector3();
|
|
2408
|
+
_.extractBasis(S, N, P);
|
|
2409
2409
|
let w = -1 / 0, y = -1 / 0, U = -1 / 0, x = 1 / 0, B = 1 / 0, H = 1 / 0;
|
|
2410
2410
|
for (let it = 0, Xt = e.length; it < Xt; it++) {
|
|
2411
2411
|
const J = e[it];
|
|
2412
|
-
w = Math.max(S.dot(J), w), y = Math.max(N.dot(J), y), U = Math.max(
|
|
2412
|
+
w = Math.max(S.dot(J), w), y = Math.max(N.dot(J), y), U = Math.max(P.dot(J), U), x = Math.min(S.dot(J), x), B = Math.min(N.dot(J), B), H = Math.min(P.dot(J), H);
|
|
2413
2413
|
}
|
|
2414
|
-
S.multiplyScalar(0.5 * (x + w)), N.multiplyScalar(0.5 * (B + y)),
|
|
2414
|
+
S.multiplyScalar(0.5 * (x + w)), N.multiplyScalar(0.5 * (B + y)), P.multiplyScalar(0.5 * (H + U));
|
|
2415
2415
|
const q = new g.Vector3(), st = new g.Vector3(), Q = new g.Matrix3();
|
|
2416
|
-
q.add(S).add(N).add(
|
|
2416
|
+
q.add(S).add(N).add(P), st.x = w - x, st.y = y - B, st.z = U - H, st.multiplyScalar(0.5), Q.copy(_);
|
|
2417
2417
|
const { x: Ht, y: kt, z: Wt } = st, We = new g.Matrix4();
|
|
2418
2418
|
We.makeScale(Ht * 2, kt * 2, Wt * 2);
|
|
2419
2419
|
const Ce = new g.Matrix4();
|
|
@@ -2719,40 +2719,105 @@ let Ge = $;
|
|
|
2719
2719
|
class ea extends et {
|
|
2720
2720
|
constructor(t, s) {
|
|
2721
2721
|
super(t);
|
|
2722
|
+
/** {@link Disposable.onDisposed} */
|
|
2723
|
+
I(this, "onDisposed", new D());
|
|
2724
|
+
/**
|
|
2725
|
+
* An event that is triggered when a vertex is found.
|
|
2726
|
+
* The event passes a THREE.Vector3 representing the position of the found vertex.
|
|
2727
|
+
*/
|
|
2722
2728
|
I(this, "onVertexFound", new D());
|
|
2729
|
+
/**
|
|
2730
|
+
* An event that is triggered when a vertex is lost.
|
|
2731
|
+
* The event passes a THREE.Vector3 representing the position of the lost vertex.
|
|
2732
|
+
*/
|
|
2723
2733
|
I(this, "onVertexLost", new D());
|
|
2734
|
+
/**
|
|
2735
|
+
* A reference to the Components instance associated with this VertexPicker.
|
|
2736
|
+
*/
|
|
2724
2737
|
I(this, "components");
|
|
2738
|
+
/**
|
|
2739
|
+
* A reference to the working plane used for vertex picking.
|
|
2740
|
+
* This plane is used to determine which vertices are considered valid for picking.
|
|
2741
|
+
* If this value is null, all vertices are considered valid.
|
|
2742
|
+
*/
|
|
2743
|
+
I(this, "workingPlane", null);
|
|
2725
2744
|
I(this, "_pickedPoint", null);
|
|
2726
2745
|
I(this, "_config");
|
|
2727
2746
|
I(this, "_enabled", !1);
|
|
2728
|
-
I(this, "_workingPlane", null);
|
|
2729
2747
|
this.components = t, this.config = {
|
|
2730
2748
|
snapDistance: 0.25,
|
|
2731
2749
|
showOnlyVertex: !1,
|
|
2732
2750
|
...s
|
|
2733
2751
|
}, this.enabled = !1;
|
|
2734
2752
|
}
|
|
2753
|
+
/**
|
|
2754
|
+
* Sets the enabled state of the VertexPicker.
|
|
2755
|
+
* When enabled, the VertexPicker will actively search for vertices in the 3D scene.
|
|
2756
|
+
* When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
|
|
2757
|
+
*
|
|
2758
|
+
* @param value - The new enabled state.
|
|
2759
|
+
*/
|
|
2735
2760
|
set enabled(t) {
|
|
2736
2761
|
this._enabled = t, t || (this._pickedPoint = null);
|
|
2737
2762
|
}
|
|
2763
|
+
/**
|
|
2764
|
+
* Gets the current enabled state of the VertexPicker.
|
|
2765
|
+
*
|
|
2766
|
+
* @returns The current enabled state.
|
|
2767
|
+
*/
|
|
2738
2768
|
get enabled() {
|
|
2739
2769
|
return this._enabled;
|
|
2740
2770
|
}
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2771
|
+
/**
|
|
2772
|
+
* Sets the configuration for the VertexPicker component.
|
|
2773
|
+
*
|
|
2774
|
+
* @param value - A Partial object containing the configuration properties to update.
|
|
2775
|
+
* The properties not provided in the value object will retain their current values.
|
|
2776
|
+
*
|
|
2777
|
+
* @example
|
|
2778
|
+
* ```typescript
|
|
2779
|
+
* vertexPicker.config = {
|
|
2780
|
+
* snapDistance: 0.5,
|
|
2781
|
+
* showOnlyVertex: true,
|
|
2782
|
+
* };
|
|
2783
|
+
* ```
|
|
2784
|
+
*/
|
|
2747
2785
|
set config(t) {
|
|
2748
2786
|
this._config = { ...this._config, ...t };
|
|
2749
2787
|
}
|
|
2788
|
+
/**
|
|
2789
|
+
* Gets the current configuration for the VertexPicker component.
|
|
2790
|
+
*
|
|
2791
|
+
* @returns A copy of the current VertexPickerConfig object.
|
|
2792
|
+
*
|
|
2793
|
+
* @example
|
|
2794
|
+
* ```typescript
|
|
2795
|
+
* const currentConfig = vertexPicker.config;
|
|
2796
|
+
* console.log(currentConfig.snapDistance); // Output: 0.25
|
|
2797
|
+
* ```
|
|
2798
|
+
*/
|
|
2750
2799
|
get config() {
|
|
2751
2800
|
return this._config;
|
|
2752
2801
|
}
|
|
2802
|
+
/** {@link Disposable.dispose} */
|
|
2753
2803
|
dispose() {
|
|
2754
|
-
this.onVertexFound.reset(), this.onVertexLost.reset(), this.components = null;
|
|
2804
|
+
this.onVertexFound.reset(), this.onVertexLost.reset(), this.components = null, this.onDisposed.trigger(), this.onDisposed.reset();
|
|
2755
2805
|
}
|
|
2806
|
+
/**
|
|
2807
|
+
* Performs the vertex picking operation based on the current state of the VertexPicker.
|
|
2808
|
+
*
|
|
2809
|
+
* @param world - The World instance to use for raycasting.
|
|
2810
|
+
*
|
|
2811
|
+
* @returns The current picked point, or null if no point is picked.
|
|
2812
|
+
*
|
|
2813
|
+
* @remarks
|
|
2814
|
+
* This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
|
|
2815
|
+
* If enabled, it performs raycasting to find the closest intersecting object.
|
|
2816
|
+
* It then determines the closest vertex or point on the face, based on the configuration settings.
|
|
2817
|
+
* If the picked point is on the working plane (if defined), it triggers the `onVertexFound` event and updates the `pickedPoint`.
|
|
2818
|
+
* If the picked point is not on the working plane, it resets the `pickedPoint`.
|
|
2819
|
+
* If no intersecting object is found, it triggers the `onVertexLost` event and resets the `pickedPoint`.
|
|
2820
|
+
*/
|
|
2756
2821
|
get(t) {
|
|
2757
2822
|
if (!this.enabled)
|
|
2758
2823
|
return this._pickedPoint;
|
|
@@ -2899,7 +2964,7 @@ const Fs = class Fs {
|
|
|
2899
2964
|
/**
|
|
2900
2965
|
* The version of the @thatopen/components library.
|
|
2901
2966
|
*/
|
|
2902
|
-
I(Fs, "release", "2.0.
|
|
2967
|
+
I(Fs, "release", "2.0.14");
|
|
2903
2968
|
let pi = Fs;
|
|
2904
2969
|
class Rr {
|
|
2905
2970
|
constructor(e) {
|
|
@@ -3310,7 +3375,7 @@ const V = {
|
|
|
3310
3375
|
LEFT: 1,
|
|
3311
3376
|
RIGHT: 2,
|
|
3312
3377
|
MIDDLE: 4
|
|
3313
|
-
},
|
|
3378
|
+
}, L = Object.freeze({
|
|
3314
3379
|
NONE: 0,
|
|
3315
3380
|
ROTATE: 1,
|
|
3316
3381
|
TRUCK: 2,
|
|
@@ -3355,7 +3420,7 @@ function on(l, e) {
|
|
|
3355
3420
|
function Ne(l) {
|
|
3356
3421
|
return isFinite(l) ? l : l < 0 ? -Number.MAX_VALUE : Number.MAX_VALUE;
|
|
3357
3422
|
}
|
|
3358
|
-
function
|
|
3423
|
+
function Le(l) {
|
|
3359
3424
|
return Math.abs(l) < Number.MAX_VALUE ? l : l * (1 / 0);
|
|
3360
3425
|
}
|
|
3361
3426
|
function hs(l, e, t, s, i = 1 / 0, o) {
|
|
@@ -3381,8 +3446,8 @@ function rn(l, e, t, s, i = 1 / 0, o, n) {
|
|
|
3381
3446
|
E = l.x - u, d = l.y - p, h = l.z - A;
|
|
3382
3447
|
const O = (t.x + r * u) * o, _ = (t.y + r * p) * o, S = (t.z + r * A) * o;
|
|
3383
3448
|
t.x = (t.x - r * O) * c, t.y = (t.y - r * _) * c, t.z = (t.z - r * S) * c, n.x = E + (u + O) * c, n.y = d + (p + _) * c, n.z = h + (A + S) * c;
|
|
3384
|
-
const N = m - l.x,
|
|
3385
|
-
return N * y +
|
|
3449
|
+
const N = m - l.x, P = C - l.y, w = R - l.z, y = n.x - m, U = n.y - C, x = n.z - R;
|
|
3450
|
+
return N * y + P * U + w * x > 0 && (n.x = m, n.y = C, n.z = R, t.x = (n.x - m) / o, t.y = (n.y - C) / o, t.z = (n.z - R) / o), n;
|
|
3386
3451
|
}
|
|
3387
3452
|
function $s(l, e) {
|
|
3388
3453
|
e.set(0, 0), l.forEach((t) => {
|
|
@@ -3457,7 +3522,7 @@ class Or {
|
|
|
3457
3522
|
}
|
|
3458
3523
|
}
|
|
3459
3524
|
const gr = "2.7.3", Es = 1 / 8, bn = typeof window < "u", _r = bn && /Mac/.test(navigator.platform), Sr = !(bn && "PointerEvent" in window);
|
|
3460
|
-
let Y, an, ds, ti, lt, G, z, Ee,
|
|
3525
|
+
let Y, an, ds, ti, lt, G, z, Ee, Pe, gt, _t, Qt, cn, ln, dt, ye, de, hn, ei, En, si, ii, us;
|
|
3461
3526
|
class ot extends Or {
|
|
3462
3527
|
/**
|
|
3463
3528
|
* Injects THREE as the dependency. You can then proceed to use CameraControls.
|
|
@@ -3500,14 +3565,14 @@ class ot extends Or {
|
|
|
3500
3565
|
* @category Statics
|
|
3501
3566
|
*/
|
|
3502
3567
|
static install(e) {
|
|
3503
|
-
Y = e.THREE, an = Object.freeze(new Y.Vector3(0, 0, 0)), ds = Object.freeze(new Y.Vector3(0, 1, 0)), ti = Object.freeze(new Y.Vector3(0, 0, 1)), lt = new Y.Vector2(), G = new Y.Vector3(), z = new Y.Vector3(), Ee = new Y.Vector3(),
|
|
3568
|
+
Y = e.THREE, an = Object.freeze(new Y.Vector3(0, 0, 0)), ds = Object.freeze(new Y.Vector3(0, 1, 0)), ti = Object.freeze(new Y.Vector3(0, 0, 1)), lt = new Y.Vector2(), G = new Y.Vector3(), z = new Y.Vector3(), Ee = new Y.Vector3(), Pe = new Y.Vector3(), gt = new Y.Vector3(), _t = new Y.Vector3(), Qt = new Y.Vector3(), cn = new Y.Vector3(), ln = new Y.Vector3(), dt = new Y.Spherical(), ye = new Y.Spherical(), de = new Y.Box3(), hn = new Y.Box3(), ei = new Y.Sphere(), En = new Y.Quaternion(), si = new Y.Quaternion(), ii = new Y.Matrix4(), us = new Y.Raycaster();
|
|
3504
3569
|
}
|
|
3505
3570
|
/**
|
|
3506
3571
|
* list all ACTIONs
|
|
3507
3572
|
* @category Statics
|
|
3508
3573
|
*/
|
|
3509
3574
|
static get ACTION() {
|
|
3510
|
-
return
|
|
3575
|
+
return L;
|
|
3511
3576
|
}
|
|
3512
3577
|
/**
|
|
3513
3578
|
* Creates a `CameraControls` instance.
|
|
@@ -3528,10 +3593,10 @@ class ot extends Or {
|
|
|
3528
3593
|
*/
|
|
3529
3594
|
constructor(e, t) {
|
|
3530
3595
|
super(), this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.minDistance = Number.EPSILON, this.maxDistance = 1 / 0, this.infinityDolly = !1, this.minZoom = 0.01, this.maxZoom = 1 / 0, this.smoothTime = 0.25, this.draggingSmoothTime = 0.125, this.maxSpeed = 1 / 0, this.azimuthRotateSpeed = 1, this.polarRotateSpeed = 1, this.dollySpeed = 1, this.dollyDragInverted = !1, this.truckSpeed = 2, this.dollyToCursor = !1, this.dragToOffset = !1, this.verticalDragToForward = !1, this.boundaryFriction = 0, this.restThreshold = 0.01, this.colliderMeshes = [], this.cancel = () => {
|
|
3531
|
-
}, this._enabled = !0, this._state =
|
|
3596
|
+
}, this._enabled = !0, this._state = L.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = le.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new Y.Vector3(), this._focalOffsetVelocity = new Y.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (f, T, O) => {
|
|
3532
3597
|
let _, S;
|
|
3533
3598
|
if (Zt(this._camera)) {
|
|
3534
|
-
const N = G.copy(this._camera.position).sub(this._target),
|
|
3599
|
+
const N = G.copy(this._camera.position).sub(this._target), P = this._camera.getEffectiveFOV() * Se, w = N.length() * Math.tan(P * 0.5);
|
|
3535
3600
|
_ = this.truckSpeed * f * w / this._elementRect.height, S = this.truckSpeed * T * w / this._elementRect.height;
|
|
3536
3601
|
} else if (bt(this._camera)) {
|
|
3537
3602
|
const N = this._camera;
|
|
@@ -3543,25 +3608,25 @@ class ot extends Or {
|
|
|
3543
3608
|
const O = he * this.azimuthRotateSpeed * f / this._elementRect.height, _ = he * this.polarRotateSpeed * T / this._elementRect.height;
|
|
3544
3609
|
this.rotate(O, _, !0);
|
|
3545
3610
|
}, this._dollyInternal = (f, T, O) => {
|
|
3546
|
-
const _ = Math.pow(0.95, -f * this.dollySpeed), S = this._sphericalEnd.radius, N = this._sphericalEnd.radius * _,
|
|
3547
|
-
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(N, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(w, !0), this._dollyToNoClamp(
|
|
3611
|
+
const _ = Math.pow(0.95, -f * this.dollySpeed), S = this._sphericalEnd.radius, N = this._sphericalEnd.radius * _, P = mt(N, this.minDistance, this.maxDistance), w = P - N;
|
|
3612
|
+
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(N, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(w, !0), this._dollyToNoClamp(P, !0)) : this._dollyToNoClamp(P, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? N : P) - S, this._dollyControlCoord.set(T, O)), this._lastDollyDirection = Math.sign(-f);
|
|
3548
3613
|
}, this._zoomInternal = (f, T, O) => {
|
|
3549
3614
|
const _ = Math.pow(0.95, f * this.dollySpeed), S = this._zoom, N = this._zoom * _;
|
|
3550
3615
|
this.zoomTo(N, !0), this.dollyToCursor && (this._changedZoom += N - S, this._dollyControlCoord.set(T, O));
|
|
3551
|
-
}, typeof Y > "u" && console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."), this._camera = e, this._yAxisUpSpace = new Y.Quaternion().setFromUnitVectors(this._camera.up, ds), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state =
|
|
3616
|
+
}, typeof Y > "u" && console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."), this._camera = e, this._yAxisUpSpace = new Y.Quaternion().setFromUnitVectors(this._camera.up, ds), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = L.NONE, this._target = new Y.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new Y.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new Y.Spherical().setFromVector3(G.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)), this._sphericalEnd = this._spherical.clone(), this._lastDistance = this._spherical.radius, this._zoom = this._camera.zoom, this._zoomEnd = this._zoom, this._lastZoom = this._zoom, this._nearPlaneCorners = [
|
|
3552
3617
|
new Y.Vector3(),
|
|
3553
3618
|
new Y.Vector3(),
|
|
3554
3619
|
new Y.Vector3(),
|
|
3555
3620
|
new Y.Vector3()
|
|
3556
3621
|
], this._updateNearPlaneCorners(), this._boundary = new Y.Box3(new Y.Vector3(-1 / 0, -1 / 0, -1 / 0), new Y.Vector3(1 / 0, 1 / 0, 1 / 0)), this._cameraUp0 = this._camera.up.clone(), this._target0 = this._target.clone(), this._position0 = this._camera.position.clone(), this._zoom0 = this._zoom, this._focalOffset0 = this._focalOffset.clone(), this._dollyControlCoord = new Y.Vector2(), this.mouseButtons = {
|
|
3557
|
-
left:
|
|
3558
|
-
middle:
|
|
3559
|
-
right:
|
|
3560
|
-
wheel: Zt(this._camera) ?
|
|
3622
|
+
left: L.ROTATE,
|
|
3623
|
+
middle: L.DOLLY,
|
|
3624
|
+
right: L.TRUCK,
|
|
3625
|
+
wheel: Zt(this._camera) ? L.DOLLY : bt(this._camera) ? L.ZOOM : L.NONE
|
|
3561
3626
|
}, this.touches = {
|
|
3562
|
-
one:
|
|
3563
|
-
two: Zt(this._camera) ?
|
|
3564
|
-
three:
|
|
3627
|
+
one: L.TOUCH_ROTATE,
|
|
3628
|
+
two: Zt(this._camera) ? L.TOUCH_DOLLY_TRUCK : bt(this._camera) ? L.TOUCH_ZOOM_TRUCK : L.NONE,
|
|
3629
|
+
three: L.TOUCH_TRUCK
|
|
3565
3630
|
};
|
|
3566
3631
|
const s = new Y.Vector2(), i = new Y.Vector2(), o = new Y.Vector2(), n = (f) => {
|
|
3567
3632
|
if (!this._enabled || !this._domElement)
|
|
@@ -3638,7 +3703,7 @@ class ot extends Or {
|
|
|
3638
3703
|
if (T && this._disposePointer(T), f.pointerType === "touch")
|
|
3639
3704
|
switch (this._activePointers.length) {
|
|
3640
3705
|
case 0:
|
|
3641
|
-
this._state =
|
|
3706
|
+
this._state = L.NONE;
|
|
3642
3707
|
break;
|
|
3643
3708
|
case 1:
|
|
3644
3709
|
this._state = this.touches.one;
|
|
@@ -3651,45 +3716,45 @@ class ot extends Or {
|
|
|
3651
3716
|
break;
|
|
3652
3717
|
}
|
|
3653
3718
|
else
|
|
3654
|
-
this._state =
|
|
3719
|
+
this._state = L.NONE;
|
|
3655
3720
|
C();
|
|
3656
3721
|
}
|
|
3657
3722
|
}, d = () => {
|
|
3658
3723
|
const f = this._findPointerById(1);
|
|
3659
|
-
f && f === this._lockedPointer || (f && this._disposePointer(f), this._state =
|
|
3724
|
+
f && f === this._lockedPointer || (f && this._disposePointer(f), this._state = L.NONE, C());
|
|
3660
3725
|
};
|
|
3661
3726
|
let h = -1;
|
|
3662
3727
|
const u = (f) => {
|
|
3663
|
-
if (!this._domElement || !this._enabled || this.mouseButtons.wheel ===
|
|
3728
|
+
if (!this._domElement || !this._enabled || this.mouseButtons.wheel === L.NONE)
|
|
3664
3729
|
return;
|
|
3665
3730
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
3666
|
-
const N = this._domElement.getBoundingClientRect(),
|
|
3667
|
-
if (
|
|
3731
|
+
const N = this._domElement.getBoundingClientRect(), P = f.clientX / N.width, w = f.clientY / N.height;
|
|
3732
|
+
if (P < this._interactiveArea.left || P > this._interactiveArea.right || w < this._interactiveArea.top || w > this._interactiveArea.bottom)
|
|
3668
3733
|
return;
|
|
3669
3734
|
}
|
|
3670
|
-
if (f.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel ===
|
|
3735
|
+
if (f.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === L.ROTATE || this.mouseButtons.wheel === L.TRUCK) {
|
|
3671
3736
|
const N = performance.now();
|
|
3672
3737
|
h - N < 1e3 && this._getClientRect(this._elementRect), h = N;
|
|
3673
3738
|
}
|
|
3674
3739
|
const T = _r ? -1 : -3, O = f.deltaMode === 1 ? f.deltaY / T : f.deltaY / (T * 10), _ = this.dollyToCursor ? (f.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, S = this.dollyToCursor ? (f.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
3675
3740
|
switch (this.mouseButtons.wheel) {
|
|
3676
|
-
case
|
|
3741
|
+
case L.ROTATE: {
|
|
3677
3742
|
this._rotateInternal(f.deltaX, f.deltaY), this._isUserControllingRotate = !0;
|
|
3678
3743
|
break;
|
|
3679
3744
|
}
|
|
3680
|
-
case
|
|
3745
|
+
case L.TRUCK: {
|
|
3681
3746
|
this._truckInternal(f.deltaX, f.deltaY, !1), this._isUserControllingTruck = !0;
|
|
3682
3747
|
break;
|
|
3683
3748
|
}
|
|
3684
|
-
case
|
|
3749
|
+
case L.OFFSET: {
|
|
3685
3750
|
this._truckInternal(f.deltaX, f.deltaY, !0), this._isUserControllingOffset = !0;
|
|
3686
3751
|
break;
|
|
3687
3752
|
}
|
|
3688
|
-
case
|
|
3753
|
+
case L.DOLLY: {
|
|
3689
3754
|
this._dollyInternal(-O, _, S), this._isUserControllingDolly = !0;
|
|
3690
3755
|
break;
|
|
3691
3756
|
}
|
|
3692
|
-
case
|
|
3757
|
+
case L.ZOOM: {
|
|
3693
3758
|
this._zoomInternal(-O, _, S), this._isUserControllingZoom = !0;
|
|
3694
3759
|
break;
|
|
3695
3760
|
}
|
|
@@ -3710,8 +3775,8 @@ class ot extends Or {
|
|
|
3710
3775
|
if ($s(this._activePointers, lt), this._getClientRect(this._elementRect), s.copy(lt), i.copy(lt), this._activePointers.length >= 2) {
|
|
3711
3776
|
const O = lt.x - this._activePointers[1].clientX, _ = lt.y - this._activePointers[1].clientY, S = Math.sqrt(O * O + _ * _);
|
|
3712
3777
|
o.set(0, S);
|
|
3713
|
-
const N = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5,
|
|
3714
|
-
i.set(N,
|
|
3778
|
+
const N = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, P = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
|
|
3779
|
+
i.set(N, P);
|
|
3715
3780
|
}
|
|
3716
3781
|
if (this._state = 0, !f)
|
|
3717
3782
|
this._lockedPointer && (this._state = this._state | this.mouseButtons.left);
|
|
@@ -3729,23 +3794,23 @@ class ot extends Or {
|
|
|
3729
3794
|
}
|
|
3730
3795
|
else
|
|
3731
3796
|
!this._lockedPointer && (f.buttons & V.LEFT) === V.LEFT && (this._state = this._state | this.mouseButtons.left), (f.buttons & V.MIDDLE) === V.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (f.buttons & V.RIGHT) === V.RIGHT && (this._state = this._state | this.mouseButtons.right);
|
|
3732
|
-
((this._state &
|
|
3797
|
+
((this._state & L.ROTATE) === L.ROTATE || (this._state & L.TOUCH_ROTATE) === L.TOUCH_ROTATE || (this._state & L.TOUCH_DOLLY_ROTATE) === L.TOUCH_DOLLY_ROTATE || (this._state & L.TOUCH_ZOOM_ROTATE) === L.TOUCH_ZOOM_ROTATE) && (this._sphericalEnd.theta = this._spherical.theta, this._sphericalEnd.phi = this._spherical.phi, this._thetaVelocity.value = 0, this._phiVelocity.value = 0), ((this._state & L.TRUCK) === L.TRUCK || (this._state & L.TOUCH_TRUCK) === L.TOUCH_TRUCK || (this._state & L.TOUCH_DOLLY_TRUCK) === L.TOUCH_DOLLY_TRUCK || (this._state & L.TOUCH_ZOOM_TRUCK) === L.TOUCH_ZOOM_TRUCK) && (this._targetEnd.copy(this._target), this._targetVelocity.set(0, 0, 0)), ((this._state & L.DOLLY) === L.DOLLY || (this._state & L.TOUCH_DOLLY) === L.TOUCH_DOLLY || (this._state & L.TOUCH_DOLLY_TRUCK) === L.TOUCH_DOLLY_TRUCK || (this._state & L.TOUCH_DOLLY_OFFSET) === L.TOUCH_DOLLY_OFFSET || (this._state & L.TOUCH_DOLLY_ROTATE) === L.TOUCH_DOLLY_ROTATE) && (this._sphericalEnd.radius = this._spherical.radius, this._radiusVelocity.value = 0), ((this._state & L.ZOOM) === L.ZOOM || (this._state & L.TOUCH_ZOOM) === L.TOUCH_ZOOM || (this._state & L.TOUCH_ZOOM_TRUCK) === L.TOUCH_ZOOM_TRUCK || (this._state & L.TOUCH_ZOOM_OFFSET) === L.TOUCH_ZOOM_OFFSET || (this._state & L.TOUCH_ZOOM_ROTATE) === L.TOUCH_ZOOM_ROTATE) && (this._zoomEnd = this._zoom, this._zoomVelocity.value = 0), ((this._state & L.OFFSET) === L.OFFSET || (this._state & L.TOUCH_OFFSET) === L.TOUCH_OFFSET || (this._state & L.TOUCH_DOLLY_OFFSET) === L.TOUCH_DOLLY_OFFSET || (this._state & L.TOUCH_ZOOM_OFFSET) === L.TOUCH_ZOOM_OFFSET) && (this._focalOffsetEnd.copy(this._focalOffset), this._focalOffsetVelocity.set(0, 0, 0)), this.dispatchEvent({ type: "controlstart" });
|
|
3733
3798
|
}, m = () => {
|
|
3734
3799
|
if (!this._enabled || !this._dragNeedsUpdate)
|
|
3735
3800
|
return;
|
|
3736
3801
|
this._dragNeedsUpdate = !1, $s(this._activePointers, lt);
|
|
3737
3802
|
const T = this._domElement && document.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, O = T ? -T.deltaX : i.x - lt.x, _ = T ? -T.deltaY : i.y - lt.y;
|
|
3738
|
-
if (i.copy(lt), ((this._state &
|
|
3739
|
-
const S = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, N = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0,
|
|
3740
|
-
(this._state &
|
|
3803
|
+
if (i.copy(lt), ((this._state & L.ROTATE) === L.ROTATE || (this._state & L.TOUCH_ROTATE) === L.TOUCH_ROTATE || (this._state & L.TOUCH_DOLLY_ROTATE) === L.TOUCH_DOLLY_ROTATE || (this._state & L.TOUCH_ZOOM_ROTATE) === L.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(O, _), this._isUserControllingRotate = !0), (this._state & L.DOLLY) === L.DOLLY || (this._state & L.ZOOM) === L.ZOOM) {
|
|
3804
|
+
const S = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, N = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, P = this.dollyDragInverted ? -1 : 1;
|
|
3805
|
+
(this._state & L.DOLLY) === L.DOLLY ? (this._dollyInternal(P * _ * Es, S, N), this._isUserControllingDolly = !0) : (this._zoomInternal(P * _ * Es, S, N), this._isUserControllingZoom = !0);
|
|
3741
3806
|
}
|
|
3742
|
-
if ((this._state &
|
|
3743
|
-
const S = lt.x - this._activePointers[1].clientX, N = lt.y - this._activePointers[1].clientY,
|
|
3744
|
-
o.set(0,
|
|
3807
|
+
if ((this._state & L.TOUCH_DOLLY) === L.TOUCH_DOLLY || (this._state & L.TOUCH_ZOOM) === L.TOUCH_ZOOM || (this._state & L.TOUCH_DOLLY_TRUCK) === L.TOUCH_DOLLY_TRUCK || (this._state & L.TOUCH_ZOOM_TRUCK) === L.TOUCH_ZOOM_TRUCK || (this._state & L.TOUCH_DOLLY_OFFSET) === L.TOUCH_DOLLY_OFFSET || (this._state & L.TOUCH_ZOOM_OFFSET) === L.TOUCH_ZOOM_OFFSET || (this._state & L.TOUCH_DOLLY_ROTATE) === L.TOUCH_DOLLY_ROTATE || (this._state & L.TOUCH_ZOOM_ROTATE) === L.TOUCH_ZOOM_ROTATE) {
|
|
3808
|
+
const S = lt.x - this._activePointers[1].clientX, N = lt.y - this._activePointers[1].clientY, P = Math.sqrt(S * S + N * N), w = o.y - P;
|
|
3809
|
+
o.set(0, P);
|
|
3745
3810
|
const y = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, U = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
3746
|
-
(this._state &
|
|
3811
|
+
(this._state & L.TOUCH_DOLLY) === L.TOUCH_DOLLY || (this._state & L.TOUCH_DOLLY_ROTATE) === L.TOUCH_DOLLY_ROTATE || (this._state & L.TOUCH_DOLLY_TRUCK) === L.TOUCH_DOLLY_TRUCK || (this._state & L.TOUCH_DOLLY_OFFSET) === L.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(w * Es, y, U), this._isUserControllingDolly = !0) : (this._zoomInternal(w * Es, y, U), this._isUserControllingZoom = !0);
|
|
3747
3812
|
}
|
|
3748
|
-
((this._state &
|
|
3813
|
+
((this._state & L.TRUCK) === L.TRUCK || (this._state & L.TOUCH_TRUCK) === L.TOUCH_TRUCK || (this._state & L.TOUCH_DOLLY_TRUCK) === L.TOUCH_DOLLY_TRUCK || (this._state & L.TOUCH_ZOOM_TRUCK) === L.TOUCH_ZOOM_TRUCK) && (this._truckInternal(O, _, !1), this._isUserControllingTruck = !0), ((this._state & L.OFFSET) === L.OFFSET || (this._state & L.TOUCH_OFFSET) === L.TOUCH_OFFSET || (this._state & L.TOUCH_DOLLY_OFFSET) === L.TOUCH_DOLLY_OFFSET || (this._state & L.TOUCH_ZOOM_OFFSET) === L.TOUCH_ZOOM_OFFSET) && (this._truckInternal(O, _, !0), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
|
|
3749
3814
|
}, C = () => {
|
|
3750
3815
|
$s(this._activePointers, lt), i.copy(lt), this._dragNeedsUpdate = !1, (this._activePointers.length === 0 || this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer) && (this._isDragging = !1), this._activePointers.length === 0 && this._domElement && (this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mouseup", d), this.dispatchEvent({ type: "controlend" }));
|
|
3751
3816
|
};
|
|
@@ -3771,7 +3836,7 @@ class ot extends Or {
|
|
|
3771
3836
|
}, this._removeAllEventListeners = () => {
|
|
3772
3837
|
this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", n), this._domElement.removeEventListener("mousedown", r), this._domElement.removeEventListener("pointercancel", E), this._domElement.removeEventListener("wheel", u, { passive: !1 }), this._domElement.removeEventListener("contextmenu", p), this._domElement.ownerDocument.removeEventListener("pointermove", a, { passive: !1 }), this._domElement.ownerDocument.removeEventListener("mousemove", c), this._domElement.ownerDocument.removeEventListener("pointerup", E), this._domElement.ownerDocument.removeEventListener("mouseup", d), this._domElement.ownerDocument.removeEventListener("pointerlockchange", R), this._domElement.ownerDocument.removeEventListener("pointerlockerror", F));
|
|
3773
3838
|
}, this.cancel = () => {
|
|
3774
|
-
this._state !==
|
|
3839
|
+
this._state !== L.NONE && (this._state = L.NONE, this._activePointers.length = 0, C());
|
|
3775
3840
|
}, t && this.connect(t), this.update(0);
|
|
3776
3841
|
}
|
|
3777
3842
|
/**
|
|
@@ -4027,7 +4092,7 @@ class ot extends Or {
|
|
|
4027
4092
|
* @category Methods
|
|
4028
4093
|
*/
|
|
4029
4094
|
dollyInFixed(e, t = !1) {
|
|
4030
|
-
this._targetEnd.add(this._getCameraDirection(
|
|
4095
|
+
this._targetEnd.add(this._getCameraDirection(Pe).multiplyScalar(e)), t || this._target.copy(this._targetEnd);
|
|
4031
4096
|
const s = !t || k(this._target.x, this._targetEnd.x, this.restThreshold) && k(this._target.y, this._targetEnd.y, this.restThreshold) && k(this._target.z, this._targetEnd.z, this.restThreshold);
|
|
4032
4097
|
return this._createOnRestPromise(s);
|
|
4033
4098
|
}
|
|
@@ -4455,7 +4520,7 @@ class ot extends Or {
|
|
|
4455
4520
|
}
|
|
4456
4521
|
if (this.dollyToCursor) {
|
|
4457
4522
|
if (Zt(this._camera) && this._changedDolly !== 0) {
|
|
4458
|
-
const d = this._spherical.radius - this._lastDistance, h = this._camera, u = this._getCameraDirection(
|
|
4523
|
+
const d = this._spherical.radius - this._lastDistance, h = this._camera, u = this._getCameraDirection(Pe), p = G.copy(u).cross(h.up).normalize();
|
|
4459
4524
|
p.lengthSq() === 0 && (p.x = 1);
|
|
4460
4525
|
const A = z.crossVectors(p, u), m = this._sphericalEnd.radius * Math.tan(h.getEffectiveFOV() * Se * 0.5), R = (this._sphericalEnd.radius - d - this._sphericalEnd.radius) / this._sphericalEnd.radius, F = Ee.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x * m * h.aspect)).add(A.multiplyScalar(this._dollyControlCoord.y * m)), f = G.copy(this._targetEnd).lerp(F, R), T = this._lastDollyDirection === le.IN && this._spherical.radius <= this.minDistance, O = this._lastDollyDirection === le.OUT && this.maxDistance <= this._spherical.radius;
|
|
4461
4526
|
if (this.infinityDolly && (T || O)) {
|
|
@@ -4467,7 +4532,7 @@ class ot extends Or {
|
|
|
4467
4532
|
const _ = z.subVectors(f, this._targetEnd);
|
|
4468
4533
|
this._targetEnd.copy(f), this._target.add(_), this._changedDolly -= d, X(this._changedDolly) && (this._changedDolly = 0);
|
|
4469
4534
|
} else if (bt(this._camera) && this._changedZoom !== 0) {
|
|
4470
|
-
const d = this._zoom - this._lastZoom, h = this._camera, u = G.set(this._dollyControlCoord.x, this._dollyControlCoord.y, (h.near + h.far) / (h.near - h.far)).unproject(h), p = z.set(0, 0, -1).applyQuaternion(h.quaternion), A = Ee.copy(u).add(p.multiplyScalar(-u.dot(h.up))), C = -(this._zoom - d - this._zoom) / this._zoom, R = this._getCameraDirection(
|
|
4535
|
+
const d = this._zoom - this._lastZoom, h = this._camera, u = G.set(this._dollyControlCoord.x, this._dollyControlCoord.y, (h.near + h.far) / (h.near - h.far)).unproject(h), p = z.set(0, 0, -1).applyQuaternion(h.quaternion), A = Ee.copy(u).add(p.multiplyScalar(-u.dot(h.up))), C = -(this._zoom - d - this._zoom) / this._zoom, R = this._getCameraDirection(Pe), F = this._targetEnd.dot(R), f = G.copy(this._targetEnd).lerp(A, C), T = f.dot(R), O = R.multiplyScalar(T - F);
|
|
4471
4536
|
f.sub(O), this._boundary.clampPoint(f, f);
|
|
4472
4537
|
const _ = z.subVectors(f, this._targetEnd);
|
|
4473
4538
|
this._targetEnd.copy(f), this._target.add(_), this._changedZoom -= d, X(this._changedZoom) && (this._changedZoom = 0);
|
|
@@ -4518,7 +4583,7 @@ class ot extends Or {
|
|
|
4518
4583
|
*/
|
|
4519
4584
|
fromJSON(e, t = !1) {
|
|
4520
4585
|
const s = JSON.parse(e);
|
|
4521
|
-
this.enabled = s.enabled, this.minDistance = s.minDistance, this.maxDistance =
|
|
4586
|
+
this.enabled = s.enabled, this.minDistance = s.minDistance, this.maxDistance = Le(s.maxDistance), this.minZoom = s.minZoom, this.maxZoom = Le(s.maxZoom), this.minPolarAngle = s.minPolarAngle, this.maxPolarAngle = Le(s.maxPolarAngle), this.minAzimuthAngle = Le(s.minAzimuthAngle), this.maxAzimuthAngle = Le(s.maxAzimuthAngle), this.smoothTime = s.smoothTime, this.draggingSmoothTime = s.draggingSmoothTime, this.dollySpeed = s.dollySpeed, this.truckSpeed = s.truckSpeed, this.dollyToCursor = s.dollyToCursor, this.verticalDragToForward = s.verticalDragToForward, this._target0.fromArray(s.target0), this._position0.fromArray(s.position0), this._zoom0 = s.zoom0, this._focalOffset0.fromArray(s.focalOffset0), this.moveTo(s.target[0], s.target[1], s.target[2], t), dt.setFromVector3(G.fromArray(s.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)), this.rotateTo(dt.theta, dt.phi, t), this.dollyTo(dt.radius, t), this.zoomTo(s.zoom, t), this.setFocalOffset(s.focalOffset[0], s.focalOffset[1], s.focalOffset[2], t), this._needsUpdate = !0;
|
|
4522
4587
|
}
|
|
4523
4588
|
/**
|
|
4524
4589
|
* Attach all internal event handlers to enable drag control.
|
|
@@ -4591,7 +4656,7 @@ class ot extends Or {
|
|
|
4591
4656
|
let e = 1 / 0;
|
|
4592
4657
|
if (!(this.colliderMeshes.length >= 1) || Js(this._camera, "_collisionTest"))
|
|
4593
4658
|
return e;
|
|
4594
|
-
const s = this._getTargetDirection(
|
|
4659
|
+
const s = this._getTargetDirection(Pe);
|
|
4595
4660
|
ii.lookAt(an, s, this._camera.up);
|
|
4596
4661
|
for (let i = 0; i < 4; i++) {
|
|
4597
4662
|
const o = z.copy(this._nearPlaneCorners[i]);
|
|
@@ -5093,12 +5158,12 @@ const _s = class _s extends et {
|
|
|
5093
5158
|
*/
|
|
5094
5159
|
I(_s, "uuid", "d1e814d5-b81c-4452-87a2-f039375e0489");
|
|
5095
5160
|
let dn = _s;
|
|
5096
|
-
const jt = new jn(), nt = new M(), xt = new M(), j = new
|
|
5161
|
+
const jt = new jn(), nt = new M(), xt = new M(), j = new Lt(), un = {
|
|
5097
5162
|
X: new M(1, 0, 0),
|
|
5098
5163
|
Y: new M(0, 1, 0),
|
|
5099
5164
|
Z: new M(0, 0, 1)
|
|
5100
5165
|
}, ni = { type: "change" }, In = { type: "mouseDown" }, fn = { type: "mouseUp", mode: null }, pn = { type: "objectChange" };
|
|
5101
|
-
class
|
|
5166
|
+
class Lr extends ri {
|
|
5102
5167
|
constructor(e, t) {
|
|
5103
5168
|
super(), t === void 0 && (console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'), t = document), this.isTransformControls = !0, this.visible = !1, this.domElement = t, this.domElement.style.touchAction = "none";
|
|
5104
5169
|
const s = new Ur();
|
|
@@ -5118,8 +5183,8 @@ class Pr extends ri {
|
|
|
5118
5183
|
}), o[R] = F, i[R] = F, s[R] = F;
|
|
5119
5184
|
}
|
|
5120
5185
|
n("camera", e), n("object", void 0), n("enabled", !0), n("axis", null), n("mode", "translate"), n("translationSnap", null), n("rotationSnap", null), n("scaleSnap", null), n("space", "world"), n("size", 1), n("dragging", !1), n("showX", !0), n("showY", !0), n("showZ", !0);
|
|
5121
|
-
const r = new M(), a = new M(), c = new
|
|
5122
|
-
n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion", c), n("worldQuaternionStart", E), n("cameraPosition", d), n("cameraQuaternion", h), n("pointStart", u), n("pointEnd", p), n("rotationAxis", A), n("rotationAngle", m), n("eye", C), this._offset = new M(), this._startNorm = new M(), this._endNorm = new M(), this._cameraScale = new M(), this._parentPosition = new M(), this._parentQuaternion = new
|
|
5186
|
+
const r = new M(), a = new M(), c = new Lt(), E = new Lt(), d = new M(), h = new Lt(), u = new M(), p = new M(), A = new M(), m = 0, C = new M();
|
|
5187
|
+
n("worldPosition", r), n("worldPositionStart", a), n("worldQuaternion", c), n("worldQuaternionStart", E), n("cameraPosition", d), n("cameraQuaternion", h), n("pointStart", u), n("pointEnd", p), n("rotationAxis", A), n("rotationAngle", m), n("eye", C), this._offset = new M(), this._startNorm = new M(), this._endNorm = new M(), this._cameraScale = new M(), this._parentPosition = new M(), this._parentQuaternion = new Lt(), this._parentQuaternionInv = new Lt(), this._parentScale = new M(), this._worldScaleStart = new M(), this._worldQuaternionInv = new Lt(), this._worldScale = new M(), this._positionStart = new M(), this._quaternionStart = new Lt(), this._scaleStart = new M(), this._getPointer = Pr.bind(this), this._onPointerDown = Mr.bind(this), this._onPointerHover = yr.bind(this), this._onPointerMove = wr.bind(this), this._onPointerUp = Dr.bind(this), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp);
|
|
5123
5188
|
}
|
|
5124
5189
|
// updateMatrixWorld updates key transformation variables
|
|
5125
5190
|
updateMatrixWorld() {
|
|
@@ -5210,7 +5275,7 @@ class Pr extends ri {
|
|
|
5210
5275
|
this.space = e;
|
|
5211
5276
|
}
|
|
5212
5277
|
}
|
|
5213
|
-
function
|
|
5278
|
+
function Pr(l) {
|
|
5214
5279
|
if (this.domElement.ownerDocument.pointerLockElement)
|
|
5215
5280
|
return {
|
|
5216
5281
|
x: 0,
|
|
@@ -5251,7 +5316,7 @@ function oi(l, e, t) {
|
|
|
5251
5316
|
return s[i];
|
|
5252
5317
|
return !1;
|
|
5253
5318
|
}
|
|
5254
|
-
const Is = new qn(), W = new M(0, 1, 0), Cn = new M(0, 0, 0), Tn = new yt(), fs = new
|
|
5319
|
+
const Is = new qn(), W = new M(0, 1, 0), Cn = new M(0, 0, 0), Tn = new yt(), fs = new Lt(), Rs = new Lt(), St = new M(), mn = new yt(), De = new M(1, 0, 0), qt = new M(0, 1, 0), Ue = new M(0, 0, 1), ps = new M(), Me = new M(), we = new M();
|
|
5255
5320
|
class Ur extends ri {
|
|
5256
5321
|
constructor() {
|
|
5257
5322
|
super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
|
|
@@ -5397,7 +5462,7 @@ class Ur extends ri {
|
|
|
5397
5462
|
AXIS: [
|
|
5398
5463
|
[new Dt(C, i.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
|
|
5399
5464
|
]
|
|
5400
|
-
},
|
|
5465
|
+
}, P = {
|
|
5401
5466
|
XYZE: [
|
|
5402
5467
|
[new v(new $n(0.25, 10, 8), s)]
|
|
5403
5468
|
],
|
|
@@ -5488,7 +5553,7 @@ class Ur extends ri {
|
|
|
5488
5553
|
}
|
|
5489
5554
|
return H;
|
|
5490
5555
|
}
|
|
5491
|
-
this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = x(T)), this.add(this.gizmo.rotate = x(S)), this.add(this.gizmo.scale = x(w)), this.add(this.picker.translate = x(O)), this.add(this.picker.rotate = x(
|
|
5556
|
+
this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = x(T)), this.add(this.gizmo.rotate = x(S)), this.add(this.gizmo.scale = x(w)), this.add(this.picker.translate = x(O)), this.add(this.picker.rotate = x(P)), this.add(this.picker.scale = x(y)), this.add(this.helper.translate = x(_)), this.add(this.helper.rotate = x(N)), this.add(this.helper.scale = x(U)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
|
|
5492
5557
|
}
|
|
5493
5558
|
// updateMatrixWorld will update transformations and appearance of individual handles
|
|
5494
5559
|
updateMatrixWorld(e) {
|
|
@@ -5515,7 +5580,7 @@ class xr extends v {
|
|
|
5515
5580
|
constructor() {
|
|
5516
5581
|
super(
|
|
5517
5582
|
new Jn(1e5, 1e5, 2, 2),
|
|
5518
|
-
new yn({ visible: !1, wireframe: !0, side:
|
|
5583
|
+
new yn({ visible: !1, wireframe: !0, side: Pn, transparent: !0, opacity: 0.1, toneMapped: !1 })
|
|
5519
5584
|
), this.isTransformControlsPlane = !0, this.type = "TransformControlsPlane";
|
|
5520
5585
|
}
|
|
5521
5586
|
updateMatrixWorld(e) {
|
|
@@ -5555,7 +5620,7 @@ class xr extends v {
|
|
|
5555
5620
|
St.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (mn.lookAt(nt.set(0, 0, 0), St, W), this.quaternion.setFromRotationMatrix(mn)), super.updateMatrixWorld(e);
|
|
5556
5621
|
}
|
|
5557
5622
|
}
|
|
5558
|
-
class
|
|
5623
|
+
class Li {
|
|
5559
5624
|
constructor(e, t, s, i, o, n = 5, r = !0) {
|
|
5560
5625
|
/** Event that fires when the user starts dragging a clipping plane. */
|
|
5561
5626
|
I(this, "onDraggingStarted", new D());
|
|
@@ -5601,7 +5666,7 @@ class Pi {
|
|
|
5601
5666
|
});
|
|
5602
5667
|
if (this.components = e, this.world = t, !t.renderer)
|
|
5603
5668
|
throw new Error("The given world must have a renderer!");
|
|
5604
|
-
this.normal = i, this.origin = s, t.renderer.setPlane(!0, this.three), this._planeMesh =
|
|
5669
|
+
this.normal = i, this.origin = s, t.renderer.setPlane(!0, this.three), this._planeMesh = Li.newPlaneMesh(n, o), this._helper = this.newHelper(), this._controls = this.newTransformControls(), this.three.setFromNormalAndCoplanarPoint(i, s), r && this.toggleControls(!0);
|
|
5605
5670
|
}
|
|
5606
5671
|
/**
|
|
5607
5672
|
* Getter for the enabled state of the clipping plane.
|
|
@@ -5691,7 +5756,7 @@ class Pi {
|
|
|
5691
5756
|
newTransformControls() {
|
|
5692
5757
|
if (!this.world.renderer)
|
|
5693
5758
|
throw new Error("No renderer found for clipping plane!");
|
|
5694
|
-
const e = this.world.camera.three, t = this.world.renderer.three.domElement, s = new
|
|
5759
|
+
const e = this.world.camera.three, t = this.world.renderer.three.domElement, s = new Lr(e, t);
|
|
5695
5760
|
return this.initializeControls(s), this.world.scene.three.add(s), s;
|
|
5696
5761
|
}
|
|
5697
5762
|
initializeControls(e) {
|
|
@@ -5767,7 +5832,7 @@ const ve = class ve extends et {
|
|
|
5767
5832
|
* The type of clipping plane to be created.
|
|
5768
5833
|
* Default is {@link SimplePlane}.
|
|
5769
5834
|
*/
|
|
5770
|
-
I(this, "Type",
|
|
5835
|
+
I(this, "Type", Li);
|
|
5771
5836
|
/**
|
|
5772
5837
|
* A list of all the clipping planes created by this component.
|
|
5773
5838
|
*/
|
|
@@ -5840,8 +5905,6 @@ const ve = class ve extends et {
|
|
|
5840
5905
|
}
|
|
5841
5906
|
/** {@link Createable.create} */
|
|
5842
5907
|
create(t) {
|
|
5843
|
-
if (!this.enabled)
|
|
5844
|
-
return;
|
|
5845
5908
|
const o = this.components.get(ze).get(t).castRay();
|
|
5846
5909
|
o && this.createPlaneFromIntersection(t, o);
|
|
5847
5910
|
}
|
|
@@ -5866,7 +5929,7 @@ const ve = class ve extends et {
|
|
|
5866
5929
|
* found under the cursor will be deleted.
|
|
5867
5930
|
*/
|
|
5868
5931
|
delete(t, s) {
|
|
5869
|
-
|
|
5932
|
+
s || (s = this.pickPlane(t)), s && this.deletePlane(s);
|
|
5870
5933
|
}
|
|
5871
5934
|
/** Deletes all the existing clipping planes. */
|
|
5872
5935
|
deleteAll() {
|
|
@@ -7186,7 +7249,7 @@ const vn = /* @__PURE__ */ new Set([
|
|
|
7186
7249
|
*/
|
|
7187
7250
|
I(Ns, "uuid", "b32c4332-cd67-436e-ba7f-196646c7a635");
|
|
7188
7251
|
let mi = Ns;
|
|
7189
|
-
const
|
|
7252
|
+
const Ls = class Ls extends et {
|
|
7190
7253
|
constructor(t) {
|
|
7191
7254
|
super(t);
|
|
7192
7255
|
/** {@link Disposable.onDisposed} */
|
|
@@ -7213,7 +7276,7 @@ const Ps = class Ps extends et {
|
|
|
7213
7276
|
/** {@link Component.enabled} */
|
|
7214
7277
|
I(this, "enabled", !0);
|
|
7215
7278
|
I(this, "_loader", new to());
|
|
7216
|
-
this.components.add(
|
|
7279
|
+
this.components.add(Ls.uuid, this);
|
|
7217
7280
|
}
|
|
7218
7281
|
/**
|
|
7219
7282
|
* Getter for the meshes of all fragments in the FragmentsManager.
|
|
@@ -7344,8 +7407,8 @@ const Ps = class Ps extends et {
|
|
|
7344
7407
|
* A unique identifier for the component.
|
|
7345
7408
|
* This UUID is used to register the component within the Components system.
|
|
7346
7409
|
*/
|
|
7347
|
-
I(
|
|
7348
|
-
let ut =
|
|
7410
|
+
I(Ls, "uuid", "fef46874-46a3-461b-8c44-2922ab77c806");
|
|
7411
|
+
let ut = Ls;
|
|
7349
7412
|
const Xr = /* @__PURE__ */ new Map([
|
|
7350
7413
|
[
|
|
7351
7414
|
b.IFCRELAGGREGATES,
|
|
@@ -9220,7 +9283,7 @@ class Yn {
|
|
|
9220
9283
|
this.itemsByFloor = {};
|
|
9221
9284
|
}
|
|
9222
9285
|
}
|
|
9223
|
-
class
|
|
9286
|
+
class Pi {
|
|
9224
9287
|
constructor() {
|
|
9225
9288
|
/** Whether to extract the IFC properties into a JSON. */
|
|
9226
9289
|
I(this, "includeProperties", !0);
|
|
@@ -9367,7 +9430,7 @@ const Ve = class Ve extends et {
|
|
|
9367
9430
|
* The settings for the IfcLoader.
|
|
9368
9431
|
* It includes options for excluding categories, setting WASM paths, and more.
|
|
9369
9432
|
*/
|
|
9370
|
-
I(this, "settings", new
|
|
9433
|
+
I(this, "settings", new Pi());
|
|
9371
9434
|
/**
|
|
9372
9435
|
* The instance of the Web-IFC library used for handling IFC data.
|
|
9373
9436
|
*/
|
|
@@ -9942,7 +10005,7 @@ const Bt = class Bt extends et {
|
|
|
9942
10005
|
*/
|
|
9943
10006
|
I(Bt, "uuid", "58c2d9f0-183c-48d6-a402-dfcf5b9a34df");
|
|
9944
10007
|
let On = Bt;
|
|
9945
|
-
const
|
|
10008
|
+
const Ps = class Ps extends et {
|
|
9946
10009
|
constructor(t) {
|
|
9947
10010
|
super(t);
|
|
9948
10011
|
/** {@link Component.enabled} */
|
|
@@ -9969,7 +10032,7 @@ const Ls = class Ls extends et {
|
|
|
9969
10032
|
}
|
|
9970
10033
|
}
|
|
9971
10034
|
});
|
|
9972
|
-
t.add(
|
|
10035
|
+
t.add(Ps.uuid, this), t.get(ut).onFragmentsDisposed.add(this.onFragmentsDisposed);
|
|
9973
10036
|
}
|
|
9974
10037
|
/** {@link Disposable.dispose} */
|
|
9975
10038
|
dispose() {
|
|
@@ -10260,8 +10323,8 @@ const Ls = class Ls extends et {
|
|
|
10260
10323
|
* A unique identifier for the component.
|
|
10261
10324
|
* This UUID is used to register the component within the Components system.
|
|
10262
10325
|
*/
|
|
10263
|
-
I(
|
|
10264
|
-
let Ai =
|
|
10326
|
+
I(Ps, "uuid", "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");
|
|
10327
|
+
let Ai = Ps;
|
|
10265
10328
|
const ys = class ys extends et {
|
|
10266
10329
|
constructor(t) {
|
|
10267
10330
|
super(t);
|
|
@@ -10280,7 +10343,7 @@ const ys = class ys extends et {
|
|
|
10280
10343
|
* This property specifies the group of fragments that will be affected by the explosion.
|
|
10281
10344
|
* Default value is "storeys".
|
|
10282
10345
|
*/
|
|
10283
|
-
I(this, "groupName", "
|
|
10346
|
+
I(this, "groupName", "spatialStructures");
|
|
10284
10347
|
/**
|
|
10285
10348
|
* A set of strings representing the exploded items.
|
|
10286
10349
|
* This set is used to keep track of which items have been exploded.
|
|
@@ -10390,7 +10453,7 @@ const Ms = class Ms extends et {
|
|
|
10390
10453
|
*/
|
|
10391
10454
|
I(Ms, "uuid", "dd9ccf2d-8a21-4821-b7f6-2949add16a29");
|
|
10392
10455
|
let _n = Ms;
|
|
10393
|
-
class jr extends
|
|
10456
|
+
class jr extends Pi {
|
|
10394
10457
|
constructor() {
|
|
10395
10458
|
super(...arguments);
|
|
10396
10459
|
/**
|
|
@@ -10612,7 +10675,7 @@ const ws = class ws extends et {
|
|
|
10612
10675
|
*/
|
|
10613
10676
|
I(ws, "uuid", "d9999a00-e1f5-4d3f-8cfe-c56e08609764");
|
|
10614
10677
|
let Sn = ws;
|
|
10615
|
-
class qr extends
|
|
10678
|
+
class qr extends Pi {
|
|
10616
10679
|
constructor() {
|
|
10617
10680
|
super(...arguments);
|
|
10618
10681
|
/**
|
|
@@ -10823,9 +10886,9 @@ const Ds = class Ds extends et {
|
|
|
10823
10886
|
O.add(T);
|
|
10824
10887
|
}
|
|
10825
10888
|
for (const T of C) {
|
|
10826
|
-
const O = d.get(T), { edges: _, indices: S } = O, N = d.get(m), { edges:
|
|
10889
|
+
const O = d.get(T), { edges: _, indices: S } = O, N = d.get(m), { edges: P, indices: w } = N;
|
|
10827
10890
|
for (const y of _)
|
|
10828
|
-
|
|
10891
|
+
P.add(y), E.set(y, m);
|
|
10829
10892
|
for (const y of S)
|
|
10830
10893
|
w.add(y);
|
|
10831
10894
|
d.delete(T);
|
|
@@ -10938,7 +11001,7 @@ export {
|
|
|
10938
11001
|
oa as IfcCategories,
|
|
10939
11002
|
Bn as IfcCategoryMap,
|
|
10940
11003
|
Zr as IfcElements,
|
|
10941
|
-
|
|
11004
|
+
Pi as IfcFragmentSettings,
|
|
10942
11005
|
Sn as IfcGeometryTiler,
|
|
10943
11006
|
mi as IfcJsonExporter,
|
|
10944
11007
|
Ri as IfcLoader,
|
|
@@ -10961,7 +11024,7 @@ export {
|
|
|
10961
11024
|
ze as Raycasters,
|
|
10962
11025
|
He as SimpleCamera,
|
|
10963
11026
|
Nr as SimpleGrid,
|
|
10964
|
-
|
|
11027
|
+
Li as SimplePlane,
|
|
10965
11028
|
Ar as SimpleRaycaster,
|
|
10966
11029
|
ia as SimpleRenderer,
|
|
10967
11030
|
sa as SimpleScene,
|