@sienci/gviewer 0.1.16 → 0.1.17
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/README.md +25 -0
- package/dist/{GCodeSVGRenderer-AJzTt7mi.js → GCodeSVGRenderer-Onjhdwbv.js} +233 -195
- package/dist/{GCodeSVGRenderer-BOliBeEd.cjs → GCodeSVGRenderer-_n8GbXrI.cjs} +3 -3
- package/dist/react.cjs +1 -1
- package/dist/react.js +67 -61
- package/dist/types/viewer/GCodeViewer.d.ts +32 -0
- package/dist/types/viewer/types.d.ts +8 -0
- package/dist/viewer.cjs +1 -1
- package/dist/viewer.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as a from "three";
|
|
2
2
|
import { OrbitControls as oP } from "three/examples/jsm/controls/OrbitControls.js";
|
|
3
3
|
import { GCodeVirtualizer as AA, buildWorkerToolpathStreams as TP, buildToolpathGeometryFromLinesBatched as zP, buildMovementVerticesFromLines as wP, buildWorkerSegmentGroups as EP } from "./gviewer.js";
|
|
4
4
|
import { STLLoader as aP } from "three/examples/jsm/loaders/STLLoader.js";
|
|
@@ -10,15 +10,15 @@ function hP(r) {
|
|
|
10
10
|
continue;
|
|
11
11
|
const t = A.positions.length / 3, P = A.colors ? A.colors.slice() : ot(A.kind, t, r.options), e = new Float32Array(P.length);
|
|
12
12
|
e.set(P);
|
|
13
|
-
const i = new
|
|
14
|
-
i.setAttribute("position", new
|
|
15
|
-
const s = new
|
|
16
|
-
s.setUsage(
|
|
17
|
-
const v = new
|
|
13
|
+
const i = new a.BufferGeometry();
|
|
14
|
+
i.setAttribute("position", new a.BufferAttribute(A.positions, 3));
|
|
15
|
+
const s = new a.BufferAttribute(e, 3);
|
|
16
|
+
s.setUsage(a.DynamicDrawUsage), i.setAttribute("color", s), i.computeBoundingBox();
|
|
17
|
+
const v = new a.LineBasicMaterial({
|
|
18
18
|
vertexColors: !0,
|
|
19
19
|
transparent: !0,
|
|
20
20
|
opacity: A.opacity
|
|
21
|
-
}), c = new
|
|
21
|
+
}), c = new a.LineSegments(i, v);
|
|
22
22
|
r.scene.add(c), Q.push({
|
|
23
23
|
line: c,
|
|
24
24
|
baseColors: P,
|
|
@@ -78,7 +78,7 @@ function DP(r) {
|
|
|
78
78
|
t.clearUpdateRanges(), t.addUpdateRange(e * 3, (i - e) * 3), t.needsUpdate = !0, r.stream.greyCursorVertex = B;
|
|
79
79
|
}
|
|
80
80
|
function ot(r, Q, B) {
|
|
81
|
-
const A = B.render.theme.colors, t = B.mode.laser ? A.laser ?? A.cutting : A.cutting, P = new
|
|
81
|
+
const A = B.render.theme.colors, t = B.mode.laser ? A.laser ?? A.cutting : A.cutting, P = new a.Color(r === "rapid" ? A.rapid : t), e = new Float32Array(Q * 3);
|
|
82
82
|
for (let i = 0; i < Q; i += 1) {
|
|
83
83
|
const s = i * 3;
|
|
84
84
|
e[s] = P.r, e[s + 1] = P.g, e[s + 2] = P.b;
|
|
@@ -86,7 +86,7 @@ function ot(r, Q, B) {
|
|
|
86
86
|
return e;
|
|
87
87
|
}
|
|
88
88
|
function uP(r) {
|
|
89
|
-
const Q = r.render.theme.colors, B = new
|
|
89
|
+
const Q = r.render.theme.colors, B = new a.Color(r.render.theme.background), A = new a.Color(Q.processed ?? Q.cutting), t = B.clone().lerp(A, 0.65);
|
|
90
90
|
return { r: t.r, g: t.g, b: t.b };
|
|
91
91
|
}
|
|
92
92
|
function CP(r) {
|
|
@@ -169,9 +169,9 @@ async function OP(r, Q, B, A) {
|
|
|
169
169
|
E.processLine(d);
|
|
170
170
|
isFinite(c) || (c = -1, n = 1, T = -1, z = 1, w = 0, o = 0), c === n && (c -= Q * 2, n += Q * 2), T === z && (T -= Q * 2, z += Q * 2), c -= Q, n += Q, T -= Q, z += Q;
|
|
171
171
|
const k = o;
|
|
172
|
-
let
|
|
173
|
-
|
|
174
|
-
const U = { xMin: c, xMax: n, yMin: T, yMax: z, zTop: k, zBot:
|
|
172
|
+
let h = w - Q;
|
|
173
|
+
h >= k && (h = k - 1);
|
|
174
|
+
const U = { xMin: c, xMax: n, yMin: T, yMax: z, zTop: k, zBot: h }, D = new Float32Array(t * t).fill(k), l = /* @__PURE__ */ new Map();
|
|
175
175
|
l.set(0, new Float32Array(D));
|
|
176
176
|
const O = [];
|
|
177
177
|
let u = 0, N = 0;
|
|
@@ -206,9 +206,9 @@ async function OP(r, Q, B, A) {
|
|
|
206
206
|
function PA(r, Q, B, A, t) {
|
|
207
207
|
const P = (B.xMax - B.xMin) / t, e = (B.yMax - B.yMin) / t, i = Math.hypot(r.x1 - r.x0, r.y1 - r.y0), s = Math.max(1e-3, Math.min(P, e) * 0.5), v = Math.max(1, Math.ceil(i / s)), c = Math.ceil(A / P), n = Math.ceil(A / e), T = A * A;
|
|
208
208
|
for (let z = 0; z <= v; z++) {
|
|
209
|
-
const w = z / v, o = r.x0 + (r.x1 - r.x0) * w, E = r.y0 + (r.y1 - r.y0) * w, k = r.z0 + (r.z1 - r.z0) * w,
|
|
209
|
+
const w = z / v, o = r.x0 + (r.x1 - r.x0) * w, E = r.y0 + (r.y1 - r.y0) * w, k = r.z0 + (r.z1 - r.z0) * w, h = Math.floor((o - B.xMin) / P), U = Math.floor((E - B.yMin) / e);
|
|
210
210
|
for (let D = -c; D <= c; D++) {
|
|
211
|
-
const l =
|
|
211
|
+
const l = h + D;
|
|
212
212
|
if (l < 0 || l >= t) continue;
|
|
213
213
|
const O = B.xMin + (l + 0.5) * P, u = (O - o) * (O - o);
|
|
214
214
|
if (!(u > T))
|
|
@@ -266,7 +266,7 @@ function dP(r, Q, B, A, t, P) {
|
|
|
266
266
|
const w = [];
|
|
267
267
|
let o = { ...r };
|
|
268
268
|
for (let E = 1; E <= e; E++) {
|
|
269
|
-
const k = E / e,
|
|
269
|
+
const k = E / e, h = n + z * k, U = k, D = B[i] + c * Math.cos(h), l = B[s] + c * Math.sin(h), O = r[v] + (Q[v] - r[v]) * U, u = { X: 0, Y: 0, Z: 0 };
|
|
270
270
|
u[i] = D, u[s] = l, u[v] = O, w.push({
|
|
271
271
|
x0: o.X,
|
|
272
272
|
y0: o.Y,
|
|
@@ -299,52 +299,52 @@ function LP() {
|
|
|
299
299
|
e + i * 0.15
|
|
300
300
|
), B.stroke();
|
|
301
301
|
}
|
|
302
|
-
return uB = new
|
|
302
|
+
return uB = new a.CanvasTexture(Q), uB;
|
|
303
303
|
}
|
|
304
304
|
function MP(r, Q) {
|
|
305
|
-
const B = new
|
|
305
|
+
const B = new a.Group();
|
|
306
306
|
B.name = "gviewer:sim3d-slab";
|
|
307
307
|
const A = r.xMax - r.xMin, t = r.yMax - r.yMin, P = r.zTop - r.zBot, e = (r.xMin + r.xMax) / 2, i = (r.yMin + r.yMax) / 2, s = (r.zBot + r.zTop) / 2, v = LP();
|
|
308
|
-
v.wrapS =
|
|
309
|
-
const c = new
|
|
308
|
+
v.wrapS = a.RepeatWrapping, v.wrapT = a.RepeatWrapping, v.repeat.set(A / 100, t / 100);
|
|
309
|
+
const c = new a.MeshStandardMaterial({
|
|
310
310
|
map: v,
|
|
311
311
|
roughness: 0.85,
|
|
312
312
|
metalness: 0,
|
|
313
|
-
side:
|
|
314
|
-
}), n = new
|
|
313
|
+
side: a.FrontSide
|
|
314
|
+
}), n = new a.MeshStandardMaterial({
|
|
315
315
|
color: 8016432,
|
|
316
316
|
roughness: 0.9,
|
|
317
317
|
metalness: 0,
|
|
318
|
-
side:
|
|
319
|
-
}), T = new
|
|
318
|
+
side: a.DoubleSide
|
|
319
|
+
}), T = new a.MeshStandardMaterial({
|
|
320
320
|
color: 7030822,
|
|
321
321
|
roughness: 0.9,
|
|
322
322
|
metalness: 0
|
|
323
|
-
}), z = new
|
|
323
|
+
}), z = new a.PlaneGeometry(A, t, Q - 1, Q - 1), w = Q * Q, o = new Float32Array(w * 3), E = z.attributes.position;
|
|
324
324
|
for (let j = 0; j < w; j++)
|
|
325
325
|
o[j * 3] = E.getX(j), o[j * 3 + 1] = E.getY(j), o[j * 3 + 2] = 0;
|
|
326
|
-
const k = new
|
|
327
|
-
k.usage =
|
|
328
|
-
const
|
|
329
|
-
|
|
330
|
-
const U = new
|
|
326
|
+
const k = new a.BufferAttribute(o, 3);
|
|
327
|
+
k.usage = a.DynamicDrawUsage, z.setAttribute("position", k), z.computeVertexNormals();
|
|
328
|
+
const h = new a.Mesh(z, c);
|
|
329
|
+
h.name = "gviewer:sim3d-top", h.position.set(e, i, r.zTop), B.add(h);
|
|
330
|
+
const U = new a.PlaneGeometry(A, P);
|
|
331
331
|
U.rotateX(Math.PI / 2);
|
|
332
|
-
const D = new
|
|
332
|
+
const D = new a.Mesh(U, n);
|
|
333
333
|
D.position.set(e, r.yMax, s), B.add(D);
|
|
334
|
-
const l = new
|
|
334
|
+
const l = new a.PlaneGeometry(A, P);
|
|
335
335
|
l.rotateX(Math.PI / 2);
|
|
336
|
-
const O = new
|
|
336
|
+
const O = new a.Mesh(l, n);
|
|
337
337
|
O.position.set(e, r.yMin, s), B.add(O);
|
|
338
|
-
const u = new
|
|
338
|
+
const u = new a.PlaneGeometry(P, t);
|
|
339
339
|
u.rotateY(-Math.PI / 2);
|
|
340
|
-
const N = new
|
|
340
|
+
const N = new a.Mesh(u, n);
|
|
341
341
|
N.position.set(r.xMax, i, s), B.add(N);
|
|
342
|
-
const C = new
|
|
342
|
+
const C = new a.PlaneGeometry(P, t);
|
|
343
343
|
C.rotateY(-Math.PI / 2);
|
|
344
|
-
const M = new
|
|
344
|
+
const M = new a.Mesh(C, n);
|
|
345
345
|
M.position.set(r.xMin, i, s), B.add(M);
|
|
346
|
-
const b = new
|
|
347
|
-
return b.position.set(e, i, r.zBot), B.add(b), { group: B, topMesh:
|
|
346
|
+
const b = new a.Mesh(new a.PlaneGeometry(A, t), T);
|
|
347
|
+
return b.position.set(e, i, r.zBot), B.add(b), { group: B, topMesh: h, topPositionAttr: k, slabBounds: r, resolution: Q };
|
|
348
348
|
}
|
|
349
349
|
function IB(r, Q) {
|
|
350
350
|
const { topPositionAttr: B, slabBounds: A, resolution: t } = r, P = t * t;
|
|
@@ -356,7 +356,7 @@ function IB(r, Q) {
|
|
|
356
356
|
}
|
|
357
357
|
function HP(r) {
|
|
358
358
|
r.group.traverse((Q) => {
|
|
359
|
-
if (Q instanceof
|
|
359
|
+
if (Q instanceof a.Mesh) {
|
|
360
360
|
Q.geometry.dispose();
|
|
361
361
|
const B = Q.material;
|
|
362
362
|
Array.isArray(B) ? B.forEach((A) => {
|
|
@@ -398,27 +398,27 @@ class jP {
|
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
400
|
function OQ(r, Q, B = {}) {
|
|
401
|
-
const { opacity: A = 1, size: t = 10 } = B, P = new
|
|
401
|
+
const { opacity: A = 1, size: t = 10 } = B, P = new a.Object3D(), e = 100, i = document.createElement("canvas"), s = i.getContext("2d");
|
|
402
402
|
if (!s)
|
|
403
403
|
throw new Error("Missing canvas 2D context.");
|
|
404
404
|
s.font = `normal ${e}px Arial`;
|
|
405
405
|
const c = s.measureText(r).width;
|
|
406
406
|
i.width = c, i.height = e, s.font = `normal ${e}px Arial`, s.textAlign = "center", s.textBaseline = "middle", s.fillStyle = Q, s.fillText(r, c / 2, e / 2);
|
|
407
|
-
const n = new
|
|
408
|
-
n.needsUpdate = !0, n.minFilter =
|
|
409
|
-
const T = new
|
|
407
|
+
const n = new a.Texture(i);
|
|
408
|
+
n.needsUpdate = !0, n.minFilter = a.LinearFilter;
|
|
409
|
+
const T = new a.SpriteMaterial({
|
|
410
410
|
map: n,
|
|
411
411
|
transparent: !0,
|
|
412
412
|
opacity: A
|
|
413
413
|
});
|
|
414
414
|
P.textHeight = t, P.textWidth = c / e * P.textHeight, B.textAlign === "left" ? P.position.x = (B.x ?? 0) + (P.textWidth ?? 0) / 2 : B.textAlign === "right" ? P.position.x = (B.x ?? 0) - (P.textWidth ?? 0) / 2 : P.position.x = B.x ?? 0, B.textBaseline === "top" ? P.position.y = (B.y ?? 0) - (P.textHeight ?? 0) / 2 : B.textBaseline === "bottom" ? P.position.y = (B.y ?? 0) + (P.textHeight ?? 0) / 2 : P.position.y = B.y ?? 0, P.position.z = B.z ?? 0;
|
|
415
|
-
const z = new
|
|
415
|
+
const z = new a.Sprite(T);
|
|
416
416
|
return z.scale.set(c / e * t, t, 1), P.add(z), P;
|
|
417
417
|
}
|
|
418
418
|
function FP(r) {
|
|
419
419
|
r.traverse((Q) => {
|
|
420
420
|
var A;
|
|
421
|
-
if (!(Q instanceof
|
|
421
|
+
if (!(Q instanceof a.Sprite))
|
|
422
422
|
return;
|
|
423
423
|
const B = Q.material;
|
|
424
424
|
(A = B.map) == null || A.dispose(), B.dispose();
|
|
@@ -426,28 +426,28 @@ function FP(r) {
|
|
|
426
426
|
}
|
|
427
427
|
const GP = 25.4;
|
|
428
428
|
function fP(r, Q) {
|
|
429
|
-
const B = new
|
|
429
|
+
const B = new a.Group(), A = new a.Box3Helper(
|
|
430
430
|
r.clone(),
|
|
431
|
-
new
|
|
431
|
+
new a.Color(Q.render.theme.colors.boundingBox)
|
|
432
432
|
), t = A.material;
|
|
433
433
|
return t.transparent = !0, t.opacity = 0.12, t.depthWrite = !1, B.add(A), Q.boundingBox.labels && B.add(...bP(r.clone(), Q)), B;
|
|
434
434
|
}
|
|
435
435
|
function bP(r, Q) {
|
|
436
|
-
const B = Q.render.theme.colors.boundingBox, A = 0.32, t = (U) => Math.abs(U) < 1e-9 ? "0" : U.toFixed(3), P = (U) => Q.units === "in" ? `${t(U / GP)} in` : `${t(U)} mm`, e = r.min, i = r.max, s = (U) => OQ(U, B, { size: 4, opacity: A }), v = s(P(e.x)), c = s(P(i.x)), n = s(P(e.y)), T = s(P(i.y)), z = s(P(e.z)), w = s(P(i.z)), o = new
|
|
436
|
+
const B = Q.render.theme.colors.boundingBox, A = 0.32, t = (U) => Math.abs(U) < 1e-9 ? "0" : U.toFixed(3), P = (U) => Q.units === "in" ? `${t(U / GP)} in` : `${t(U)} mm`, e = r.min, i = r.max, s = (U) => OQ(U, B, { size: 4, opacity: A }), v = s(P(e.x)), c = s(P(i.x)), n = s(P(e.y)), T = s(P(i.y)), z = s(P(e.z)), w = s(P(i.z)), o = new a.Vector3();
|
|
437
437
|
r.getSize(o);
|
|
438
|
-
const E = Math.max(2, Math.max(o.x, o.y, o.z) * 0.02), k = (e.x + i.x) / 2,
|
|
439
|
-
return v.position.set(e.x - E,
|
|
438
|
+
const E = Math.max(2, Math.max(o.x, o.y, o.z) * 0.02), k = (e.x + i.x) / 2, h = (e.y + i.y) / 2;
|
|
439
|
+
return v.position.set(e.x - E, h, e.z - E), c.position.set(i.x + E, h, e.z - E), n.position.set(k, e.y - E, e.z - E), T.position.set(k, i.y + E, e.z - E), z.position.set(k, h, e.z - E), w.position.set(k, h, i.z + E), [v, c, n, T, z, w];
|
|
440
440
|
}
|
|
441
441
|
function gP(r) {
|
|
442
442
|
r.traverse((Q) => {
|
|
443
443
|
var B;
|
|
444
|
-
if (Q instanceof
|
|
444
|
+
if (Q instanceof a.LineSegments || Q instanceof a.Line) {
|
|
445
445
|
Q.geometry.dispose();
|
|
446
446
|
const A = Q.material;
|
|
447
447
|
Array.isArray(A) ? A.forEach((t) => t.dispose()) : A.dispose();
|
|
448
448
|
return;
|
|
449
449
|
}
|
|
450
|
-
if (Q instanceof
|
|
450
|
+
if (Q instanceof a.Sprite) {
|
|
451
451
|
const A = Q.material;
|
|
452
452
|
(B = A.map) == null || B.dispose(), A.dispose();
|
|
453
453
|
}
|
|
@@ -464,13 +464,13 @@ function xP(r) {
|
|
|
464
464
|
return 1 - Q * Q * Q / 2;
|
|
465
465
|
}
|
|
466
466
|
function mA(r) {
|
|
467
|
-
const Q = new
|
|
468
|
-
right: new
|
|
469
|
-
left: new
|
|
470
|
-
front: new
|
|
471
|
-
back: new
|
|
472
|
-
top: new
|
|
473
|
-
bottom: new
|
|
467
|
+
const Q = new a.Vector3(), B = {
|
|
468
|
+
right: new a.Vector3(1, 0, 0),
|
|
469
|
+
left: new a.Vector3(-1, 0, 0),
|
|
470
|
+
front: new a.Vector3(0, -1, 0),
|
|
471
|
+
back: new a.Vector3(0, 1, 0),
|
|
472
|
+
top: new a.Vector3(0, 0, 1),
|
|
473
|
+
bottom: new a.Vector3(0, 0, -1)
|
|
474
474
|
};
|
|
475
475
|
switch (r) {
|
|
476
476
|
case "front":
|
|
@@ -538,23 +538,23 @@ function yP(r) {
|
|
|
538
538
|
const c = v * A;
|
|
539
539
|
i(c, -B, c, B, v === 0 ? P : e);
|
|
540
540
|
}
|
|
541
|
-
const s = new
|
|
541
|
+
const s = new a.Group();
|
|
542
542
|
return e.length > 0 && s.add(yA(e, r.theme.colors.grid.minor, 0.25)), P.length > 0 && s.add(yA(P, r.theme.colors.grid.major, 0.4)), s;
|
|
543
543
|
}
|
|
544
544
|
function yA(r, Q, B) {
|
|
545
|
-
const A = new
|
|
546
|
-
A.setAttribute("position", new
|
|
547
|
-
const t = new
|
|
548
|
-
color: new
|
|
545
|
+
const A = new a.BufferGeometry();
|
|
546
|
+
A.setAttribute("position", new a.Float32BufferAttribute(r, 3));
|
|
547
|
+
const t = new a.LineBasicMaterial({
|
|
548
|
+
color: new a.Color(Q),
|
|
549
549
|
transparent: !0,
|
|
550
550
|
opacity: B,
|
|
551
551
|
depthWrite: !1
|
|
552
552
|
});
|
|
553
|
-
return new
|
|
553
|
+
return new a.LineSegments(A, t);
|
|
554
554
|
}
|
|
555
555
|
function IP(r) {
|
|
556
556
|
r.traverse((Q) => {
|
|
557
|
-
if (!(Q instanceof
|
|
557
|
+
if (!(Q instanceof a.LineSegments))
|
|
558
558
|
return;
|
|
559
559
|
Q.geometry.dispose();
|
|
560
560
|
const B = Q.material;
|
|
@@ -562,33 +562,33 @@ function IP(r) {
|
|
|
562
562
|
});
|
|
563
563
|
}
|
|
564
564
|
function SP(r) {
|
|
565
|
-
const Q = new
|
|
566
|
-
color: new
|
|
565
|
+
const Q = new a.Group(), B = Math.max(1, r.sizeWorld) / 2, A = Math.max(1, r.depthWorld), t = Math.max(1, Math.min(B / 12, 30)), P = t * 0.6, e = (w) => new a.LineDashedMaterial({
|
|
566
|
+
color: new a.Color(w),
|
|
567
567
|
dashSize: t,
|
|
568
568
|
gapSize: P,
|
|
569
569
|
transparent: !0,
|
|
570
570
|
opacity: 0.75,
|
|
571
571
|
depthWrite: !1
|
|
572
|
-
}), i = new
|
|
573
|
-
new
|
|
574
|
-
new
|
|
575
|
-
new
|
|
572
|
+
}), i = new a.Line(
|
|
573
|
+
new a.BufferGeometry().setFromPoints([
|
|
574
|
+
new a.Vector3(-B, 0, 0),
|
|
575
|
+
new a.Vector3(B, 0, 0)
|
|
576
576
|
]),
|
|
577
577
|
e(r.theme.colors.axes.x)
|
|
578
578
|
);
|
|
579
579
|
i.computeLineDistances();
|
|
580
|
-
const s = new
|
|
581
|
-
new
|
|
582
|
-
new
|
|
583
|
-
new
|
|
580
|
+
const s = new a.Line(
|
|
581
|
+
new a.BufferGeometry().setFromPoints([
|
|
582
|
+
new a.Vector3(0, -B, 0),
|
|
583
|
+
new a.Vector3(0, B, 0)
|
|
584
584
|
]),
|
|
585
585
|
e(r.theme.colors.axes.y)
|
|
586
586
|
);
|
|
587
587
|
s.computeLineDistances();
|
|
588
|
-
const v = new
|
|
589
|
-
new
|
|
590
|
-
new
|
|
591
|
-
new
|
|
588
|
+
const v = new a.Line(
|
|
589
|
+
new a.BufferGeometry().setFromPoints([
|
|
590
|
+
new a.Vector3(0, 0, 0),
|
|
591
|
+
new a.Vector3(0, 0, A)
|
|
592
592
|
]),
|
|
593
593
|
e(r.theme.colors.axes.z)
|
|
594
594
|
);
|
|
@@ -603,32 +603,32 @@ function SP(r) {
|
|
|
603
603
|
function YP(r) {
|
|
604
604
|
r.traverse((Q) => {
|
|
605
605
|
var B;
|
|
606
|
-
if (Q instanceof
|
|
606
|
+
if (Q instanceof a.Line) {
|
|
607
607
|
Q.geometry.dispose();
|
|
608
608
|
const A = Q.material;
|
|
609
609
|
Array.isArray(A) ? A.forEach((t) => t.dispose()) : A.dispose();
|
|
610
610
|
return;
|
|
611
611
|
}
|
|
612
|
-
if (Q instanceof
|
|
612
|
+
if (Q instanceof a.Sprite) {
|
|
613
613
|
const A = Q.material;
|
|
614
614
|
(B = A.map) == null || B.dispose(), A.dispose();
|
|
615
615
|
}
|
|
616
616
|
});
|
|
617
617
|
}
|
|
618
618
|
function VP(r) {
|
|
619
|
-
const Q = new
|
|
619
|
+
const Q = new a.Group(), B = Math.max(1, r.sizeMm) / 2, A = r.units === "mm" ? 10 : 1, t = A, P = r.units === "mm" ? B : B / eA, e = A * 2, i = r.units === "mm" ? 1 : eA, s = 0.5, v = 4, c = 0.1, n = 5;
|
|
620
620
|
for (let T = t; T <= P + 1e-6; T += e) {
|
|
621
621
|
const z = T * i;
|
|
622
622
|
if (z > B + 1e-6)
|
|
623
623
|
continue;
|
|
624
624
|
const w = r.theme.colors.axes.x, o = r.theme.colors.axes.y, E = { opacity: s, size: v }, k = OQ(String(T), w, E);
|
|
625
625
|
k.position.set(z, n, c);
|
|
626
|
-
const
|
|
627
|
-
|
|
626
|
+
const h = OQ(String(-T), w, E);
|
|
627
|
+
h.position.set(-z, n, c);
|
|
628
628
|
const U = OQ(String(T), o, E);
|
|
629
629
|
U.position.set(-n, z, c);
|
|
630
630
|
const D = OQ(String(-T), o, E);
|
|
631
|
-
D.position.set(-n, -z, c), Q.add(k,
|
|
631
|
+
D.position.set(-n, -z, c), Q.add(k, h, U, D);
|
|
632
632
|
}
|
|
633
633
|
return Q;
|
|
634
634
|
}
|
|
@@ -909,15 +909,15 @@ var sQ = {
|
|
|
909
909
|
edges: 0.5,
|
|
910
910
|
end: 1
|
|
911
911
|
}[t] || 0 : !i && s && (c = t[0], n = t[1]), function(T, z, w) {
|
|
912
|
-
var o = (w || B).length, E = e[o], k,
|
|
912
|
+
var o = (w || B).length, E = e[o], k, h, U, D, l, O, u, N, C;
|
|
913
913
|
if (!E) {
|
|
914
914
|
if (C = B.grid === "auto" ? 0 : (B.grid || [1, zQ])[1], !C) {
|
|
915
915
|
for (u = -zQ; u < (u = w[C++].getBoundingClientRect().left) && C < o; )
|
|
916
916
|
;
|
|
917
917
|
C < o && C--;
|
|
918
918
|
}
|
|
919
|
-
for (E = e[o] = [], k = s ? Math.min(C, o) * c - 0.5 : t % C,
|
|
920
|
-
U = O % C - k, D =
|
|
919
|
+
for (E = e[o] = [], k = s ? Math.min(C, o) * c - 0.5 : t % C, h = C === zQ ? 0 : s ? o * n / C - 0.5 : t / C | 0, u = 0, N = zQ, O = 0; O < o; O++)
|
|
920
|
+
U = O % C - k, D = h - (O / C | 0), E[O] = l = v ? Math.abs(v === "y" ? D : U) : zt(U * U + D * D), l > u && (u = l), l < N && (N = l);
|
|
921
921
|
t === "random" && jt(E), E.max = u - N, E.min = N, E.v = o = (parseFloat(B.amount) || parseFloat(B.each) * (C > o ? o - 1 : v ? v === "y" ? o / C : C : Math.max(C, o / C)) || 0) * (t === "edges" ? -1 : 1), E.b = o < 0 ? P - o : P, E.u = W(B.amount || B.each) || 0, A = A && o < 0 ? Ce(A) : A;
|
|
922
922
|
}
|
|
923
923
|
return o = (E[T] - E.min) / E.max || 0, y(E.b + (A ? A(o) : o) * E.v) + E.u;
|
|
@@ -1118,8 +1118,8 @@ var sQ = {
|
|
|
1118
1118
|
return A = he.test(B), Q[1] = XA(Q[1], A), Q[0] = XA(Q[0], A, yt(Q[1])), !0;
|
|
1119
1119
|
}, aB, eQ = function() {
|
|
1120
1120
|
var r = Date.now, Q = 500, B = 33, A = r(), t = A, P = 1e3 / 240, e = P, i = [], s, v, c, n, T, z, w = function o(E) {
|
|
1121
|
-
var k = r() - t,
|
|
1122
|
-
if ((k > Q || k < 0) && (A += k - B), t += k, l = t - A, U = l - e, (U > 0 ||
|
|
1121
|
+
var k = r() - t, h = E === !0, U, D, l, O;
|
|
1122
|
+
if ((k > Q || k < 0) && (A += k - B), t += k, l = t - A, U = l - e, (U > 0 || h) && (O = ++n.frame, T = l - n.time * 1e3, n.time = l = l / 1e3, e += U + (U >= P ? 4 : P - U), D = 1), h || (s = v(o)), D)
|
|
1123
1123
|
for (z = 0; z < i.length; z++)
|
|
1124
1124
|
i[z](l, T, O, E);
|
|
1125
1125
|
};
|
|
@@ -1146,11 +1146,11 @@ var sQ = {
|
|
|
1146
1146
|
fps: function(E) {
|
|
1147
1147
|
P = 1e3 / (E || 240), e = n.time * 1e3 + P;
|
|
1148
1148
|
},
|
|
1149
|
-
add: function(E, k,
|
|
1149
|
+
add: function(E, k, h) {
|
|
1150
1150
|
var U = k ? function(D, l, O, u) {
|
|
1151
1151
|
E(D, l, O, u), n.remove(U);
|
|
1152
1152
|
} : E;
|
|
1153
|
-
return n.remove(E), i[
|
|
1153
|
+
return n.remove(E), i[h ? "unshift" : "push"](U), AB(), U;
|
|
1154
1154
|
},
|
|
1155
1155
|
remove: function(E, k) {
|
|
1156
1156
|
~(k = i.indexOf(E)) && i.splice(k, 1) && z >= k && z--;
|
|
@@ -1410,7 +1410,7 @@ var _ = /* @__PURE__ */ function(r) {
|
|
|
1410
1410
|
}, B.staggerFromTo = function(t, P, e, i, s, v, c, n) {
|
|
1411
1411
|
return i.startAt = e, cB(i).immediateRender = $(i.immediateRender), this.staggerTo(t, P, i, s, v, c, n);
|
|
1412
1412
|
}, B.render = function(t, P, e) {
|
|
1413
|
-
var i = this._time, s = this._dirty ? this.totalDuration() : this._tDur, v = this._dur, c = t <= 0 ? 0 : y(t), n = this._zTime < 0 != t < 0 && (this._initted || !v), T, z, w, o, E, k,
|
|
1413
|
+
var i = this._time, s = this._dirty ? this.totalDuration() : this._tDur, v = this._dur, c = t <= 0 ? 0 : y(t), n = this._zTime < 0 != t < 0 && (this._initted || !v), T, z, w, o, E, k, h, U, D, l, O, u;
|
|
1414
1414
|
if (this !== I && c > s && t >= 0 && (c = s), c !== this._tTime || e || n) {
|
|
1415
1415
|
if (i !== this._time && v && (c += this._time - i, t += this._time - i), T = c, D = this._start, U = this._ts, k = !U, n && (v || (i = this._zTime), (t || !P) && (this._zTime = t)), this._repeat) {
|
|
1416
1416
|
if (O = this._yoyo, E = v + this._rDelay, this._repeat < -1 && t < 0)
|
|
@@ -1423,15 +1423,15 @@ var _ = /* @__PURE__ */ function(r) {
|
|
|
1423
1423
|
return this;
|
|
1424
1424
|
}
|
|
1425
1425
|
}
|
|
1426
|
-
if (this._hasPause && !this._forcing && this._lock < 2 && (
|
|
1426
|
+
if (this._hasPause && !this._forcing && this._lock < 2 && (h = se(this, y(i), y(T)), h && (c -= T - (T = h._start))), this._tTime = c, this._time = T, this._act = !!U, this._initted || (this._onUpdate = this.vars.onUpdate, this._initted = 1, this._zTime = t, i = 0), !i && c && v && !P && !l && (iQ(this, "onStart"), this._tTime !== c))
|
|
1427
1427
|
return this;
|
|
1428
1428
|
if (T >= i && t >= 0)
|
|
1429
1429
|
for (z = this._first; z; ) {
|
|
1430
|
-
if (w = z._next, (z._act || T >= z._start) && z._ts &&
|
|
1430
|
+
if (w = z._next, (z._act || T >= z._start) && z._ts && h !== z) {
|
|
1431
1431
|
if (z.parent !== this)
|
|
1432
1432
|
return this.render(t, P, e);
|
|
1433
1433
|
if (z.render(z._ts > 0 ? (T - z._start) * z._ts : (z._dirty ? z.totalDuration() : z._tDur) + (T - z._start) * z._ts, P, e), T !== this._time || !this._ts && !k) {
|
|
1434
|
-
|
|
1434
|
+
h = 0, w && (c += this._zTime = -x);
|
|
1435
1435
|
break;
|
|
1436
1436
|
}
|
|
1437
1437
|
}
|
|
@@ -1440,18 +1440,18 @@ var _ = /* @__PURE__ */ function(r) {
|
|
|
1440
1440
|
else {
|
|
1441
1441
|
z = this._last;
|
|
1442
1442
|
for (var M = t < 0 ? t : T; z; ) {
|
|
1443
|
-
if (w = z._prev, (z._act || M <= z._end) && z._ts &&
|
|
1443
|
+
if (w = z._prev, (z._act || M <= z._end) && z._ts && h !== z) {
|
|
1444
1444
|
if (z.parent !== this)
|
|
1445
1445
|
return this.render(t, P, e);
|
|
1446
1446
|
if (z.render(z._ts > 0 ? (M - z._start) * z._ts : (z._dirty ? z.totalDuration() : z._tDur) + (M - z._start) * z._ts, P, e || Z && LA(z)), T !== this._time || !this._ts && !k) {
|
|
1447
|
-
|
|
1447
|
+
h = 0, w && (c += this._zTime = M ? -x : x);
|
|
1448
1448
|
break;
|
|
1449
1449
|
}
|
|
1450
1450
|
}
|
|
1451
1451
|
z = w;
|
|
1452
1452
|
}
|
|
1453
1453
|
}
|
|
1454
|
-
if (
|
|
1454
|
+
if (h && !P && (this.pause(), h.render(T >= i ? 0 : -x)._zTime = T >= i ? 1 : -1, this._ts))
|
|
1455
1455
|
return this._start = D, pB(this), this.render(t, P, e);
|
|
1456
1456
|
this._onUpdate && !P && iQ(this, "onUpdate", !0), (c === s && this._tTime >= this.totalDuration() || !c && i) && (D === this._start || Math.abs(U) !== Math.abs(this._ts)) && (this._lock || ((t || !v) && (c === s && this._ts > 0 || !c && this._ts < 0) && FQ(this, 1), !P && !(t < 0 && !i) && (c || i || !s) && (iQ(this, c === s && t >= 0 ? "onComplete" : "onReverseComplete", !0), this._prom && !(c < s && this.timeScale() > 0) && this._prom())));
|
|
1457
1457
|
}
|
|
@@ -1582,8 +1582,8 @@ cQ(_.prototype, {
|
|
|
1582
1582
|
_forcing: 0
|
|
1583
1583
|
});
|
|
1584
1584
|
var Ne = function(Q, B, A, t, P, e, i) {
|
|
1585
|
-
var s = new BQ(this._pt, Q, B, 0, 1, Zt, null, P), v = 0, c = 0, n, T, z, w, o, E, k,
|
|
1586
|
-
for (s.b = A, s.e = t, A += "", t += "", (k = ~t.indexOf("random(")) && (t = EB(t)), e && (
|
|
1585
|
+
var s = new BQ(this._pt, Q, B, 0, 1, Zt, null, P), v = 0, c = 0, n, T, z, w, o, E, k, h;
|
|
1586
|
+
for (s.b = A, s.e = t, A += "", t += "", (k = ~t.indexOf("random(")) && (t = EB(t)), e && (h = [A, t], e(h, Q, B), A = h[0], t = h[1]), T = A.match(SB) || []; n = SB.exec(t); )
|
|
1587
1587
|
w = n[0], o = t.substring(v, n.index), z ? z = (z + 1) % 5 : o.substr(-5) === "rgba(" && (z = 1), w !== T[c++] && (E = parseFloat(T[c - 1]) || 0, s._pt = {
|
|
1588
1588
|
_next: s._pt,
|
|
1589
1589
|
p: o || c === 1 ? o : ",",
|
|
@@ -1612,7 +1612,7 @@ var Ne = function(Q, B, A, t, P, e, i) {
|
|
|
1612
1612
|
v[i._props[c]] = s;
|
|
1613
1613
|
return i;
|
|
1614
1614
|
}, dQ, zA, HA = function r(Q, B, A) {
|
|
1615
|
-
var t = Q.vars, P = t.ease, e = t.startAt, i = t.immediateRender, s = t.lazy, v = t.onUpdate, c = t.runBackwards, n = t.yoyoEase, T = t.keyframes, z = t.autoRevert, w = Q._dur, o = Q._startAt, E = Q._targets, k = Q.parent,
|
|
1615
|
+
var t = Q.vars, P = t.ease, e = t.startAt, i = t.immediateRender, s = t.lazy, v = t.onUpdate, c = t.runBackwards, n = t.yoyoEase, T = t.keyframes, z = t.autoRevert, w = Q._dur, o = Q._startAt, E = Q._targets, k = Q.parent, h = k && k.data === "nested" ? k.vars.targets : E, U = Q._overwrite === "auto" && !lA, D = Q.timeline, l = t.easeReverse || n, O, u, N, C, M, b, j, d, G, f, H, F, X;
|
|
1616
1616
|
if (D && (!T || !P) && (P = "none"), Q._ease = VQ(P, TB.ease), Q._rEase = l && (VQ(l) || Q._ease), Q._from = !D && !!t.runBackwards, Q._from && (Q.ratio = 1), !D || T && !t.stagger) {
|
|
1617
1617
|
if (d = E[0] ? SQ(E[0]).harness : 0, F = d && t[d.prop], O = jB(t, NA), o && (o._zTime < 0 && o.progress(1), B < 0 && c && i && !z ? o.render(-1, !0) : o.revert(c && w ? NB : $P), o._lazy = 0), e) {
|
|
1618
1618
|
if (FQ(Q._startAt = J.set(E, cQ({
|
|
@@ -1648,11 +1648,11 @@ var Ne = function(Q, B, A, t, P, e, i) {
|
|
|
1648
1648
|
return;
|
|
1649
1649
|
}
|
|
1650
1650
|
for (Q._pt = Q._ptCache = 0, s = w && $(s) || s && !w, u = 0; u < E.length; u++) {
|
|
1651
|
-
if (M = E[u], j = M._gsap || dA(E)[u]._gsap, Q._ptLookup[u] = f = {}, sA[j.id] && HQ.length && HB(), H =
|
|
1651
|
+
if (M = E[u], j = M._gsap || dA(E)[u]._gsap, Q._ptLookup[u] = f = {}, sA[j.id] && HQ.length && HB(), H = h === E ? u : h.indexOf(M), d && (G = new d()).init(M, F || O, Q, H, h) !== !1 && (Q._pt = C = new BQ(Q._pt, M, G.name, 0, 1, G.render, G, 0, G.priority), G._props.forEach(function(nQ) {
|
|
1652
1652
|
f[nQ] = C;
|
|
1653
1653
|
}), G.priority && (b = 1)), !d || F)
|
|
1654
1654
|
for (N in O)
|
|
1655
|
-
PQ[N] && (G = Vt(N, O, Q, H, M,
|
|
1655
|
+
PQ[N] && (G = Vt(N, O, Q, H, M, h)) ? G.priority && (b = 1) : f[N] = C = MA.call(Q, M, N, "get", O[N], H, h, 0, t.stringFilter);
|
|
1656
1656
|
Q._op && Q._op[u] && Q.kill(M, Q._op[u]), U && Q._pt && (dQ = Q, I.killTweensOf(M, f, Q.globalTime(B)), X = !Q.parent, dQ = 0), Q._pt && s && (sA[j.id] = 1);
|
|
1657
1657
|
}
|
|
1658
1658
|
b && Wt(Q), Q._onInit && Q._onInit(Q);
|
|
@@ -1709,20 +1709,20 @@ var J = /* @__PURE__ */ function(r) {
|
|
|
1709
1709
|
function Q(A, t, P, e) {
|
|
1710
1710
|
var i;
|
|
1711
1711
|
typeof t == "number" && (P.duration = t, t = P, P = null), i = r.call(this, e ? t : cB(t)) || this;
|
|
1712
|
-
var s = i.vars, v = s.duration, c = s.delay, n = s.immediateRender, T = s.stagger, z = s.overwrite, w = s.keyframes, o = s.defaults, E = s.scrollTrigger, k = t.parent || I,
|
|
1713
|
-
if (i._targets =
|
|
1712
|
+
var s = i.vars, v = s.duration, c = s.delay, n = s.immediateRender, T = s.stagger, z = s.overwrite, w = s.keyframes, o = s.defaults, E = s.scrollTrigger, k = t.parent || I, h = (q(A) || wt(A) ? uQ(A[0]) : "length" in t) ? [A] : wQ(A), U, D, l, O, u, N, C, M;
|
|
1713
|
+
if (i._targets = h.length ? dA(h) : zB("GSAP target " + A + " not found. https://gsap.com", !sQ.nullTargetWarn) || [], i._ptLookup = [], i._overwrite = z, w || T || CB(v) || CB(c)) {
|
|
1714
1714
|
t = i.vars;
|
|
1715
1715
|
var b = t.easeReverse || t.yoyoEase;
|
|
1716
1716
|
if (U = i.timeline = new _({
|
|
1717
1717
|
data: "nested",
|
|
1718
1718
|
defaults: o || {},
|
|
1719
|
-
targets: k && k.data === "nested" ? k.vars.targets :
|
|
1719
|
+
targets: k && k.data === "nested" ? k.vars.targets : h
|
|
1720
1720
|
}), U.kill(), U.parent = U._dp = UQ(i), U._start = 0, T || CB(v) || CB(c)) {
|
|
1721
|
-
if (O =
|
|
1721
|
+
if (O = h.length, C = T && Ft(T), kQ(T))
|
|
1722
1722
|
for (u in T)
|
|
1723
1723
|
~Jt.indexOf(u) && (M || (M = {}), M[u] = T[u]);
|
|
1724
1724
|
for (D = 0; D < O; D++)
|
|
1725
|
-
l = jB(t, Rt), l.stagger = 0, b && (l.easeReverse = b), M && $Q(l, M), N =
|
|
1725
|
+
l = jB(t, Rt), l.stagger = 0, b && (l.easeReverse = b), M && $Q(l, M), N = h[D], l.duration = +oB(v, UQ(i), D, N, h), l.delay = (+oB(c, UQ(i), D, N, h) || 0) - i._delay, !T && O === 1 && l.delay && (i._delay = c = l.delay, i._start += c, l.delay = 0), U.to(N, l, C ? C(D, N, h) : 0), U._ease = g.none;
|
|
1726
1726
|
U.duration() ? v = c = 0 : i.timeline = 0;
|
|
1727
1727
|
} else if (w) {
|
|
1728
1728
|
cB(cQ(U.vars.defaults, {
|
|
@@ -1731,7 +1731,7 @@ var J = /* @__PURE__ */ function(r) {
|
|
|
1731
1731
|
var j = 0, d, G, f;
|
|
1732
1732
|
if (q(w))
|
|
1733
1733
|
w.forEach(function(H) {
|
|
1734
|
-
return U.to(
|
|
1734
|
+
return U.to(h, H, ">");
|
|
1735
1735
|
}), U.duration();
|
|
1736
1736
|
else {
|
|
1737
1737
|
l = {};
|
|
@@ -1744,7 +1744,7 @@ var J = /* @__PURE__ */ function(r) {
|
|
|
1744
1744
|
G = d[D], f = {
|
|
1745
1745
|
ease: G.e,
|
|
1746
1746
|
duration: (G.t - (D ? d[D - 1].t : 0)) / 100 * v
|
|
1747
|
-
}, f[u] = G.v, U.to(
|
|
1747
|
+
}, f[u] = G.v, U.to(h, f, j), j += f.duration;
|
|
1748
1748
|
U.duration() < v && U.to({}, {
|
|
1749
1749
|
duration: v - U.duration()
|
|
1750
1750
|
});
|
|
@@ -1753,11 +1753,11 @@ var J = /* @__PURE__ */ function(r) {
|
|
|
1753
1753
|
v || i.duration(v = U.duration());
|
|
1754
1754
|
} else
|
|
1755
1755
|
i.timeline = 0;
|
|
1756
|
-
return z === !0 && !lA && (dQ = UQ(i), I.killTweensOf(
|
|
1756
|
+
return z === !0 && !lA && (dQ = UQ(i), I.killTweensOf(h), dQ = 0), aQ(k, UQ(i), P), t.reversed && i.reverse(), t.paused && i.paused(!0), (n || !v && !w && i._start === y(k._time) && $(n) && ee(UQ(i)) && k.data !== "nested") && (i._tTime = -x, i.render(Math.max(0, -c) || 0)), E && Lt(UQ(i), E), i;
|
|
1757
1757
|
}
|
|
1758
1758
|
var B = Q.prototype;
|
|
1759
1759
|
return B.render = function(t, P, e) {
|
|
1760
|
-
var i = this._time, s = this._tDur, v = this._dur, c = t < 0, n = t > s - x && !c ? s : t < x ? 0 : t, T, z, w, o, E, k,
|
|
1760
|
+
var i = this._time, s = this._tDur, v = this._dur, c = t < 0, n = t > s - x && !c ? s : t < x ? 0 : t, T, z, w, o, E, k, h, U;
|
|
1761
1761
|
if (!v)
|
|
1762
1762
|
re(this, t, P, e);
|
|
1763
1763
|
else if (n !== this._tTime || !t || e || !this._initted && this._tTime || this._startAt && this._zTime < 0 !== c || this._lazy) {
|
|
@@ -1782,13 +1782,13 @@ var J = /* @__PURE__ */ function(r) {
|
|
|
1782
1782
|
var l = D ? i : v - i;
|
|
1783
1783
|
this._inv = D, this._from && (this.ratio = 1 - this.ratio), this._invRatio = this.ratio, this._invTime = i, this._invRecip = l ? (D ? -1 : 1) / l : 0, this._invScale = D ? -this.ratio : 1 - this.ratio, this._invEase = D ? this._rEase : this._ease;
|
|
1784
1784
|
}
|
|
1785
|
-
this.ratio =
|
|
1785
|
+
this.ratio = h = this._invRatio + this._invScale * this._invEase((T - this._invTime) * this._invRecip);
|
|
1786
1786
|
} else
|
|
1787
|
-
this.ratio =
|
|
1788
|
-
if (this._from && (this.ratio =
|
|
1787
|
+
this.ratio = h = this._ease(T / v);
|
|
1788
|
+
if (this._from && (this.ratio = h = 1 - h), this._tTime = n, this._time = T, !this._act && this._ts && (this._act = 1, this._lazy = 0), !i && n && !P && !E && (iQ(this, "onStart"), this._tTime !== n))
|
|
1789
1789
|
return this;
|
|
1790
1790
|
for (z = this._pt; z; )
|
|
1791
|
-
z.r(
|
|
1791
|
+
z.r(h, z.d), z = z._next;
|
|
1792
1792
|
U && U.render(t < 0 ? t : U._dur * U._ease(T / this._dur), P, e) || this._startAt && (this._zTime = t), this._onUpdate && !P && (c && vA(this, t, P, e), iQ(this, "onUpdate")), this._repeat && w !== E && this.vars.onRepeat && !P && this.parent && iQ(this, "onRepeat"), (n === this._tDur || !n) && this._tTime === n && (c && !this._onUpdate && vA(this, t, !0, !0), (t || !v) && (n === this._tDur && this._ts > 0 || !n && this._ts < 0) && FQ(this, 1), !P && !(c && !i) && (n || i || k) && (iQ(this, n === s ? "onComplete" : "onReverseComplete", !0), this._prom && !(n < s && this.timeScale() > 0) && this._prom()));
|
|
1793
1793
|
}
|
|
1794
1794
|
return this;
|
|
@@ -1810,8 +1810,8 @@ var J = /* @__PURE__ */ function(r) {
|
|
|
1810
1810
|
var i = this._targets, s = t ? wQ(t) : i, v = this._ptLookup, c = this._pt, n, T, z, w, o, E, k;
|
|
1811
1811
|
if ((!P || P === "all") && te(i, s))
|
|
1812
1812
|
return P === "all" && (this._pt = 0), sB(this);
|
|
1813
|
-
for (n = this._op = this._op || [], P !== "all" && (K(P) && (o = {}, QQ(P, function(
|
|
1814
|
-
return o[
|
|
1813
|
+
for (n = this._op = this._op || [], P !== "all" && (K(P) && (o = {}, QQ(P, function(h) {
|
|
1814
|
+
return o[h] = 1;
|
|
1815
1815
|
}), P = o), P = Le(i, P)), k = i.length; k--; )
|
|
1816
1816
|
if (~s.indexOf(i[k])) {
|
|
1817
1817
|
T = v[k], P === "all" ? (n[k] = P, w = T, z = {}) : (z = n[k] = n[k] || {}, w = P);
|
|
@@ -2387,8 +2387,8 @@ var ZA, LQ, qQ, fA, IQ, WA, bA, Ie = function() {
|
|
|
2387
2387
|
if (i[s ? "width" : "height"] = n + (T ? e : t), o = t !== "rem" && ~B.indexOf("adius") || t === "em" && Q.appendChild && !v ? Q : Q.parentNode, k && (o = (Q.ownerSVGElement || {}).parentNode), (!o || o === LQ || !o.appendChild) && (o = LQ.body), E = o._gsap, E && z && E.width && s && E.time === eQ.time && !E.uncache)
|
|
2388
2388
|
return V(P / E.width * n);
|
|
2389
2389
|
if (z && (B === "height" || B === "width")) {
|
|
2390
|
-
var
|
|
2391
|
-
Q.style[B] = n + t, w = Q[c],
|
|
2390
|
+
var h = Q.style[B];
|
|
2391
|
+
Q.style[B] = n + t, w = Q[c], h ? Q.style[B] = h : GQ(Q, B);
|
|
2392
2392
|
} else
|
|
2393
2393
|
(z || e === "%") && !Ai[rQ(o, "display")] && (i.position = rQ(Q, "position")), o === Q && (i.position = "static"), o.appendChild(IQ), w = IQ[c], o.removeChild(IQ), i.position = "absolute";
|
|
2394
2394
|
return s && z && (E = SQ(o), E.time = eQ.time, E.width = o[c]), V(T ? w * P / n : w && P ? n / w * P : 0);
|
|
@@ -2400,12 +2400,12 @@ var ZA, LQ, qQ, fA, IQ, WA, bA, Ie = function() {
|
|
|
2400
2400
|
var P = tB(B, Q, 1), e = P && rQ(Q, P, 1);
|
|
2401
2401
|
e && e !== A ? (B = P, A = e) : B === "borderColor" && (A = rQ(Q, "borderTopColor"));
|
|
2402
2402
|
}
|
|
2403
|
-
var i = new BQ(this._pt, Q.style, B, 0, 1, Zt), s = 0, v = 0, c, n, T, z, w, o, E, k,
|
|
2403
|
+
var i = new BQ(this._pt, Q.style, B, 0, 1, Zt), s = 0, v = 0, c, n, T, z, w, o, E, k, h, U, D, l;
|
|
2404
2404
|
if (i.b = A, i.e = t, A += "", t += "", t.substring(0, 6) === "var(--" && (t = rQ(Q, t.substring(4, t.indexOf(")")))), t === "auto" && (o = Q.style[B], Q.style[B] = t, t = rQ(Q, B) || t, o ? Q.style[B] = o : GQ(Q, B)), c = [A, t], It(c), A = c[0], t = c[1], T = A.match(KQ) || [], l = t.match(KQ) || [], l.length) {
|
|
2405
2405
|
for (; n = KQ.exec(t); )
|
|
2406
|
-
E = n[0],
|
|
2406
|
+
E = n[0], h = t.substring(s, n.index), w ? w = (w + 1) % 5 : (h.substr(-5) === "rgba(" || h.substr(-5) === "hsla(") && (w = 1), E !== (o = T[v++] || "") && (z = parseFloat(o) || 0, D = o.substr((z + "").length), E.charAt(1) === "=" && (E = WQ(z, E) + D), k = parseFloat(E), U = E.substr((k + "").length), s = KQ.lastIndex - U.length, U || (U = U || sQ.units[B] || D, s === t.length && (t += U, i.e += U)), D !== U && (z = fQ(Q, B, o, U) || 0), i._pt = {
|
|
2407
2407
|
_next: i._pt,
|
|
2408
|
-
p:
|
|
2408
|
+
p: h || v === 1 ? h : ",",
|
|
2409
2409
|
//note: SVG spec allows omission of comma/space when a negative sign is wedged between two numbers, like 2.5-5.3 instead of 2.5,-5.3 but when tweening, the negative value may switch to positive, so we insert the comma just in case.
|
|
2410
2410
|
s: z,
|
|
2411
2411
|
c: k - z,
|
|
@@ -2513,14 +2513,14 @@ var ZA, LQ, qQ, fA, IQ, WA, bA, Ie = function() {
|
|
|
2513
2513
|
var A = Q._gsap || SQ(Q), t = Q.style, P = tt(Q), e, i, s, v;
|
|
2514
2514
|
return A.svg && Q.getAttribute("transform") ? (s = Q.transform.baseVal.consolidate().matrix, P = [s.a, s.b, s.c, s.d, s.e, s.f], P.join(",") === "1,0,0,1,0,0" ? kB : P) : (P === kB && !Q.offsetParent && Q !== qQ && !A.svg && (s = t.display, t.display = "block", e = Q.parentNode, (!e || !Q.offsetParent && !Q.getBoundingClientRect().width) && (v = 1, i = Q.nextElementSibling, qQ.appendChild(Q)), P = tt(Q), s ? t.display = s : GQ(Q, "display"), v && (i ? e.insertBefore(Q, i) : e ? e.appendChild(Q) : qQ.removeChild(Q))), B && P.length > 6 ? [P[0], P[1], P[4], P[5], P[12], P[13]] : P);
|
|
2515
2515
|
}, kA = function(Q, B, A, t, P, e) {
|
|
2516
|
-
var i = Q._gsap, s = P || pA(Q, !0), v = i.xOrigin || 0, c = i.yOrigin || 0, n = i.xOffset || 0, T = i.yOffset || 0, z = s[0], w = s[1], o = s[2], E = s[3], k = s[4],
|
|
2517
|
-
A ? s !== kB && (u = z * E - w * o) && (N = D * (E / u) + l * (-o / u) + (o *
|
|
2516
|
+
var i = Q._gsap, s = P || pA(Q, !0), v = i.xOrigin || 0, c = i.yOrigin || 0, n = i.xOffset || 0, T = i.yOffset || 0, z = s[0], w = s[1], o = s[2], E = s[3], k = s[4], h = s[5], U = B.split(" "), D = parseFloat(U[0]) || 0, l = parseFloat(U[1]) || 0, O, u, N, C;
|
|
2517
|
+
A ? s !== kB && (u = z * E - w * o) && (N = D * (E / u) + l * (-o / u) + (o * h - E * k) / u, C = D * (-w / u) + l * (z / u) - (z * h - w * k) / u, D = N, l = C) : (O = tP(Q), D = O.x + (~U[0].indexOf("%") ? D / 100 * O.width : D), l = O.y + (~(U[1] || U[0]).indexOf("%") ? l / 100 * O.height : l)), t || t !== !1 && i.smooth ? (k = D - v, h = l - c, i.xOffset = n + (k * z + h * o) - k, i.yOffset = T + (k * w + h * E) - h) : i.xOffset = i.yOffset = 0, i.xOrigin = D, i.yOrigin = l, i.smooth = !!t, i.origin = B, i.originIsAbsolute = !!A, Q.style[AQ] = "0px 0px", e && (MQ(e, i, "xOrigin", v, D), MQ(e, i, "yOrigin", c, l), MQ(e, i, "xOffset", n, i.xOffset), MQ(e, i, "yOffset", T, i.yOffset)), Q.setAttribute("data-svg-origin", D + " " + l);
|
|
2518
2518
|
}, lB = function(Q, B) {
|
|
2519
2519
|
var A = Q._gsap || new Yt(Q);
|
|
2520
2520
|
if ("x" in A && !B && !A.uncache)
|
|
2521
2521
|
return A;
|
|
2522
|
-
var t = Q.style, P = A.scaleX < 0, e = "px", i = "deg", s = getComputedStyle(Q), v = rQ(Q, AQ) || "0", c, n, T, z, w, o, E, k,
|
|
2523
|
-
return c = n = T = o = E = k =
|
|
2522
|
+
var t = Q.style, P = A.scaleX < 0, e = "px", i = "deg", s = getComputedStyle(Q), v = rQ(Q, AQ) || "0", c, n, T, z, w, o, E, k, h, U, D, l, O, u, N, C, M, b, j, d, G, f, H, F, X, nQ, NQ, gQ, oQ, R, lQ, pQ;
|
|
2523
|
+
return c = n = T = o = E = k = h = U = D = 0, z = w = 1, A.svg = !!(Q.getCTM && PP(Q)), s.translate && ((s.translate !== "none" || s.scale !== "none" || s.rotate !== "none") && (t[S] = (s.translate !== "none" ? "translate3d(" + (s.translate + " 0 0").split(" ").slice(0, 3).join(", ") + ") " : "") + (s.rotate !== "none" ? "rotate(" + s.rotate + ") " : "") + (s.scale !== "none" ? "scale(" + s.scale.split(" ").join(",") + ") " : "") + (s[S] !== "none" ? s[S] : "")), t.scale = t.rotate = t.translate = "none"), u = pA(Q, A.svg), A.svg && (A.uncache ? (X = Q.getBBox(), v = A.xOrigin - X.x + "px " + (A.yOrigin - X.y) + "px", F = "") : F = !B && Q.getAttribute("data-svg-origin"), kA(Q, F || v, !!F || A.originIsAbsolute, A.smooth !== !1, u)), l = A.xOrigin || 0, O = A.yOrigin || 0, u !== kB && (b = u[0], j = u[1], d = u[2], G = u[3], c = f = u[4], n = H = u[5], u.length === 6 ? (z = Math.sqrt(b * b + j * j), w = Math.sqrt(G * G + d * d), o = b || j ? XQ(j, b) * yQ : 0, h = d || G ? XQ(d, G) * yQ + o : 0, h && (w *= Math.abs(Math.cos(h * _Q))), A.svg && (c -= l - (l * b + O * d), n -= O - (l * j + O * G))) : (pQ = u[6], R = u[7], NQ = u[8], gQ = u[9], oQ = u[10], lQ = u[11], c = u[12], n = u[13], T = u[14], N = XQ(pQ, oQ), E = N * yQ, N && (C = Math.cos(-N), M = Math.sin(-N), F = f * C + NQ * M, X = H * C + gQ * M, nQ = pQ * C + oQ * M, NQ = f * -M + NQ * C, gQ = H * -M + gQ * C, oQ = pQ * -M + oQ * C, lQ = R * -M + lQ * C, f = F, H = X, pQ = nQ), N = XQ(-d, oQ), k = N * yQ, N && (C = Math.cos(-N), M = Math.sin(-N), F = b * C - NQ * M, X = j * C - gQ * M, nQ = d * C - oQ * M, lQ = G * M + lQ * C, b = F, j = X, d = nQ), N = XQ(j, b), o = N * yQ, N && (C = Math.cos(N), M = Math.sin(N), F = b * C + j * M, X = f * C + H * M, j = j * C - b * M, H = H * C - f * M, b = F, f = X), E && Math.abs(E) + Math.abs(o) > 359.9 && (E = o = 0, k = 180 - k), z = V(Math.sqrt(b * b + j * j + d * d)), w = V(Math.sqrt(H * H + pQ * pQ)), N = XQ(f, H), h = Math.abs(N) > 2e-4 ? N * yQ : 0, D = lQ ? 1 / (lQ < 0 ? -lQ : lQ) : 0), A.svg && (F = Q.getAttribute("transform"), A.forceCSS = Q.setAttribute("transform", "") || !iP(rQ(Q, S)), F && Q.setAttribute("transform", F))), Math.abs(h) > 90 && Math.abs(h) < 270 && (P ? (z *= -1, h += o <= 0 ? 180 : -180, o += o <= 0 ? 180 : -180) : (w *= -1, h += h <= 0 ? 180 : -180)), B = B || A.uncache, A.x = c - ((A.xPercent = c && (!B && A.xPercent || (Math.round(Q.offsetWidth / 2) === Math.round(-c) ? -50 : 0))) ? Q.offsetWidth * A.xPercent / 100 : 0) + e, A.y = n - ((A.yPercent = n && (!B && A.yPercent || (Math.round(Q.offsetHeight / 2) === Math.round(-n) ? -50 : 0))) ? Q.offsetHeight * A.yPercent / 100 : 0) + e, A.z = T + e, A.scaleX = V(z), A.scaleY = V(w), A.rotation = V(o) + i, A.rotationX = V(E) + i, A.rotationY = V(k) + i, A.skewX = h + i, A.skewY = U + i, A.transformPerspective = D + e, (A.zOrigin = parseFloat(v.split(" ")[2]) || !B && A.zOrigin || 0) && (t[AQ] = bB(v)), A.xOffset = A.yOffset = 0, A.force3D = sQ.force3D, A.renderTransform = A.svg ? ri : AP ? rP : ii, A.uncache = 0, A;
|
|
2524
2524
|
}, bB = function(Q) {
|
|
2525
2525
|
return (Q = Q.split(" "))[0] + " " + Q[1];
|
|
2526
2526
|
}, ZB = function(Q, B, A) {
|
|
@@ -2529,15 +2529,15 @@ var ZA, LQ, qQ, fA, IQ, WA, bA, Ie = function() {
|
|
|
2529
2529
|
}, ii = function(Q, B) {
|
|
2530
2530
|
B.z = "0px", B.rotationY = B.rotationX = "0deg", B.force3D = 0, rP(Q, B);
|
|
2531
2531
|
}, xQ = "0deg", PB = "0px", mQ = ") ", rP = function(Q, B) {
|
|
2532
|
-
var A = B || this, t = A.xPercent, P = A.yPercent, e = A.x, i = A.y, s = A.z, v = A.rotation, c = A.rotationY, n = A.rotationX, T = A.skewX, z = A.skewY, w = A.scaleX, o = A.scaleY, E = A.transformPerspective, k = A.force3D,
|
|
2532
|
+
var A = B || this, t = A.xPercent, P = A.yPercent, e = A.x, i = A.y, s = A.z, v = A.rotation, c = A.rotationY, n = A.rotationX, T = A.skewX, z = A.skewY, w = A.scaleX, o = A.scaleY, E = A.transformPerspective, k = A.force3D, h = A.target, U = A.zOrigin, D = "", l = k === "auto" && Q && Q !== 1 || k === !0;
|
|
2533
2533
|
if (U && (n !== xQ || c !== xQ)) {
|
|
2534
2534
|
var O = parseFloat(c) * _Q, u = Math.sin(O), N = Math.cos(O), C;
|
|
2535
|
-
O = parseFloat(n) * _Q, C = Math.cos(O), e = ZB(
|
|
2535
|
+
O = parseFloat(n) * _Q, C = Math.cos(O), e = ZB(h, e, u * C * -U), i = ZB(h, i, -Math.sin(O) * -U), s = ZB(h, s, N * C * -U + U);
|
|
2536
2536
|
}
|
|
2537
|
-
E !== PB && (D += "perspective(" + E + mQ), (t || P) && (D += "translate(" + t + "%, " + P + "%) "), (l || e !== PB || i !== PB || s !== PB) && (D += s !== PB || l ? "translate3d(" + e + ", " + i + ", " + s + ") " : "translate(" + e + ", " + i + mQ), v !== xQ && (D += "rotate(" + v + mQ), c !== xQ && (D += "rotateY(" + c + mQ), n !== xQ && (D += "rotateX(" + n + mQ), (T !== xQ || z !== xQ) && (D += "skew(" + T + ", " + z + mQ), (w !== 1 || o !== 1) && (D += "scale(" + w + ", " + o + mQ),
|
|
2537
|
+
E !== PB && (D += "perspective(" + E + mQ), (t || P) && (D += "translate(" + t + "%, " + P + "%) "), (l || e !== PB || i !== PB || s !== PB) && (D += s !== PB || l ? "translate3d(" + e + ", " + i + ", " + s + ") " : "translate(" + e + ", " + i + mQ), v !== xQ && (D += "rotate(" + v + mQ), c !== xQ && (D += "rotateY(" + c + mQ), n !== xQ && (D += "rotateX(" + n + mQ), (T !== xQ || z !== xQ) && (D += "skew(" + T + ", " + z + mQ), (w !== 1 || o !== 1) && (D += "scale(" + w + ", " + o + mQ), h.style[S] = D || "translate(0, 0)";
|
|
2538
2538
|
}, ri = function(Q, B) {
|
|
2539
|
-
var A = B || this, t = A.xPercent, P = A.yPercent, e = A.x, i = A.y, s = A.rotation, v = A.skewX, c = A.skewY, n = A.scaleX, T = A.scaleY, z = A.target, w = A.xOrigin, o = A.yOrigin, E = A.xOffset, k = A.yOffset,
|
|
2540
|
-
s = parseFloat(s), v = parseFloat(v), c = parseFloat(c), c && (c = parseFloat(c), v += c, s += c), s || v ? (s *= _Q, v *= _Q, l = Math.cos(s) * n, O = Math.sin(s) * n, u = Math.sin(s - v) * -T, N = Math.cos(s - v) * T, v && (c *= _Q, C = Math.tan(v - c), C = Math.sqrt(1 + C * C), u *= C, N *= C, c && (C = Math.tan(c), C = Math.sqrt(1 + C * C), l *= C, O *= C)), l = V(l), O = V(O), u = V(u), N = V(N)) : (l = n, N = T, O = u = 0), (U && !~(e + "").indexOf("px") || D && !~(i + "").indexOf("px")) && (U = fQ(z, "x", e, "px"), D = fQ(z, "y", i, "px")), (w || o || E || k) && (U = V(U + w - (w * l + o * u) + E), D = V(D + o - (w * O + o * N) + k)), (t || P) && (C = z.getBBox(), U = V(U + t / 100 * C.width), D = V(D + P / 100 * C.height)), C = "matrix(" + l + "," + O + "," + u + "," + N + "," + U + "," + D + ")", z.setAttribute("transform", C),
|
|
2539
|
+
var A = B || this, t = A.xPercent, P = A.yPercent, e = A.x, i = A.y, s = A.rotation, v = A.skewX, c = A.skewY, n = A.scaleX, T = A.scaleY, z = A.target, w = A.xOrigin, o = A.yOrigin, E = A.xOffset, k = A.yOffset, h = A.forceCSS, U = parseFloat(e), D = parseFloat(i), l, O, u, N, C;
|
|
2540
|
+
s = parseFloat(s), v = parseFloat(v), c = parseFloat(c), c && (c = parseFloat(c), v += c, s += c), s || v ? (s *= _Q, v *= _Q, l = Math.cos(s) * n, O = Math.sin(s) * n, u = Math.sin(s - v) * -T, N = Math.cos(s - v) * T, v && (c *= _Q, C = Math.tan(v - c), C = Math.sqrt(1 + C * C), u *= C, N *= C, c && (C = Math.tan(c), C = Math.sqrt(1 + C * C), l *= C, O *= C)), l = V(l), O = V(O), u = V(u), N = V(N)) : (l = n, N = T, O = u = 0), (U && !~(e + "").indexOf("px") || D && !~(i + "").indexOf("px")) && (U = fQ(z, "x", e, "px"), D = fQ(z, "y", i, "px")), (w || o || E || k) && (U = V(U + w - (w * l + o * u) + E), D = V(D + o - (w * O + o * N) + k)), (t || P) && (C = z.getBBox(), U = V(U + t / 100 * C.width), D = V(D + P / 100 * C.height)), C = "matrix(" + l + "," + O + "," + u + "," + N + "," + U + "," + D + ")", z.setAttribute("transform", C), h && (z.style[S] = C);
|
|
2541
2541
|
}, si = function(Q, B, A, t, P) {
|
|
2542
2542
|
var e = 360, i = K(P), s = parseFloat(P) * (i && ~P.indexOf("rad") ? yQ : 1), v = s - t, c = t + v + "deg", n, T;
|
|
2543
2543
|
return i && (n = P.split("_")[1], n === "short" && (v %= e, v !== v % (e / 2) && (v += v < 0 ? e : -e)), n === "cw" && v < 0 ? v = (v + e * qA) % e - ~~(v / e) * e : n === "ccw" && v > 0 && (v = (v - e * qA) % e - ~~(v / e) * e)), Q._pt = T = new BQ(Q._pt, B, A, t, v, Ve), T.e = c, T.u = "deg", Q._props.push(A), T;
|
|
@@ -2574,7 +2574,7 @@ var sP = {
|
|
|
2574
2574
|
return Q.style && Q.nodeType;
|
|
2575
2575
|
},
|
|
2576
2576
|
init: function(Q, B, A, t, P) {
|
|
2577
|
-
var e = this._props, i = Q.style, s = A.vars.startAt, v, c, n, T, z, w, o, E, k,
|
|
2577
|
+
var e = this._props, i = Q.style, s = A.vars.startAt, v, c, n, T, z, w, o, E, k, h, U, D, l, O, u, N, C;
|
|
2578
2578
|
fA || hA(), this.styles = this.styles || BP(Q), N = this.styles.props, this.tween = A;
|
|
2579
2579
|
for (o in B)
|
|
2580
2580
|
if (o !== "autoRound" && (c = B[o], !(PQ[o] && Vt(o, B, A, t, Q, P)))) {
|
|
@@ -2583,7 +2583,7 @@ var sP = {
|
|
|
2583
2583
|
else if (o.substr(0, 2) === "--")
|
|
2584
2584
|
v = (getComputedStyle(Q).getPropertyValue(o) + "").trim(), c += "", jQ.lastIndex = 0, jQ.test(v) || (E = W(v), k = W(c), k ? E !== k && (v = fQ(Q, o, v, k) + k) : E && (c += E)), this.add(i, "setProperty", v, c, t, P, 0, 0, o), e.push(o), N.push(o, 0, i[o]);
|
|
2585
2585
|
else if (z !== "undefined") {
|
|
2586
|
-
if (s && o in s ? (v = typeof s[o] == "function" ? s[o].call(A, t, Q, P) : s[o], K(v) && ~v.indexOf("random(") && (v = EB(v)), W(v + "") || v === "auto" || (v += sQ.units[o] || W(DQ(Q, o)) || ""), (v + "").charAt(1) === "=" && (v = DQ(Q, o))) : v = DQ(Q, o), T = parseFloat(v),
|
|
2586
|
+
if (s && o in s ? (v = typeof s[o] == "function" ? s[o].call(A, t, Q, P) : s[o], K(v) && ~v.indexOf("random(") && (v = EB(v)), W(v + "") || v === "auto" || (v += sQ.units[o] || W(DQ(Q, o)) || ""), (v + "").charAt(1) === "=" && (v = DQ(Q, o))) : v = DQ(Q, o), T = parseFloat(v), h = z === "string" && c.charAt(1) === "=" && c.substr(0, 2), h && (c = c.substr(2)), n = parseFloat(c), o in hQ && (o === "autoAlpha" && (T === 1 && DQ(Q, "visibility") === "hidden" && n && (T = 0), N.push("visibility", 0, i.visibility), MQ(this, i, "visibility", T ? "inherit" : "hidden", n ? "inherit" : "hidden", !n)), o !== "scale" && o !== "transform" && (o = hQ[o], ~o.indexOf(",") && (o = o.split(",")[0]))), U = o in CQ, U) {
|
|
2587
2587
|
if (this.styles.save(o), C = c, z === "string" && c.substring(0, 6) === "var(--") {
|
|
2588
2588
|
if (c = rQ(Q, c.substring(4, c.indexOf(")"))), c.substring(0, 5) === "calc(") {
|
|
2589
2589
|
var M = Q.style.perspective;
|
|
@@ -2592,7 +2592,7 @@ var sP = {
|
|
|
2592
2592
|
n = parseFloat(c);
|
|
2593
2593
|
}
|
|
2594
2594
|
if (D || (l = Q._gsap, l.renderTransform && !B.parseTransform || lB(Q, B.parseTransform), O = B.smoothOrigin !== !1 && l.smooth, D = this._pt = new BQ(this._pt, i, S, 0, 1, l.renderTransform, l, 0, -1), D.dep = 1), o === "scale")
|
|
2595
|
-
this._pt = new BQ(this._pt, l, "scaleY", l.scaleY, (
|
|
2595
|
+
this._pt = new BQ(this._pt, l, "scaleY", l.scaleY, (h ? WQ(l.scaleY, h + n) : n) - l.scaleY || 0, EA), this._pt.u = 0, e.push("scaleY", o), o += "X";
|
|
2596
2596
|
else if (o === "transformOrigin") {
|
|
2597
2597
|
N.push(AQ, 0, i[AQ]), c = Pi(c), l.svg ? kA(Q, c, 0, O, 0, this) : (k = parseFloat(c.split(" ")[2]) || 0, k !== l.zOrigin && MQ(this, l, "zOrigin", l.zOrigin, k), MQ(this, i, o, bB(v), bB(c)));
|
|
2598
2598
|
continue;
|
|
@@ -2600,7 +2600,7 @@ var sP = {
|
|
|
2600
2600
|
kA(Q, c, 1, O, 0, this);
|
|
2601
2601
|
continue;
|
|
2602
2602
|
} else if (o in eP) {
|
|
2603
|
-
si(this, l, o, T,
|
|
2603
|
+
si(this, l, o, T, h ? WQ(T, h + c) : c);
|
|
2604
2604
|
continue;
|
|
2605
2605
|
} else if (o === "smoothOrigin") {
|
|
2606
2606
|
MQ(this, l, "smooth", l.smooth, c);
|
|
@@ -2614,11 +2614,11 @@ var sP = {
|
|
|
2614
2614
|
}
|
|
2615
2615
|
} else o in i || (o = tB(o) || o);
|
|
2616
2616
|
if (U || (n || n === 0) && (T || T === 0) && !Ye.test(c) && o in i)
|
|
2617
|
-
E = (v + "").substr((T + "").length), n || (n = 0), k = W(c) || (o in sQ.units ? sQ.units[o] : E), E !== k && (T = fQ(Q, o, v, k)), this._pt = new BQ(this._pt, U ? l : i, o, T, (
|
|
2617
|
+
E = (v + "").substr((T + "").length), n || (n = 0), k = W(c) || (o in sQ.units ? sQ.units[o] : E), E !== k && (T = fQ(Q, o, v, k)), this._pt = new BQ(this._pt, U ? l : i, o, T, (h ? WQ(T, h + n) : n) - T, !U && (k === "px" || o === "zIndex") && B.autoRound !== !1 ? Xe : EA), this._pt.u = k || 0, U && C !== c ? (this._pt.b = v, this._pt.e = C, this._pt.r = Re) : E !== k && k !== "%" && (this._pt.b = v, this._pt.r = Je);
|
|
2618
2618
|
else if (o in i)
|
|
2619
|
-
ti.call(this, Q, o, v,
|
|
2619
|
+
ti.call(this, Q, o, v, h ? h + c : c);
|
|
2620
2620
|
else if (o in Q)
|
|
2621
|
-
this.add(Q, o, v || Q[o],
|
|
2621
|
+
this.add(Q, o, v || Q[o], h ? h + c : c, t, P);
|
|
2622
2622
|
else if (o !== "parseTransform") {
|
|
2623
2623
|
CA(o, c);
|
|
2624
2624
|
continue;
|
|
@@ -2674,11 +2674,11 @@ function oi(r) {
|
|
|
2674
2674
|
return 1 - Math.pow(1 - Q, 3);
|
|
2675
2675
|
}
|
|
2676
2676
|
function Ti(r) {
|
|
2677
|
-
const Q = Math.max(1e-3, r), B = Q * 1.6, A = Q * 0.7, t = new
|
|
2677
|
+
const Q = Math.max(1e-3, r), B = Q * 1.6, A = Q * 0.7, t = new a.ConeGeometry(A, B, 3, 1, !1);
|
|
2678
2678
|
return t.rotateX(-Math.PI / 2), t.translate(0, 0, B / 2), t;
|
|
2679
2679
|
}
|
|
2680
2680
|
function zi(r) {
|
|
2681
|
-
const B = Math.max(1e-3, r) * 0.65, A = new
|
|
2681
|
+
const B = Math.max(1e-3, r) * 0.65, A = new a.SphereGeometry(B, 18, 12);
|
|
2682
2682
|
return A.translate(0, 0, B), A;
|
|
2683
2683
|
}
|
|
2684
2684
|
function wi(r, Q) {
|
|
@@ -2688,14 +2688,14 @@ function wi(r, Q) {
|
|
|
2688
2688
|
const i = t.getX(e), s = t.getY(e), v = t.getZ(e);
|
|
2689
2689
|
P[e * 2] = Math.atan2(s, i) / (2 * Math.PI) + 0.5, P[e * 2 + 1] = (v - B.min.z) / A * Q;
|
|
2690
2690
|
}
|
|
2691
|
-
r.setAttribute("uv", new
|
|
2691
|
+
r.setAttribute("uv", new a.BufferAttribute(P, 2));
|
|
2692
2692
|
}
|
|
2693
2693
|
function cP(r) {
|
|
2694
2694
|
const Q = atob(ci), B = new Uint8Array(Q.length);
|
|
2695
2695
|
for (let v = 0; v < Q.length; v++) B[v] = Q.charCodeAt(v);
|
|
2696
2696
|
const t = new aP().parse(B.buffer);
|
|
2697
2697
|
t.rotateX(-Math.PI / 2), t.computeBoundingBox();
|
|
2698
|
-
const P = t.boundingBox, e = new
|
|
2698
|
+
const P = t.boundingBox, e = new a.Vector3();
|
|
2699
2699
|
P.getSize(e);
|
|
2700
2700
|
const i = Math.max(1e-3, r) * 1.6 / Math.max(e.x, e.y, e.z, 1e-3);
|
|
2701
2701
|
t.scale(i, i, i), t.computeBoundingBox();
|
|
@@ -2724,34 +2724,34 @@ function Ei() {
|
|
|
2724
2724
|
P.data[i] = Math.min(255, Math.max(0, P.data[i] + s)), P.data[i + 1] = P.data[i], P.data[i + 2] = P.data[i];
|
|
2725
2725
|
}
|
|
2726
2726
|
A.putImageData(P, 0, 0);
|
|
2727
|
-
const e = new
|
|
2728
|
-
return e.wrapS =
|
|
2727
|
+
const e = new a.CanvasTexture(B);
|
|
2728
|
+
return e.wrapS = a.RepeatWrapping, e.wrapT = a.RepeatWrapping, WB = e, e;
|
|
2729
2729
|
}
|
|
2730
2730
|
function ai(r, Q) {
|
|
2731
|
-
const B = Math.max(1e-3, r), A = B * 1.6, t = B * 0.08, P = B * 0.187, e = DB(Q), i = new
|
|
2731
|
+
const B = Math.max(1e-3, r), A = B * 1.6, t = B * 0.08, P = B * 0.187, e = DB(Q), i = new a.CylinderGeometry(0, t, A, 8, 1, !1);
|
|
2732
2732
|
i.rotateX(-Math.PI / 2), i.translate(0, 0, A / 2);
|
|
2733
|
-
const s = new
|
|
2733
|
+
const s = new a.CylinderGeometry(0, P, A, 8, 1, !0);
|
|
2734
2734
|
s.rotateX(-Math.PI / 2), s.translate(0, 0, A / 2);
|
|
2735
|
-
const v = new
|
|
2736
|
-
color: new
|
|
2735
|
+
const v = new a.MeshBasicMaterial({
|
|
2736
|
+
color: new a.Color(it),
|
|
2737
2737
|
transparent: !0,
|
|
2738
2738
|
opacity: e,
|
|
2739
2739
|
depthTest: !1,
|
|
2740
2740
|
depthWrite: !1,
|
|
2741
|
-
blending:
|
|
2742
|
-
}), c = new
|
|
2743
|
-
color: new
|
|
2741
|
+
blending: a.AdditiveBlending
|
|
2742
|
+
}), c = new a.MeshBasicMaterial({
|
|
2743
|
+
color: new a.Color(it),
|
|
2744
2744
|
transparent: !0,
|
|
2745
2745
|
opacity: e * 0.3,
|
|
2746
2746
|
depthTest: !1,
|
|
2747
2747
|
depthWrite: !1,
|
|
2748
|
-
blending:
|
|
2749
|
-
side:
|
|
2750
|
-
}), n = new
|
|
2748
|
+
blending: a.AdditiveBlending,
|
|
2749
|
+
side: a.DoubleSide
|
|
2750
|
+
}), n = new a.Mesh(i, v);
|
|
2751
2751
|
n.renderOrder = 1e3;
|
|
2752
|
-
const T = new
|
|
2752
|
+
const T = new a.Mesh(s, c);
|
|
2753
2753
|
T.renderOrder = 1e3;
|
|
2754
|
-
const z = new
|
|
2754
|
+
const z = new a.Group();
|
|
2755
2755
|
return z.add(n), z.add(T), z;
|
|
2756
2756
|
}
|
|
2757
2757
|
function hi(r) {
|
|
@@ -2762,7 +2762,7 @@ function nP(r) {
|
|
|
2762
2762
|
return r.bit.colorSource === "custom" ? r.bit.color : ni;
|
|
2763
2763
|
}
|
|
2764
2764
|
function ki(r) {
|
|
2765
|
-
const Q = DB(r.bit.opacity), B = cP(Math.max(1e-3, r.bit.size)), A = new
|
|
2765
|
+
const Q = DB(r.bit.opacity), B = cP(Math.max(1e-3, r.bit.size)), A = new a.Color(nP(r)), t = Ei(), P = new a.MeshStandardMaterial({
|
|
2766
2766
|
color: A,
|
|
2767
2767
|
metalness: 0.8,
|
|
2768
2768
|
roughness: 0.35,
|
|
@@ -2778,32 +2778,32 @@ function ki(r) {
|
|
|
2778
2778
|
opacity: Q,
|
|
2779
2779
|
depthTest: !1,
|
|
2780
2780
|
depthWrite: !1
|
|
2781
|
-
}), e = new
|
|
2781
|
+
}), e = new a.Mesh(B, P);
|
|
2782
2782
|
return e.renderOrder = 1e3, e;
|
|
2783
2783
|
}
|
|
2784
2784
|
function li(r) {
|
|
2785
|
-
const Q = DB(r.bit.opacity), B = hi(r), A = new
|
|
2786
|
-
color: new
|
|
2785
|
+
const Q = DB(r.bit.opacity), B = hi(r), A = new a.MeshBasicMaterial({
|
|
2786
|
+
color: new a.Color(vP),
|
|
2787
2787
|
transparent: Q < 1,
|
|
2788
2788
|
opacity: Q,
|
|
2789
|
-
side:
|
|
2789
|
+
side: a.DoubleSide,
|
|
2790
2790
|
depthTest: !1,
|
|
2791
2791
|
depthWrite: !1
|
|
2792
|
-
}), t = new
|
|
2792
|
+
}), t = new a.Mesh(B, A);
|
|
2793
2793
|
return t.renderOrder = 1e3, t;
|
|
2794
2794
|
}
|
|
2795
2795
|
function rt(r) {
|
|
2796
2796
|
return r.bit.type === "laser" ? ai(r.bit.size, r.bit.opacity) : r.bit.type === "drill" ? ki(r) : li(r);
|
|
2797
2797
|
}
|
|
2798
2798
|
function st(r) {
|
|
2799
|
-
if (r instanceof
|
|
2799
|
+
if (r instanceof a.Mesh)
|
|
2800
2800
|
r.geometry.dispose(), r.material.dispose();
|
|
2801
|
-
else if (r instanceof
|
|
2801
|
+
else if (r instanceof a.Group)
|
|
2802
2802
|
for (const Q of r.children)
|
|
2803
|
-
Q instanceof
|
|
2803
|
+
Q instanceof a.Mesh && (Q.geometry.dispose(), Q.material.dispose());
|
|
2804
2804
|
}
|
|
2805
2805
|
function Ui(r) {
|
|
2806
|
-
const Q = new
|
|
2806
|
+
const Q = new a.Group();
|
|
2807
2807
|
Q.name = "gviewer:bit-marker", Q.visible = !!r.bit.enabled;
|
|
2808
2808
|
let B = r, A = rt(B);
|
|
2809
2809
|
Q.add(A);
|
|
@@ -2820,15 +2820,15 @@ function Ui(r) {
|
|
|
2820
2820
|
};
|
|
2821
2821
|
e = s(B.bit.spinRpm);
|
|
2822
2822
|
const v = (n) => {
|
|
2823
|
-
const T = n.bit.type, z = B.bit.type, w = n.bit.size, o = B.bit.size, E = T !== z, k = w !== o,
|
|
2823
|
+
const T = n.bit.type, z = B.bit.type, w = n.bit.size, o = B.bit.size, E = T !== z, k = w !== o, h = DB(n.bit.opacity);
|
|
2824
2824
|
if (E || k)
|
|
2825
2825
|
Q.remove(A), st(A), A = rt(n), Q.add(A), i == null || i.kill(), e == null || e.kill(), e = s(n.bit.spinRpm), P && e.timeScale(1).play();
|
|
2826
2826
|
else if (T === "laser") {
|
|
2827
2827
|
const D = A, [l, O] = D.children, u = l.material, N = O.material;
|
|
2828
|
-
u.opacity =
|
|
2828
|
+
u.opacity = h, u.needsUpdate = !0, N.opacity = h * 0.3, N.needsUpdate = !0;
|
|
2829
2829
|
} else {
|
|
2830
|
-
const l = A.material, O = new
|
|
2831
|
-
l.color = O, T === "drill" && (l.emissive = O), l.opacity =
|
|
2830
|
+
const l = A.material, O = new a.Color(T === "drill" ? nP(n) : vP);
|
|
2831
|
+
l.color = O, T === "drill" && (l.emissive = O), l.opacity = h, l.transparent = h < 1, l.needsUpdate = !0;
|
|
2832
2832
|
}
|
|
2833
2833
|
B = n, Q.visible = !!n.bit.enabled;
|
|
2834
2834
|
};
|
|
@@ -2874,9 +2874,9 @@ function Ui(r) {
|
|
|
2874
2874
|
if (!t) return;
|
|
2875
2875
|
const T = (n - t.startedAt) / t.duration, z = oi(T);
|
|
2876
2876
|
Q.position.set(
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2877
|
+
a.MathUtils.lerp(t.from.x, t.to.x, z),
|
|
2878
|
+
a.MathUtils.lerp(t.from.y, t.to.y, z),
|
|
2879
|
+
a.MathUtils.lerp(t.from.z, t.to.z, z)
|
|
2880
2880
|
), T >= 1 && (Q.position.set(t.to.x, t.to.y, t.to.z), t = null);
|
|
2881
2881
|
},
|
|
2882
2882
|
dispose: () => {
|
|
@@ -2887,27 +2887,27 @@ function Ui(r) {
|
|
|
2887
2887
|
const Di = 25.4;
|
|
2888
2888
|
class Hi {
|
|
2889
2889
|
constructor(Q) {
|
|
2890
|
-
this.viewCube = null, this.resizeObserver = null, this.onWindowResize = null, this.animationFrameId = null, this.gridGroup = null, this.axesGroup = null, this.gridLabelsGroup = null, this.boundingBoxGroup = null, this.bitMarker = null, this.preLaserBitType = "drill", this.toolpathStreams = [], this.toolpathCutBucketCount = 1, this.toolpathRotationA = 0, this.sim3dHandle = null, this.currentLines = [], this.linePositions = null, this.renderSequence = 0, this.currentBounds = null, this.cameraFocusTransition = null, this.id = Q.id, this.container = Q.container, this.callbacks = Q.callbacks ?? {}, this.options = ct(NP, Q.options), this.canvas = document.createElement("canvas"), this.canvas.style.width = "100%", this.canvas.style.height = "100%", this.canvas.style.display = "block", this.container.appendChild(this.canvas), pP(this.container), this.renderer = new
|
|
2890
|
+
this.viewCube = null, this.resizeObserver = null, this.onWindowResize = null, this.animationFrameId = null, this.gridGroup = null, this.axesGroup = null, this.gridLabelsGroup = null, this.boundingBoxGroup = null, this.bitMarker = null, this.preLaserBitType = "drill", this.toolpathStreams = [], this.toolpathCutBucketCount = 1, this.toolpathRotationA = 0, this.lastBitPosition = { x: 0, y: 0, z: 0, a: 0 }, this.sim3dHandle = null, this.currentLines = [], this.linePositions = null, this.renderSequence = 0, this.currentBounds = null, this.cameraFocusTransition = null, this.id = Q.id, this.container = Q.container, this.callbacks = Q.callbacks ?? {}, this.options = ct(NP, Q.options), this.canvas = document.createElement("canvas"), this.canvas.style.width = "100%", this.canvas.style.height = "100%", this.canvas.style.display = "block", this.container.appendChild(this.canvas), pP(this.container), this.renderer = new a.WebGLRenderer({
|
|
2891
2891
|
canvas: this.canvas,
|
|
2892
2892
|
antialias: this.options.render.antialias
|
|
2893
|
-
}), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setClearColor(this.options.render.theme.background, 1), this.scene = new
|
|
2894
|
-
const B = new
|
|
2893
|
+
}), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setClearColor(this.options.render.theme.background, 1), this.scene = new a.Scene(), this.scene.add(new a.AmbientLight(16777215, 0.8));
|
|
2894
|
+
const B = new a.DirectionalLight(16777215, 0.9);
|
|
2895
2895
|
B.position.set(1, -1, 1.5), this.scene.add(B);
|
|
2896
|
-
const A = new
|
|
2897
|
-
A.position.set(-1, 1, 1), this.scene.add(A), this.toolpathRoot = new
|
|
2896
|
+
const A = new a.DirectionalLight(16777215, 0.5);
|
|
2897
|
+
A.position.set(-1, 1, 1), this.scene.add(A), this.toolpathRoot = new a.Group(), this.toolpathRoot.name = "gviewer:toolpath-root", this.scene.add(this.toolpathRoot), this.camera = new a.PerspectiveCamera(this.options.camera.fov, 1, 0.1, 1e5), this.camera.up.set(0, 0, 1), this.camera.position.set(
|
|
2898
2898
|
this.options.camera.initialPosition.x,
|
|
2899
2899
|
this.options.camera.initialPosition.y,
|
|
2900
2900
|
this.options.camera.initialPosition.z
|
|
2901
|
-
), this.controls = new oP(this.camera, this.renderer.domElement), this.controls.enableDamping = this.options.camera.orbit.enableDamping, this.controls.update(), this.viewCubeCorrection = new
|
|
2901
|
+
), this.controls = new oP(this.camera, this.renderer.domElement), this.controls.enableDamping = this.options.camera.orbit.enableDamping, this.controls.update(), this.viewCubeCorrection = new a.Matrix4().makeRotationX(a.MathUtils.degToRad(90)), this.viewCube = new jP({
|
|
2902
2902
|
container: this.container,
|
|
2903
2903
|
onSelectView: (t) => {
|
|
2904
|
-
const P = new
|
|
2904
|
+
const P = new a.Vector3();
|
|
2905
2905
|
let e;
|
|
2906
2906
|
if (this.currentBounds) {
|
|
2907
2907
|
this.currentBounds.getCenter(P);
|
|
2908
|
-
const i = new
|
|
2908
|
+
const i = new a.Vector3();
|
|
2909
2909
|
this.currentBounds.getSize(i);
|
|
2910
|
-
const s = Math.max(i.x, i.y, 1) / 2, v =
|
|
2910
|
+
const s = Math.max(i.x, i.y, 1) / 2, v = a.MathUtils.degToRad(this.camera.fov);
|
|
2911
2911
|
e = s / Math.tan(v / 2) * 1.25 + i.z;
|
|
2912
2912
|
} else
|
|
2913
2913
|
e = this.camera.position.distanceTo(this.controls.target);
|
|
@@ -2917,7 +2917,7 @@ class Hi {
|
|
|
2917
2917
|
}
|
|
2918
2918
|
setBitPosition(Q, B) {
|
|
2919
2919
|
var A;
|
|
2920
|
-
this.ensureBitMarker(), (A = this.bitMarker) == null || A.setTarget(Q, B);
|
|
2920
|
+
this.ensureBitMarker(), this.lastBitPosition = { ...this.lastBitPosition, ...Q }, (A = this.bitMarker) == null || A.setTarget(Q, B);
|
|
2921
2921
|
}
|
|
2922
2922
|
setBitVisible(Q) {
|
|
2923
2923
|
var B;
|
|
@@ -2929,7 +2929,7 @@ class Hi {
|
|
|
2929
2929
|
}
|
|
2930
2930
|
setToolpathRotationA(Q) {
|
|
2931
2931
|
const B = Number(Q) || 0;
|
|
2932
|
-
this.toolpathRotationA = B, this.toolpathRoot.rotation.x =
|
|
2932
|
+
this.toolpathRotationA = B, this.toolpathRoot.rotation.x = a.MathUtils.degToRad(B);
|
|
2933
2933
|
}
|
|
2934
2934
|
setCallbacks(Q) {
|
|
2935
2935
|
this.callbacks = Q;
|
|
@@ -2974,6 +2974,44 @@ class Hi {
|
|
|
2974
2974
|
const A = Math.max(0, Math.floor(B.durationMs ?? 240)), t = this.controls.target.clone(), P = this.camera.position.distanceTo(t), e = Math.max(1e-6, B.distance ?? P);
|
|
2975
2975
|
this.startSnapToView(Q, t, e, A);
|
|
2976
2976
|
}
|
|
2977
|
+
/**
|
|
2978
|
+
* Enable or disable orbit *rotation* while leaving pan and zoom untouched.
|
|
2979
|
+
*
|
|
2980
|
+
* Used to pin the camera to a fixed view (e.g. top-down) so a press-and-hold
|
|
2981
|
+
* gesture is not interpreted as a rotate-drag and the picked plane stays
|
|
2982
|
+
* stable under the cursor. Picking (screenToWorld) works from any camera
|
|
2983
|
+
* orientation, so this is a UX lock, not a correctness requirement.
|
|
2984
|
+
*/
|
|
2985
|
+
setRotateEnabled(Q) {
|
|
2986
|
+
this.controls.enableRotate = Q;
|
|
2987
|
+
}
|
|
2988
|
+
/**
|
|
2989
|
+
* Convert a viewport pixel (clientX/clientY, e.g. from a PointerEvent) into a
|
|
2990
|
+
* point on a horizontal toolpath plane, in the scene's coordinate space.
|
|
2991
|
+
*
|
|
2992
|
+
* A ray is cast from the camera through the pixel and intersected with the
|
|
2993
|
+
* plane Z = `planeZ`, which defaults to the bit's current Z so the pick lands
|
|
2994
|
+
* on the plane the tool is sitting on. Returns null when the pixel is outside
|
|
2995
|
+
* a laid-out canvas or the ray is parallel to the plane (no intersection).
|
|
2996
|
+
*
|
|
2997
|
+
* The result is in world/scene space. The toolpath root sits at the origin,
|
|
2998
|
+
* so for a normal (non-rotary) file this equals the gcode work coordinate.
|
|
2999
|
+
* For a rotary file the toolpath root is rotated about X, so the returned XY
|
|
3000
|
+
* is not a meaningful work coordinate — callers supporting only XY moves
|
|
3001
|
+
* should gate on file type.
|
|
3002
|
+
*/
|
|
3003
|
+
screenToWorld(Q, B, A) {
|
|
3004
|
+
const t = this.canvas.getBoundingClientRect();
|
|
3005
|
+
if (t.width === 0 || t.height === 0)
|
|
3006
|
+
return null;
|
|
3007
|
+
const P = new a.Vector2(
|
|
3008
|
+
(Q - t.left) / t.width * 2 - 1,
|
|
3009
|
+
-((B - t.top) / t.height) * 2 + 1
|
|
3010
|
+
), e = new a.Raycaster();
|
|
3011
|
+
e.setFromCamera(P, this.camera);
|
|
3012
|
+
const i = (A == null ? void 0 : A.planeZ) ?? this.lastBitPosition.z ?? 0, s = new a.Plane(new a.Vector3(0, 0, 1), -i), v = new a.Vector3();
|
|
3013
|
+
return e.ray.intersectPlane(s, v) ? { x: v.x, y: v.y, z: v.z } : null;
|
|
3014
|
+
}
|
|
2977
3015
|
startSnapToView(Q, B, A, t) {
|
|
2978
3016
|
const P = mA(Q), e = B.clone().add(P.multiplyScalar(A)), i = Math.max(1, A);
|
|
2979
3017
|
this.camera.near = i / 1e3, this.camera.far = i * 50, this.camera.updateProjectionMatrix(), this.cameraFocusTransition && (this.controls.enableDamping = this.cameraFocusTransition.dampingEnabled), this.cameraFocusTransition = {
|
|
@@ -3302,11 +3340,11 @@ class Hi {
|
|
|
3302
3340
|
IB(e, P), this.setSim3dHandle({ data: t, slab: e, currentLine: 0 });
|
|
3303
3341
|
}
|
|
3304
3342
|
startCameraFocus(Q) {
|
|
3305
|
-
const B = new
|
|
3343
|
+
const B = new a.Vector3();
|
|
3306
3344
|
Q.getCenter(B);
|
|
3307
|
-
const A = new
|
|
3345
|
+
const A = new a.Vector3();
|
|
3308
3346
|
Q.getSize(A);
|
|
3309
|
-
const t = Math.max(A.x, A.y, 1) / 2, P =
|
|
3347
|
+
const t = Math.max(A.x, A.y, 1) / 2, P = a.MathUtils.degToRad(this.camera.fov), e = t / Math.tan(P / 2) * 1.25 + A.z, i = mA("front-top-left"), s = B.clone().add(i.multiplyScalar(e)), v = Math.max(A.x, A.y, A.z, 1);
|
|
3310
3348
|
this.camera.near = v / 1e3, this.camera.far = v * 50, this.camera.updateProjectionMatrix(), this.cameraFocusTransition && (this.controls.enableDamping = this.cameraFocusTransition.dampingEnabled), this.cameraFocusTransition = {
|
|
3311
3349
|
startedAt: performance.now(),
|
|
3312
3350
|
duration: this.options.camera.focusDurationMs,
|
|
@@ -3331,7 +3369,7 @@ class Hi {
|
|
|
3331
3369
|
return;
|
|
3332
3370
|
const Q = this.camera.quaternion.clone();
|
|
3333
3371
|
typeof Q.invert == "function" ? Q.invert() : typeof Q.inverse == "function" && Q.inverse();
|
|
3334
|
-
const B = new
|
|
3372
|
+
const B = new a.Matrix4();
|
|
3335
3373
|
B.makeRotationFromQuaternion(Q), B.multiply(this.viewCubeCorrection), this.viewCube.setRotationMatrix3d(B.elements);
|
|
3336
3374
|
const A = mP(this.camera.position, this.controls.target);
|
|
3337
3375
|
this.viewCube.setActiveFace(A);
|
|
@@ -3429,11 +3467,11 @@ class ji {
|
|
|
3429
3467
|
if (this.activePointers.set(A.pointerId, { x: A.clientX, y: A.clientY }), this.activePointers.size === 2) {
|
|
3430
3468
|
const [i, s] = Array.from(this.activePointers.values()), v = Math.hypot(s.x - i.x, s.y - i.y), c = { x: (i.x + s.x) / 2, y: (i.y + s.y) / 2 };
|
|
3431
3469
|
if (this.pinchLastDist > 0) {
|
|
3432
|
-
const w = this.pinchLastDist / v, o = this.svgPoint(c.x, c.y), { x: E, y: k, w:
|
|
3470
|
+
const w = this.pinchLastDist / v, o = this.svgPoint(c.x, c.y), { x: E, y: k, w: h, h: U } = this.viewBox;
|
|
3433
3471
|
this.viewBox = {
|
|
3434
3472
|
x: o.x - (o.x - E) * w,
|
|
3435
3473
|
y: o.y - (o.y - k) * w,
|
|
3436
|
-
w:
|
|
3474
|
+
w: h * w,
|
|
3437
3475
|
h: U * w
|
|
3438
3476
|
};
|
|
3439
3477
|
}
|
|
@@ -3592,7 +3630,7 @@ class ji {
|
|
|
3592
3630
|
this.viewBox = { x: -50, y: -50, w: 100, h: 100 };
|
|
3593
3631
|
return;
|
|
3594
3632
|
}
|
|
3595
|
-
const { minX: Q, maxX: B, minY: A, maxY: t, minZ: P, maxZ: e } = this.bounds, i = this.project, s = i(Q, A, P), v = i(B, A, P), c = i(B, t, P), n = i(Q, t, P), T = i(Q, A, e), z = i(B, A, e), w = i(B, t, e), o = i(Q, t, e), E = Math.hypot(v.x - s.x, v.y - s.y), k = Math.hypot(n.x - s.x, n.y - s.y),
|
|
3633
|
+
const { minX: Q, maxX: B, minY: A, maxY: t, minZ: P, maxZ: e } = this.bounds, i = this.project, s = i(Q, A, P), v = i(B, A, P), c = i(B, t, P), n = i(Q, t, P), T = i(Q, A, e), z = i(B, A, e), w = i(B, t, e), o = i(Q, t, e), E = Math.hypot(v.x - s.x, v.y - s.y), k = Math.hypot(n.x - s.x, n.y - s.y), h = Math.hypot(T.x - s.x, T.y - s.y), U = Math.max(E, k, h) * 0.07, D = U * 0.5, l = nt(rB(s, v), rB(c, n), D), O = [s, v, c, n, T, z, w, o], u = Math.min(...O.map((R) => R.y)), N = Math.max(...O.map((R) => R.y)), C = Math.min(...O.map((R) => R.x)), M = Math.max(...O.map((R) => R.x)), b = { x: M + D, y: (u + N) / 2 }, j = { x: b.x + U * 5, y: b.y }, d = { x: (C + M) / 2, y: u - U }, G = [s, v, c, n, T, z, w, o, l, b, j, d];
|
|
3596
3634
|
let f = 1 / 0, H = 1 / 0, F = -1 / 0, X = -1 / 0;
|
|
3597
3635
|
for (const R of G)
|
|
3598
3636
|
R.x < f && (f = R.x), R.y < H && (H = R.y), R.x > F && (F = R.x), R.y > X && (X = R.y);
|
|
@@ -3629,7 +3667,7 @@ class ji {
|
|
|
3629
3667
|
`M${L(n.x)} ${L(n.y)}L${L(o.x)} ${L(o.y)}`
|
|
3630
3668
|
].join("");
|
|
3631
3669
|
this.bboxPath.setAttribute("d", E);
|
|
3632
|
-
const k = Math.hypot(v.x - s.x, v.y - s.y),
|
|
3670
|
+
const k = Math.hypot(v.x - s.x, v.y - s.y), h = Math.hypot(n.x - s.x, n.y - s.y), U = Math.hypot(T.x - s.x, T.y - s.y), D = Math.max(k, h, U) * 0.07, l = D * 0.5;
|
|
3633
3671
|
$B(this.bboxLabelX, rB(s, v), nt(rB(s, v), rB(c, n), l), D, `X: ${QA(B - Q)}`);
|
|
3634
3672
|
const O = [s, v, c, n, T, z, w, o], u = Math.min(...O.map((d) => d.y)), N = Math.max(...O.map((d) => d.y)), C = Math.min(...O.map((d) => d.x)), M = Math.max(...O.map((d) => d.x)), b = { x: M + l, y: (u + N) / 2 };
|
|
3635
3673
|
$B(this.bboxLabelY, b, b, D, `Y: ${QA(t - A)}`);
|