gl-draw 0.14.34 → 0.14.35
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/index.js +2 -2
- package/dist/index.module.js +214 -213
- package/dist/objects/extrudePolygon/ExtrudeGeometry.d.ts +90 -6
- package/dist/objects/extrudePolygon/createGeometry.d.ts +64 -2
- package/dist/objects/index.js +1 -1
- package/dist/objects/index.module.js +542 -589
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +28 -28
- package/dist/utils/mergeGeometries.d.ts +10 -0
- package/package.json +1 -1
- package/dist/utils/BufferGeometryUtils.d.ts +0 -62
package/dist/index.module.js
CHANGED
|
@@ -13,18 +13,18 @@ var Se = (l, e, t) => e in l ? _t(l, e, { enumerable: !0, configurable: !0, writ
|
|
|
13
13
|
var J = (l, e, t) => new Promise((s, i) => {
|
|
14
14
|
var r = (h) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
16
|
+
a(t.next(h));
|
|
17
17
|
} catch (d) {
|
|
18
18
|
i(d);
|
|
19
19
|
}
|
|
20
20
|
}, o = (h) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
22
|
+
a(t.throw(h));
|
|
23
23
|
} catch (d) {
|
|
24
24
|
i(d);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, a = (h) => h.done ? s(h.value) : Promise.resolve(h.value).then(r, o);
|
|
27
|
+
a((t = t.apply(l, e)).next());
|
|
28
28
|
});
|
|
29
29
|
import * as O from "three";
|
|
30
30
|
import { Vector3 as oe, Quaternion as Et, Matrix4 as fe, UniformsUtils as Ot, RawShaderMaterial as Tt } from "three";
|
|
@@ -49,6 +49,7 @@ import "three/examples/jsm/renderers/CSS3DRenderer";
|
|
|
49
49
|
import "d3-geo";
|
|
50
50
|
import "d3-geo-projection";
|
|
51
51
|
import "three/examples/jsm/lights/RectAreaLightUniformsLib";
|
|
52
|
+
import "three/examples/jsm/utils/BufferGeometryUtils";
|
|
52
53
|
import "three/examples/jsm/lines/LineSegments2";
|
|
53
54
|
import "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
54
55
|
import "three/examples/jsm/lines/LineMaterial";
|
|
@@ -116,7 +117,7 @@ function se(l) {
|
|
|
116
117
|
}
|
|
117
118
|
function he(l, e, t, s, i = 1 / 0, r) {
|
|
118
119
|
s = Math.max(1e-4, s);
|
|
119
|
-
const o = 2 / s,
|
|
120
|
+
const o = 2 / s, a = o * r, h = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
|
|
120
121
|
let d = l - e;
|
|
121
122
|
const f = e, p = i * s;
|
|
122
123
|
d = F(d, -p, p), e = l - d;
|
|
@@ -127,18 +128,18 @@ function he(l, e, t, s, i = 1 / 0, r) {
|
|
|
127
128
|
}
|
|
128
129
|
function Fe(l, e, t, s, i = 1 / 0, r, o) {
|
|
129
130
|
s = Math.max(1e-4, s);
|
|
130
|
-
const
|
|
131
|
+
const a = 2 / s, h = a * r, d = 1 / (1 + h + 0.48 * h * h + 0.235 * h * h * h);
|
|
131
132
|
let f = e.x, p = e.y, C = e.z, v = l.x - f, m = l.y - p, u = l.z - C;
|
|
132
|
-
const g = f,
|
|
133
|
+
const g = f, n = p, _ = C, E = i * s, y = E * E, w = v * v + m * m + u * u;
|
|
133
134
|
if (w > y) {
|
|
134
135
|
const ve = Math.sqrt(w);
|
|
135
136
|
v = v / ve * E, m = m / ve * E, u = u / ve * E;
|
|
136
137
|
}
|
|
137
138
|
f = l.x - v, p = l.y - m, C = l.z - u;
|
|
138
|
-
const T = (t.x +
|
|
139
|
-
t.x = (t.x -
|
|
140
|
-
const V = g - l.x, ae =
|
|
141
|
-
return V * mt + ae * ut + pt * ft > 0 && (o.x = g, o.y =
|
|
139
|
+
const T = (t.x + a * v) * r, P = (t.y + a * m) * r, R = (t.z + a * u) * r;
|
|
140
|
+
t.x = (t.x - a * T) * d, t.y = (t.y - a * P) * d, t.z = (t.z - a * R) * d, o.x = f + (v + T) * d, o.y = p + (m + P) * d, o.z = C + (u + R) * d;
|
|
141
|
+
const V = g - l.x, ae = n - l.y, pt = _ - l.z, mt = o.x - g, ut = o.y - n, ft = o.z - _;
|
|
142
|
+
return V * mt + ae * ut + pt * ft > 0 && (o.x = g, o.y = n, o.z = _, t.x = (o.x - g) / r, t.y = (o.y - n) / r, t.z = (o.z - _) / r), o;
|
|
142
143
|
}
|
|
143
144
|
function Ce(l, e) {
|
|
144
145
|
e.set(0, 0), l.forEach((t) => {
|
|
@@ -284,14 +285,14 @@ class $ extends Yt {
|
|
|
284
285
|
*/
|
|
285
286
|
constructor(e, t) {
|
|
286
287
|
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.boundaryFriction = 0, this.restThreshold = 0.01, this.colliderMeshes = [], this.cancel = () => {
|
|
287
|
-
}, this._enabled = !0, this._state = c.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 = Z.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new x.Vector3(), this._focalOffsetVelocity = new x.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (
|
|
288
|
+
}, this._enabled = !0, this._state = c.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 = Z.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new x.Vector3(), this._focalOffsetVelocity = new x.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (n, _, E, y) => {
|
|
288
289
|
let w, T;
|
|
289
290
|
if (B(this._camera)) {
|
|
290
291
|
const P = b.copy(this._camera.position).sub(this._target), R = this._camera.getEffectiveFOV() * ee, V = P.length() * Math.tan(R * 0.5);
|
|
291
|
-
w = this.truckSpeed *
|
|
292
|
+
w = this.truckSpeed * n * V / this._elementRect.height, T = this.truckSpeed * _ * V / this._elementRect.height;
|
|
292
293
|
} else if (j(this._camera)) {
|
|
293
294
|
const P = this._camera;
|
|
294
|
-
w = this.truckSpeed *
|
|
295
|
+
w = this.truckSpeed * n * (P.right - P.left) / P.zoom / this._elementRect.width, T = this.truckSpeed * _ * (P.top - P.bottom) / P.zoom / this._elementRect.height;
|
|
295
296
|
} else
|
|
296
297
|
return;
|
|
297
298
|
y ? (E ? this.setFocalOffset(
|
|
@@ -305,18 +306,18 @@ class $ extends Yt {
|
|
|
305
306
|
this._focalOffsetEnd.z,
|
|
306
307
|
!0
|
|
307
308
|
) : this.truck(w, T, !0);
|
|
308
|
-
}, this._rotateInternal = (
|
|
309
|
-
const E = W * this.azimuthRotateSpeed *
|
|
309
|
+
}, this._rotateInternal = (n, _) => {
|
|
310
|
+
const E = W * this.azimuthRotateSpeed * n / this._elementRect.height, y = W * this.polarRotateSpeed * _ / this._elementRect.height;
|
|
310
311
|
this.rotate(E, y, !0);
|
|
311
|
-
}, this._dollyInternal = (
|
|
312
|
-
const y = Math.pow(0.95, -
|
|
312
|
+
}, this._dollyInternal = (n, _, E) => {
|
|
313
|
+
const y = Math.pow(0.95, -n * this.dollySpeed), w = this._sphericalEnd.radius, T = this._sphericalEnd.radius * y, P = F(
|
|
313
314
|
T,
|
|
314
315
|
this.minDistance,
|
|
315
316
|
this.maxDistance
|
|
316
317
|
), R = P - T;
|
|
317
|
-
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(T, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(R, !0), this._dollyToNoClamp(P, !0)) : this._dollyToNoClamp(P, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? T : P) - w, this._dollyControlCoord.set(_, E)), this._lastDollyDirection = Math.sign(-
|
|
318
|
-
}, this._zoomInternal = (
|
|
319
|
-
const y = Math.pow(0.95,
|
|
318
|
+
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(T, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(R, !0), this._dollyToNoClamp(P, !0)) : this._dollyToNoClamp(P, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? T : P) - w, this._dollyControlCoord.set(_, E)), this._lastDollyDirection = Math.sign(-n);
|
|
319
|
+
}, this._zoomInternal = (n, _, E) => {
|
|
320
|
+
const y = Math.pow(0.95, n * this.dollySpeed), w = this._zoom, T = this._zoom * y;
|
|
320
321
|
this.zoomTo(T, !0), this.dollyToCursor && (this._changedZoom += T - w, this._dollyControlCoord.set(_, E));
|
|
321
322
|
}, typeof x == "undefined" && console.error(
|
|
322
323
|
"camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."
|
|
@@ -343,45 +344,45 @@ class $ extends Yt {
|
|
|
343
344
|
two: B(this._camera) ? c.TOUCH_DOLLY_TRUCK : j(this._camera) ? c.TOUCH_ZOOM_TRUCK : c.NONE,
|
|
344
345
|
three: c.TOUCH_TRUCK
|
|
345
346
|
};
|
|
346
|
-
const s = new x.Vector2(), i = new x.Vector2(), r = new x.Vector2(), o = (
|
|
347
|
+
const s = new x.Vector2(), i = new x.Vector2(), r = new x.Vector2(), o = (n) => {
|
|
347
348
|
if (!this._enabled || !this._domElement) return;
|
|
348
349
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
349
|
-
const y = this._domElement.getBoundingClientRect(), w = (
|
|
350
|
+
const y = this._domElement.getBoundingClientRect(), w = (n.clientX - y.left) / (y.right - y.left), T = (n.clientY - y.top) / (y.bottom - y.top);
|
|
350
351
|
if (w < this._interactiveArea.left || w > this._interactiveArea.right || T < this._interactiveArea.top || T > this._interactiveArea.bottom)
|
|
351
352
|
return;
|
|
352
353
|
}
|
|
353
|
-
const _ =
|
|
354
|
+
const _ = n.pointerType !== "mouse" ? null : (n.buttons & D.LEFT) === D.LEFT ? D.LEFT : (n.buttons & D.MIDDLE) === D.MIDDLE ? D.MIDDLE : (n.buttons & D.RIGHT) === D.RIGHT ? D.RIGHT : null;
|
|
354
355
|
if (_ !== null) {
|
|
355
356
|
const y = this._findPointerByMouseButton(_);
|
|
356
357
|
y && this._disposePointer(y);
|
|
357
358
|
}
|
|
358
|
-
if ((
|
|
359
|
+
if ((n.buttons & D.LEFT) === D.LEFT && this._lockedPointer)
|
|
359
360
|
return;
|
|
360
361
|
const E = {
|
|
361
|
-
pointerId:
|
|
362
|
-
clientX:
|
|
363
|
-
clientY:
|
|
362
|
+
pointerId: n.pointerId,
|
|
363
|
+
clientX: n.clientX,
|
|
364
|
+
clientY: n.clientY,
|
|
364
365
|
deltaX: 0,
|
|
365
366
|
deltaY: 0,
|
|
366
367
|
mouseButton: _
|
|
367
368
|
};
|
|
368
369
|
this._activePointers.push(E), this._domElement.ownerDocument.removeEventListener(
|
|
369
370
|
"pointermove",
|
|
370
|
-
|
|
371
|
+
a,
|
|
371
372
|
{ passive: !1 }
|
|
372
373
|
), this._domElement.ownerDocument.removeEventListener(
|
|
373
374
|
"pointerup",
|
|
374
375
|
h
|
|
375
376
|
), this._domElement.ownerDocument.addEventListener(
|
|
376
377
|
"pointermove",
|
|
377
|
-
|
|
378
|
+
a,
|
|
378
379
|
{ passive: !1 }
|
|
379
|
-
), this._domElement.ownerDocument.addEventListener("pointerup", h), this._isDragging = !0, C(
|
|
380
|
-
},
|
|
381
|
-
|
|
382
|
-
const _ =
|
|
380
|
+
), this._domElement.ownerDocument.addEventListener("pointerup", h), this._isDragging = !0, C(n);
|
|
381
|
+
}, a = (n) => {
|
|
382
|
+
n.cancelable && n.preventDefault();
|
|
383
|
+
const _ = n.pointerId, E = this._lockedPointer || this._findPointerById(_);
|
|
383
384
|
if (E) {
|
|
384
|
-
if (E.clientX =
|
|
385
|
+
if (E.clientX = n.clientX, E.clientY = n.clientY, E.deltaX = n.movementX, E.deltaY = n.movementY, this._state = 0, n.pointerType === "touch")
|
|
385
386
|
switch (this._activePointers.length) {
|
|
386
387
|
case 1:
|
|
387
388
|
this._state = this.touches.one;
|
|
@@ -394,13 +395,13 @@ class $ extends Yt {
|
|
|
394
395
|
break;
|
|
395
396
|
}
|
|
396
397
|
else
|
|
397
|
-
(!this._isDragging && this._lockedPointer || this._isDragging && (
|
|
398
|
+
(!this._isDragging && this._lockedPointer || this._isDragging && (n.buttons & D.LEFT) === D.LEFT) && (this._state = this._state | this.mouseButtons.left), this._isDragging && (n.buttons & D.MIDDLE) === D.MIDDLE && (this._state = this._state | this.mouseButtons.middle), this._isDragging && (n.buttons & D.RIGHT) === D.RIGHT && (this._state = this._state | this.mouseButtons.right);
|
|
398
399
|
v();
|
|
399
400
|
}
|
|
400
|
-
}, h = (
|
|
401
|
-
const _ = this._findPointerById(
|
|
401
|
+
}, h = (n) => {
|
|
402
|
+
const _ = this._findPointerById(n.pointerId);
|
|
402
403
|
if (!(_ && _ === this._lockedPointer)) {
|
|
403
|
-
if (_ && this._disposePointer(_),
|
|
404
|
+
if (_ && this._disposePointer(_), n.pointerType === "touch")
|
|
404
405
|
switch (this._activePointers.length) {
|
|
405
406
|
case 0:
|
|
406
407
|
this._state = c.NONE;
|
|
@@ -421,33 +422,33 @@ class $ extends Yt {
|
|
|
421
422
|
}
|
|
422
423
|
};
|
|
423
424
|
let d = -1;
|
|
424
|
-
const f = (
|
|
425
|
+
const f = (n) => {
|
|
425
426
|
if (!this._domElement || !this._enabled || this.mouseButtons.wheel === c.NONE) return;
|
|
426
427
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
427
|
-
const T = this._domElement.getBoundingClientRect(), P = (
|
|
428
|
+
const T = this._domElement.getBoundingClientRect(), P = (n.clientX - T.left) / (T.right - T.left), R = (n.clientY - T.top) / (T.bottom - T.top);
|
|
428
429
|
if (P < this._interactiveArea.left || P > this._interactiveArea.right || R < this._interactiveArea.top || R > this._interactiveArea.bottom)
|
|
429
430
|
return;
|
|
430
431
|
}
|
|
431
|
-
if (
|
|
432
|
+
if (n.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === c.ROTATE || this.mouseButtons.wheel === c.TRUCK) {
|
|
432
433
|
const T = performance.now();
|
|
433
434
|
d - T < 1e3 && this._getClientRect(this._elementRect), d = T;
|
|
434
435
|
}
|
|
435
|
-
const _ = Zt ? -1 : -3, E =
|
|
436
|
+
const _ = Zt ? -1 : -3, E = n.deltaMode === 1 || n.ctrlKey ? n.deltaY / _ : n.deltaY / (_ * 10), y = this.dollyToCursor ? (n.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, w = this.dollyToCursor ? (n.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
436
437
|
switch (this.mouseButtons.wheel) {
|
|
437
438
|
case c.ROTATE: {
|
|
438
|
-
this._rotateInternal(
|
|
439
|
+
this._rotateInternal(n.deltaX, n.deltaY), this._isUserControllingRotate = !0;
|
|
439
440
|
break;
|
|
440
441
|
}
|
|
441
442
|
case c.TRUCK: {
|
|
442
|
-
this._truckInternal(
|
|
443
|
+
this._truckInternal(n.deltaX, n.deltaY, !1, !1), this._isUserControllingTruck = !0;
|
|
443
444
|
break;
|
|
444
445
|
}
|
|
445
446
|
case c.SCREEN_PAN: {
|
|
446
|
-
this._truckInternal(
|
|
447
|
+
this._truckInternal(n.deltaX, n.deltaY, !1, !0), this._isUserControllingTruck = !0;
|
|
447
448
|
break;
|
|
448
449
|
}
|
|
449
450
|
case c.OFFSET: {
|
|
450
|
-
this._truckInternal(
|
|
451
|
+
this._truckInternal(n.deltaX, n.deltaY, !0, !1), this._isUserControllingOffset = !0;
|
|
451
452
|
break;
|
|
452
453
|
}
|
|
453
454
|
case c.DOLLY: {
|
|
@@ -460,13 +461,13 @@ class $ extends Yt {
|
|
|
460
461
|
}
|
|
461
462
|
}
|
|
462
463
|
this.dispatchEvent({ type: "control" });
|
|
463
|
-
}, p = (
|
|
464
|
+
}, p = (n) => {
|
|
464
465
|
if (!(!this._domElement || !this._enabled)) {
|
|
465
466
|
if (this.mouseButtons.right === $.ACTION.NONE) {
|
|
466
|
-
const _ =
|
|
467
|
+
const _ = n instanceof PointerEvent ? n.pointerId : 0, E = this._findPointerById(_);
|
|
467
468
|
E && this._disposePointer(E), this._domElement.ownerDocument.removeEventListener(
|
|
468
469
|
"pointermove",
|
|
469
|
-
|
|
470
|
+
a,
|
|
470
471
|
{ passive: !1 }
|
|
471
472
|
), this._domElement.ownerDocument.removeEventListener(
|
|
472
473
|
"pointerup",
|
|
@@ -474,9 +475,9 @@ class $ extends Yt {
|
|
|
474
475
|
);
|
|
475
476
|
return;
|
|
476
477
|
}
|
|
477
|
-
|
|
478
|
+
n.preventDefault();
|
|
478
479
|
}
|
|
479
|
-
}, C = (
|
|
480
|
+
}, C = (n) => {
|
|
480
481
|
if (!this._enabled) return;
|
|
481
482
|
if (Ce(this._activePointers, U), this._getClientRect(this._elementRect), s.copy(U), i.copy(U), this._activePointers.length >= 2) {
|
|
482
483
|
const E = U.x - this._activePointers[1].clientX, y = U.y - this._activePointers[1].clientY, w = Math.sqrt(E * E + y * y);
|
|
@@ -484,9 +485,9 @@ class $ extends Yt {
|
|
|
484
485
|
const T = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, P = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
|
|
485
486
|
i.set(T, P);
|
|
486
487
|
}
|
|
487
|
-
if (this._state = 0, !
|
|
488
|
+
if (this._state = 0, !n)
|
|
488
489
|
this._lockedPointer && (this._state = this._state | this.mouseButtons.left);
|
|
489
|
-
else if ("pointerType" in
|
|
490
|
+
else if ("pointerType" in n && n.pointerType === "touch")
|
|
490
491
|
switch (this._activePointers.length) {
|
|
491
492
|
case 1:
|
|
492
493
|
this._state = this.touches.one;
|
|
@@ -499,7 +500,7 @@ class $ extends Yt {
|
|
|
499
500
|
break;
|
|
500
501
|
}
|
|
501
502
|
else
|
|
502
|
-
!this._lockedPointer && (
|
|
503
|
+
!this._lockedPointer && (n.buttons & D.LEFT) === D.LEFT && (this._state = this._state | this.mouseButtons.left), (n.buttons & D.MIDDLE) === D.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (n.buttons & D.RIGHT) === D.RIGHT && (this._state = this._state | this.mouseButtons.right);
|
|
503
504
|
((this._state & c.ROTATE) === c.ROTATE || (this._state & c.TOUCH_ROTATE) === c.TOUCH_ROTATE || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_ZOOM_ROTATE) === c.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 & c.TRUCK) === c.TRUCK || (this._state & c.SCREEN_PAN) === c.SCREEN_PAN || (this._state & c.TOUCH_TRUCK) === c.TOUCH_TRUCK || (this._state & c.TOUCH_SCREEN_PAN) === c.TOUCH_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK || (this._state & c.TOUCH_ZOOM_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN) && (this._targetEnd.copy(this._target), this._targetVelocity.set(0, 0, 0)), ((this._state & c.DOLLY) === c.DOLLY || (this._state & c.TOUCH_DOLLY) === c.TOUCH_DOLLY || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE) && (this._sphericalEnd.radius = this._spherical.radius, this._radiusVelocity.value = 0), ((this._state & c.ZOOM) === c.ZOOM || (this._state & c.TOUCH_ZOOM) === c.TOUCH_ZOOM || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK || (this._state & c.TOUCH_ZOOM_SCREEN_PAN) === c.TOUCH_ZOOM_SCREEN_PAN || (this._state & c.TOUCH_ZOOM_OFFSET) === c.TOUCH_ZOOM_OFFSET || (this._state & c.TOUCH_ZOOM_ROTATE) === c.TOUCH_ZOOM_ROTATE) && (this._zoomEnd = this._zoom, this._zoomVelocity.value = 0), ((this._state & c.OFFSET) === c.OFFSET || (this._state & c.TOUCH_OFFSET) === c.TOUCH_OFFSET || (this._state & c.TOUCH_DOLLY_OFFSET) === c.TOUCH_DOLLY_OFFSET || (this._state & c.TOUCH_ZOOM_OFFSET) === c.TOUCH_ZOOM_OFFSET) && (this._focalOffsetEnd.copy(this._focalOffset), this._focalOffsetVelocity.set(0, 0, 0)), this.dispatchEvent({ type: "controlstart" });
|
|
504
505
|
}, v = () => {
|
|
505
506
|
if (!this._enabled || !this._dragNeedsUpdate) return;
|
|
@@ -527,7 +528,7 @@ class $ extends Yt {
|
|
|
527
528
|
}, m = () => {
|
|
528
529
|
Ce(this._activePointers, U), i.copy(U), 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(
|
|
529
530
|
"pointermove",
|
|
530
|
-
|
|
531
|
+
a,
|
|
531
532
|
{ passive: !1 }
|
|
532
533
|
), this._domElement.ownerDocument.removeEventListener(
|
|
533
534
|
"pointerup",
|
|
@@ -544,7 +545,7 @@ class $ extends Yt {
|
|
|
544
545
|
mouseButton: null
|
|
545
546
|
}, this._activePointers.push(this._lockedPointer), this._domElement.ownerDocument.removeEventListener(
|
|
546
547
|
"pointermove",
|
|
547
|
-
|
|
548
|
+
a,
|
|
548
549
|
{ passive: !1 }
|
|
549
550
|
), this._domElement.ownerDocument.removeEventListener(
|
|
550
551
|
"pointerup",
|
|
@@ -557,12 +558,12 @@ class $ extends Yt {
|
|
|
557
558
|
g
|
|
558
559
|
), this._domElement.ownerDocument.addEventListener(
|
|
559
560
|
"pointermove",
|
|
560
|
-
|
|
561
|
+
a,
|
|
561
562
|
{ passive: !1 }
|
|
562
563
|
), this._domElement.ownerDocument.addEventListener("pointerup", h), C());
|
|
563
564
|
}, this.unlockPointer = () => {
|
|
564
|
-
var
|
|
565
|
-
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (
|
|
565
|
+
var n, _, E;
|
|
566
|
+
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (n = this._domElement) === null || n === void 0 || n.ownerDocument.exitPointerLock(), (_ = this._domElement) === null || _ === void 0 || _.ownerDocument.removeEventListener(
|
|
566
567
|
"pointerlockchange",
|
|
567
568
|
u
|
|
568
569
|
), (E = this._domElement) === null || E === void 0 || E.ownerDocument.removeEventListener(
|
|
@@ -575,8 +576,8 @@ class $ extends Yt {
|
|
|
575
576
|
}, g = () => {
|
|
576
577
|
this.unlockPointer();
|
|
577
578
|
};
|
|
578
|
-
this._addAllEventListeners = (
|
|
579
|
-
this._domElement =
|
|
579
|
+
this._addAllEventListeners = (n) => {
|
|
580
|
+
this._domElement = n, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", o), this._domElement.addEventListener("pointercancel", h), this._domElement.addEventListener("wheel", f, {
|
|
580
581
|
passive: !1
|
|
581
582
|
}), this._domElement.addEventListener("contextmenu", p);
|
|
582
583
|
}, this._removeAllEventListeners = () => {
|
|
@@ -584,7 +585,7 @@ class $ extends Yt {
|
|
|
584
585
|
passive: !1
|
|
585
586
|
}), this._domElement.removeEventListener("contextmenu", p), this._domElement.ownerDocument.removeEventListener(
|
|
586
587
|
"pointermove",
|
|
587
|
-
|
|
588
|
+
a,
|
|
588
589
|
{ passive: !1 }
|
|
589
590
|
), this._domElement.ownerDocument.removeEventListener(
|
|
590
591
|
"pointerup",
|
|
@@ -870,11 +871,11 @@ class $ extends Yt {
|
|
|
870
871
|
_dollyToNoClamp(e, t = !1) {
|
|
871
872
|
const s = this._sphericalEnd.radius;
|
|
872
873
|
if (this.colliderMeshes.length >= 1) {
|
|
873
|
-
const o = this._collisionTest(),
|
|
874
|
+
const o = this._collisionTest(), a = S(
|
|
874
875
|
o,
|
|
875
876
|
this._spherical.radius
|
|
876
877
|
);
|
|
877
|
-
if (!(s > e) &&
|
|
878
|
+
if (!(s > e) && a) return Promise.resolve();
|
|
878
879
|
this._sphericalEnd.radius = Math.min(
|
|
879
880
|
e,
|
|
880
881
|
o
|
|
@@ -994,11 +995,11 @@ class $ extends Yt {
|
|
|
994
995
|
* @category Methods
|
|
995
996
|
*/
|
|
996
997
|
lookInDirectionOf(e, t, s, i = !1) {
|
|
997
|
-
const
|
|
998
|
+
const a = b.set(e, t, s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);
|
|
998
999
|
return this.setPosition(
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1000
|
+
a.x,
|
|
1001
|
+
a.y,
|
|
1002
|
+
a.z,
|
|
1002
1003
|
i
|
|
1003
1004
|
);
|
|
1004
1005
|
}
|
|
@@ -1020,7 +1021,7 @@ class $ extends Yt {
|
|
|
1020
1021
|
paddingLeft: i = 0,
|
|
1021
1022
|
paddingRight: r = 0,
|
|
1022
1023
|
paddingBottom: o = 0,
|
|
1023
|
-
paddingTop:
|
|
1024
|
+
paddingTop: a = 0
|
|
1024
1025
|
} = {}) {
|
|
1025
1026
|
const h = [], d = e.isBox3 ? K.copy(e) : K.setFromObject(e);
|
|
1026
1027
|
d.isEmpty() && (console.warn(
|
|
@@ -1031,8 +1032,8 @@ class $ extends Yt {
|
|
|
1031
1032
|
const C = b.setFromSpherical(this._sphericalEnd).normalize(), v = Ve.setFromUnitVectors(C, Oe), m = S(Math.abs(C.y), 1);
|
|
1032
1033
|
m && v.multiply(xe.setFromAxisAngle(ce, f)), v.multiply(this._yAxisUpSpaceInverse);
|
|
1033
1034
|
const u = je.makeEmpty();
|
|
1034
|
-
L.copy(d.min).applyQuaternion(v), u.expandByPoint(L), L.copy(d.min).setX(d.max.x).applyQuaternion(v), u.expandByPoint(L), L.copy(d.min).setY(d.max.y).applyQuaternion(v), u.expandByPoint(L), L.copy(d.max).setZ(d.min.z).applyQuaternion(v), u.expandByPoint(L), L.copy(d.min).setZ(d.max.z).applyQuaternion(v), u.expandByPoint(L), L.copy(d.max).setY(d.min.y).applyQuaternion(v), u.expandByPoint(L), L.copy(d.max).setX(d.min.x).applyQuaternion(v), u.expandByPoint(L), L.copy(d.max).applyQuaternion(v), u.expandByPoint(L), u.min.x -= i, u.min.y -= o, u.max.x += r, u.max.y +=
|
|
1035
|
-
const g = u.getSize(b),
|
|
1035
|
+
L.copy(d.min).applyQuaternion(v), u.expandByPoint(L), L.copy(d.min).setX(d.max.x).applyQuaternion(v), u.expandByPoint(L), L.copy(d.min).setY(d.max.y).applyQuaternion(v), u.expandByPoint(L), L.copy(d.max).setZ(d.min.z).applyQuaternion(v), u.expandByPoint(L), L.copy(d.min).setZ(d.max.z).applyQuaternion(v), u.expandByPoint(L), L.copy(d.max).setY(d.min.y).applyQuaternion(v), u.expandByPoint(L), L.copy(d.max).setX(d.min.x).applyQuaternion(v), u.expandByPoint(L), L.copy(d.max).applyQuaternion(v), u.expandByPoint(L), u.min.x -= i, u.min.y -= o, u.max.x += r, u.max.y += a, v.setFromUnitVectors(Oe, C), m && v.premultiply(xe.invert()), v.premultiply(this._yAxisUpSpace);
|
|
1036
|
+
const g = u.getSize(b), n = u.getCenter(L).applyQuaternion(v);
|
|
1036
1037
|
if (B(this._camera)) {
|
|
1037
1038
|
const _ = this.getDistanceToFitBox(
|
|
1038
1039
|
g.x,
|
|
@@ -1041,12 +1042,12 @@ class $ extends Yt {
|
|
|
1041
1042
|
s
|
|
1042
1043
|
);
|
|
1043
1044
|
h.push(
|
|
1044
|
-
this.moveTo(
|
|
1045
|
+
this.moveTo(n.x, n.y, n.z, t)
|
|
1045
1046
|
), h.push(this.dollyTo(_, t)), h.push(this.setFocalOffset(0, 0, 0, t));
|
|
1046
1047
|
} else if (j(this._camera)) {
|
|
1047
1048
|
const _ = this._camera, E = _.right - _.left, y = _.top - _.bottom, w = s ? Math.max(E / g.x, y / g.y) : Math.min(E / g.x, y / g.y);
|
|
1048
1049
|
h.push(
|
|
1049
|
-
this.moveTo(
|
|
1050
|
+
this.moveTo(n.x, n.y, n.z, t)
|
|
1050
1051
|
), h.push(this.zoomTo(w, t)), h.push(this.setFocalOffset(0, 0, 0, t));
|
|
1051
1052
|
}
|
|
1052
1053
|
return Promise.all(h);
|
|
@@ -1070,7 +1071,7 @@ class $ extends Yt {
|
|
|
1070
1071
|
const o = this.getDistanceToFitSphere(r.radius);
|
|
1071
1072
|
s.push(this.dollyTo(o, t));
|
|
1072
1073
|
} else if (j(this._camera)) {
|
|
1073
|
-
const o = this._camera.right - this._camera.left,
|
|
1074
|
+
const o = this._camera.right - this._camera.left, a = this._camera.top - this._camera.bottom, h = 2 * r.radius, d = Math.min(o / h, a / h);
|
|
1074
1075
|
s.push(this.zoomTo(d, t));
|
|
1075
1076
|
}
|
|
1076
1077
|
return s.push(this.setFocalOffset(0, 0, 0, t)), Promise.all(s);
|
|
@@ -1086,13 +1087,13 @@ class $ extends Yt {
|
|
|
1086
1087
|
* @param enableTransition
|
|
1087
1088
|
* @category Methods
|
|
1088
1089
|
*/
|
|
1089
|
-
setLookAt(e, t, s, i, r, o,
|
|
1090
|
+
setLookAt(e, t, s, i, r, o, a = !1) {
|
|
1090
1091
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = Z.NONE, this._changedDolly = 0;
|
|
1091
1092
|
const h = L.set(i, r, o), d = b.set(e, t, s);
|
|
1092
1093
|
this._targetEnd.copy(h), this._sphericalEnd.setFromVector3(
|
|
1093
1094
|
d.sub(h).applyQuaternion(this._yAxisUpSpace)
|
|
1094
|
-
), this.normalizeRotations(), this._needsUpdate = !0,
|
|
1095
|
-
const f = !
|
|
1095
|
+
), this.normalizeRotations(), this._needsUpdate = !0, a || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
1096
|
+
const f = !a || S(this._target.x, this._targetEnd.x, this.restThreshold) && S(this._target.y, this._targetEnd.y, this.restThreshold) && S(this._target.z, this._targetEnd.z, this.restThreshold) && S(
|
|
1096
1097
|
this._spherical.theta,
|
|
1097
1098
|
this._sphericalEnd.theta,
|
|
1098
1099
|
this.restThreshold
|
|
@@ -1125,16 +1126,16 @@ class $ extends Yt {
|
|
|
1125
1126
|
* @param enableTransition
|
|
1126
1127
|
* @category Methods
|
|
1127
1128
|
*/
|
|
1128
|
-
lerpLookAt(e, t, s, i, r, o,
|
|
1129
|
+
lerpLookAt(e, t, s, i, r, o, a, h, d, f, p, C, v, m = !1) {
|
|
1129
1130
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = Z.NONE, this._changedDolly = 0;
|
|
1130
1131
|
const u = b.set(i, r, o), g = L.set(e, t, s);
|
|
1131
1132
|
k.setFromVector3(
|
|
1132
1133
|
g.sub(u).applyQuaternion(this._yAxisUpSpace)
|
|
1133
1134
|
);
|
|
1134
|
-
const
|
|
1135
|
+
const n = G.set(f, p, C), _ = L.set(a, h, d);
|
|
1135
1136
|
re.setFromVector3(
|
|
1136
|
-
_.sub(
|
|
1137
|
-
), this._targetEnd.copy(u.lerp(
|
|
1137
|
+
_.sub(n).applyQuaternion(this._yAxisUpSpace)
|
|
1138
|
+
), this._targetEnd.copy(u.lerp(n, v));
|
|
1138
1139
|
const E = re.theta - k.theta, y = re.phi - k.phi, w = re.radius - k.radius;
|
|
1139
1140
|
this._sphericalEnd.set(
|
|
1140
1141
|
k.radius + w * v,
|
|
@@ -1278,8 +1279,8 @@ class $ extends Yt {
|
|
|
1278
1279
|
getDistanceToFitBox(e, t, s, i = !1) {
|
|
1279
1280
|
if (Ee(this._camera, "getDistanceToFitBox"))
|
|
1280
1281
|
return this._spherical.radius;
|
|
1281
|
-
const r = e / t, o = this._camera.getEffectiveFOV() * ee,
|
|
1282
|
-
return ((i ? r >
|
|
1282
|
+
const r = e / t, o = this._camera.getEffectiveFOV() * ee, a = this._camera.aspect;
|
|
1283
|
+
return ((i ? r > a : r < a) ? t : e / a) * 0.5 / Math.tan(o * 0.5) + s * 0.5;
|
|
1283
1284
|
}
|
|
1284
1285
|
/**
|
|
1285
1286
|
* Calculate the distance to fit the sphere.
|
|
@@ -1412,7 +1413,7 @@ class $ extends Yt {
|
|
|
1412
1413
|
const t = this._sphericalEnd.theta - this._spherical.theta, s = this._sphericalEnd.phi - this._spherical.phi, i = this._sphericalEnd.radius - this._spherical.radius, r = He.subVectors(this._targetEnd, this._target), o = Ie.subVectors(
|
|
1413
1414
|
this._focalOffsetEnd,
|
|
1414
1415
|
this._focalOffset
|
|
1415
|
-
),
|
|
1416
|
+
), a = this._zoomEnd - this._zoom;
|
|
1416
1417
|
if (M(t))
|
|
1417
1418
|
this._thetaVelocity.value = 0, this._spherical.theta = this._sphericalEnd.theta;
|
|
1418
1419
|
else {
|
|
@@ -1480,7 +1481,7 @@ class $ extends Yt {
|
|
|
1480
1481
|
this._focalOffset
|
|
1481
1482
|
), this._needsUpdate = !0;
|
|
1482
1483
|
}
|
|
1483
|
-
if (M(
|
|
1484
|
+
if (M(a))
|
|
1484
1485
|
this._zoomVelocity.value = 0, this._zoom = this._zoomEnd;
|
|
1485
1486
|
else {
|
|
1486
1487
|
const p = this._isUserControllingZoom ? this.draggingSmoothTime : this.smoothTime;
|
|
@@ -1517,7 +1518,7 @@ class $ extends Yt {
|
|
|
1517
1518
|
this._dollyControlCoord.x,
|
|
1518
1519
|
this._dollyControlCoord.y,
|
|
1519
1520
|
(C.near + C.far) / (C.near - C.far)
|
|
1520
|
-
).unproject(C), m = L.set(0, 0, -1).applyQuaternion(C.quaternion), u = G.copy(v).add(m.multiplyScalar(-v.dot(C.up))),
|
|
1521
|
+
).unproject(C), m = L.set(0, 0, -1).applyQuaternion(C.quaternion), u = G.copy(v).add(m.multiplyScalar(-v.dot(C.up))), n = -(this._zoom - p - this._zoom) / this._zoom, _ = this._getCameraDirection(ie), E = this._targetEnd.dot(_), y = b.copy(this._targetEnd).lerp(u, n), w = y.dot(_), T = _.multiplyScalar(
|
|
1521
1522
|
w - E
|
|
1522
1523
|
);
|
|
1523
1524
|
y.sub(T), this._boundary.clampPoint(y, y);
|
|
@@ -1533,7 +1534,7 @@ class $ extends Yt {
|
|
|
1533
1534
|
1
|
|
1534
1535
|
);
|
|
1535
1536
|
const f = this._needsUpdate;
|
|
1536
|
-
return f && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : f ? (this.dispatchEvent({ type: "update" }), M(t, this.restThreshold) && M(s, this.restThreshold) && M(i, this.restThreshold) && M(r.x, this.restThreshold) && M(r.y, this.restThreshold) && M(r.z, this.restThreshold) && M(o.x, this.restThreshold) && M(o.y, this.restThreshold) && M(o.z, this.restThreshold) && M(
|
|
1537
|
+
return f && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : f ? (this.dispatchEvent({ type: "update" }), M(t, this.restThreshold) && M(s, this.restThreshold) && M(i, this.restThreshold) && M(r.x, this.restThreshold) && M(r.y, this.restThreshold) && M(r.z, this.restThreshold) && M(o.x, this.restThreshold) && M(o.y, this.restThreshold) && M(o.z, this.restThreshold) && M(a, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !f && this._updatedLastTime && (this._hasRested || (this._hasRested = !0, this.dispatchEvent({ type: "rest" })), this.dispatchEvent({ type: "sleep" })), this._lastDistance = this._spherical.radius, this._lastZoom = this._zoom, this._updatedLastTime = f, this._needsUpdate = !1, f;
|
|
1537
1538
|
}
|
|
1538
1539
|
/**
|
|
1539
1540
|
* Get all state in JSON string
|
|
@@ -1631,16 +1632,16 @@ class $ extends Yt {
|
|
|
1631
1632
|
const i = t.lengthSq();
|
|
1632
1633
|
if (i === 0)
|
|
1633
1634
|
return e;
|
|
1634
|
-
const r = L.copy(t).add(e),
|
|
1635
|
+
const r = L.copy(t).add(e), a = this._boundary.clampPoint(r, G).sub(r), h = a.lengthSq();
|
|
1635
1636
|
if (h === 0)
|
|
1636
1637
|
return e.add(t);
|
|
1637
1638
|
if (h === i)
|
|
1638
1639
|
return e;
|
|
1639
1640
|
if (s === 0)
|
|
1640
|
-
return e.add(t).add(
|
|
1641
|
+
return e.add(t).add(a);
|
|
1641
1642
|
{
|
|
1642
|
-
const d = 1 + s * h / t.dot(
|
|
1643
|
-
return e.add(L.copy(t).multiplyScalar(d)).add(
|
|
1643
|
+
const d = 1 + s * h / t.dot(a);
|
|
1644
|
+
return e.add(L.copy(t).multiplyScalar(d)).add(a.multiplyScalar(1 - s));
|
|
1644
1645
|
}
|
|
1645
1646
|
}
|
|
1646
1647
|
_updateNearPlaneCorners() {
|
|
@@ -1664,8 +1665,8 @@ class $ extends Yt {
|
|
|
1664
1665
|
r.applyMatrix4(we);
|
|
1665
1666
|
const o = G.addVectors(this._target, r);
|
|
1666
1667
|
de.set(o, s), de.far = this._spherical.radius + 1;
|
|
1667
|
-
const
|
|
1668
|
-
|
|
1668
|
+
const a = de.intersectObjects(this.colliderMeshes);
|
|
1669
|
+
a.length !== 0 && a[0].distance < e && (e = a[0].distance);
|
|
1669
1670
|
}
|
|
1670
1671
|
return e;
|
|
1671
1672
|
}
|
|
@@ -1738,10 +1739,10 @@ class $ extends Yt {
|
|
|
1738
1739
|
let r = 0;
|
|
1739
1740
|
return e.traverseVisible((o) => {
|
|
1740
1741
|
if (!o.isMesh) return;
|
|
1741
|
-
const
|
|
1742
|
-
if (!
|
|
1743
|
-
const h =
|
|
1744
|
-
h.applyMatrix4(
|
|
1742
|
+
const a = o;
|
|
1743
|
+
if (!a.geometry) return;
|
|
1744
|
+
const h = a.geometry.clone();
|
|
1745
|
+
h.applyMatrix4(a.matrixWorld);
|
|
1745
1746
|
const f = h.attributes.position;
|
|
1746
1747
|
for (let p = 0, C = f.count; p < C; p++)
|
|
1747
1748
|
b.fromBufferAttribute(f, p), r = Math.max(r, i.distanceToSquared(b));
|
|
@@ -1812,8 +1813,8 @@ A.prototype.emit = function(e) {
|
|
|
1812
1813
|
var o;
|
|
1813
1814
|
if (t.length > 0 && (o = t[0]), o instanceof Error)
|
|
1814
1815
|
throw o;
|
|
1815
|
-
var
|
|
1816
|
-
throw
|
|
1816
|
+
var a = new Error("Unhandled error." + (o ? " (" + o.message + ")" : ""));
|
|
1817
|
+
throw a.context = o, a;
|
|
1817
1818
|
}
|
|
1818
1819
|
var h = r[e];
|
|
1819
1820
|
if (h === void 0)
|
|
@@ -1835,8 +1836,8 @@ function ot(l, e, t, s) {
|
|
|
1835
1836
|
o = r[e] = t, ++l._eventsCount;
|
|
1836
1837
|
else if (typeof o == "function" ? o = r[e] = s ? [t, o] : [o, t] : s ? o.unshift(t) : o.push(t), i = rt(l), i > 0 && o.length > i && !o.warned) {
|
|
1837
1838
|
o.warned = !0;
|
|
1838
|
-
var
|
|
1839
|
-
|
|
1839
|
+
var a = new Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
1840
|
+
a.name = "MaxListenersExceededWarning", a.emitter = l, a.type = e, a.count = o.length, Wt(a);
|
|
1840
1841
|
}
|
|
1841
1842
|
return l;
|
|
1842
1843
|
}
|
|
@@ -1862,7 +1863,7 @@ A.prototype.prependOnceListener = function(e, t) {
|
|
|
1862
1863
|
return _e(t), this.prependListener(e, nt(this, e, t)), this;
|
|
1863
1864
|
};
|
|
1864
1865
|
A.prototype.removeListener = function(e, t) {
|
|
1865
|
-
var s, i, r, o,
|
|
1866
|
+
var s, i, r, o, a;
|
|
1866
1867
|
if (_e(t), i = this._events, i === void 0)
|
|
1867
1868
|
return this;
|
|
1868
1869
|
if (s = i[e], s === void 0)
|
|
@@ -1872,12 +1873,12 @@ A.prototype.removeListener = function(e, t) {
|
|
|
1872
1873
|
else if (typeof s != "function") {
|
|
1873
1874
|
for (r = -1, o = s.length - 1; o >= 0; o--)
|
|
1874
1875
|
if (s[o] === t || s[o].listener === t) {
|
|
1875
|
-
|
|
1876
|
+
a = s[o].listener, r = o;
|
|
1876
1877
|
break;
|
|
1877
1878
|
}
|
|
1878
1879
|
if (r < 0)
|
|
1879
1880
|
return this;
|
|
1880
|
-
r === 0 ? s.shift() : Kt(s, r), s.length === 1 && (i[e] = s[0]), i.removeListener !== void 0 && this.emit("removeListener", e,
|
|
1881
|
+
r === 0 ? s.shift() : Kt(s, r), s.length === 1 && (i[e] = s[0]), i.removeListener !== void 0 && this.emit("removeListener", e, a || t);
|
|
1881
1882
|
}
|
|
1882
1883
|
return this;
|
|
1883
1884
|
};
|
|
@@ -1990,7 +1991,7 @@ class Jt {
|
|
|
1990
1991
|
const { width: t, height: s, rendererParams: i } = e, {
|
|
1991
1992
|
alpha: r,
|
|
1992
1993
|
devicePixelRatio: o,
|
|
1993
|
-
antialias:
|
|
1994
|
+
antialias: a,
|
|
1994
1995
|
powerPreference: h,
|
|
1995
1996
|
toneMappingExposure: d,
|
|
1996
1997
|
outputColorSpace: f,
|
|
@@ -2000,7 +2001,7 @@ class Jt {
|
|
|
2000
2001
|
depth: m
|
|
2001
2002
|
} = i, u = new O.WebGLRenderer({
|
|
2002
2003
|
alpha: r,
|
|
2003
|
-
antialias:
|
|
2004
|
+
antialias: a,
|
|
2004
2005
|
powerPreference: h,
|
|
2005
2006
|
logarithmicDepthBuffer: p,
|
|
2006
2007
|
preserveDrawingBuffer: C,
|
|
@@ -2020,17 +2021,17 @@ class Jt {
|
|
|
2020
2021
|
}
|
|
2021
2022
|
setViewport(e) {
|
|
2022
2023
|
var h, d;
|
|
2023
|
-
const { x: t, y: s, width: i, height: r } = e, o = (h = e.scissor) != null ? h : !1,
|
|
2024
|
-
this.renderer.setViewport(t, s, i, r), o && (this.renderer.setScissor(t, s, i, r), this.renderer.setScissorTest(
|
|
2024
|
+
const { x: t, y: s, width: i, height: r } = e, o = (h = e.scissor) != null ? h : !1, a = (d = e.scissorTest) != null ? d : !1;
|
|
2025
|
+
this.renderer.setViewport(t, s, i, r), o && (this.renderer.setScissor(t, s, i, r), this.renderer.setScissorTest(a));
|
|
2025
2026
|
}
|
|
2026
2027
|
setViewPadding(e = 0, t = 0, s = 0, i = 0) {
|
|
2027
|
-
const { width: r, height: o } = this.renderer.getSize(new O.Vector2()),
|
|
2028
|
+
const { width: r, height: o } = this.renderer.getSize(new O.Vector2()), a = {
|
|
2028
2029
|
x: i,
|
|
2029
2030
|
y: s,
|
|
2030
2031
|
width: r - i - t,
|
|
2031
2032
|
height: o - e - s
|
|
2032
2033
|
};
|
|
2033
|
-
this.setViewport(
|
|
2034
|
+
this.setViewport(a);
|
|
2034
2035
|
}
|
|
2035
2036
|
dispose() {
|
|
2036
2037
|
var e, t;
|
|
@@ -2044,8 +2045,8 @@ const es = {
|
|
|
2044
2045
|
class ts {
|
|
2045
2046
|
constructor(e) {
|
|
2046
2047
|
this.options = e;
|
|
2047
|
-
const { width: t, height: s, rendererParams: i, renderer: r } = e, { devicePixelRatio: o, antialias:
|
|
2048
|
-
antialias:
|
|
2048
|
+
const { width: t, height: s, rendererParams: i, renderer: r } = e, { devicePixelRatio: o, antialias: a } = i, h = new r({
|
|
2049
|
+
antialias: a
|
|
2049
2050
|
});
|
|
2050
2051
|
h.setSize(t, s), h.setPixelRatio(o), this.renderer = h;
|
|
2051
2052
|
}
|
|
@@ -2133,7 +2134,7 @@ class is extends ne {
|
|
|
2133
2134
|
return this.controller;
|
|
2134
2135
|
}
|
|
2135
2136
|
addPerspectiveCamera(e = dt, t) {
|
|
2136
|
-
const { fov: s, far: i, near: r, up: o, aspect:
|
|
2137
|
+
const { fov: s, far: i, near: r, up: o, aspect: a } = e, h = a != null ? a : this.width / this.height, d = new O.PerspectiveCamera(s, h, r, i);
|
|
2137
2138
|
return d.up = o, this.addController(d, t);
|
|
2138
2139
|
}
|
|
2139
2140
|
setPageActive(e) {
|
|
@@ -2200,7 +2201,7 @@ class is extends ne {
|
|
|
2200
2201
|
s[7],
|
|
2201
2202
|
s[11],
|
|
2202
2203
|
s[15]
|
|
2203
|
-
), { width:
|
|
2204
|
+
), { width: a, height: h } = this, d = a / h;
|
|
2204
2205
|
(this.camera.fov !== t.fov || this.camera.aspect !== d || !this.camera.matrixWorld.equals(r) || !this.camera.matrixWorldInverse.equals(o)) && (this.camera.fov = t.fov, this.camera.updateProjectionMatrix(), this.camera.matrixAutoUpdate = !1, this.camera.matrixWorld.copy(r), this.camera.matrixWorldInverse.copy(o), this.camera.aspect = d, this.camera.updateProjectionMatrix());
|
|
2205
2206
|
}
|
|
2206
2207
|
}
|
|
@@ -2296,10 +2297,10 @@ class ns {
|
|
|
2296
2297
|
update(e, t, s) {
|
|
2297
2298
|
var r, o;
|
|
2298
2299
|
const { cameraController: i } = this.options;
|
|
2299
|
-
Object.values(this.helpers).forEach((
|
|
2300
|
-
if (
|
|
2301
|
-
const h =
|
|
2302
|
-
d &&
|
|
2300
|
+
Object.values(this.helpers).forEach((a) => {
|
|
2301
|
+
if (a.update && a.update(), a instanceof O.Box3Helper) {
|
|
2302
|
+
const h = a.material, { object: d } = h.userData;
|
|
2303
|
+
d && a.box.setFromObject(d, !0);
|
|
2303
2304
|
}
|
|
2304
2305
|
}), ((r = this.viewHelper) == null ? void 0 : r.animating) === !0 && (this.viewHelper.update(e), (o = t.cameraControls) == null || o.setPosition(
|
|
2305
2306
|
...i.camera.position.toArray()
|
|
@@ -2361,13 +2362,13 @@ class hs {
|
|
|
2361
2362
|
if (r.getHelper) {
|
|
2362
2363
|
const o = r.getHelper();
|
|
2363
2364
|
if (s.add(o), +O.REVISION < 170) {
|
|
2364
|
-
const
|
|
2365
|
-
|
|
2366
|
-
|
|
2365
|
+
const a = r._root;
|
|
2366
|
+
a.dispose = () => {
|
|
2367
|
+
a.traverse((h) => {
|
|
2367
2368
|
h.geometry && h.geometry.dispose(), h.material && h.material.dispose();
|
|
2368
2369
|
});
|
|
2369
2370
|
}, r.dispose = () => {
|
|
2370
|
-
r.disconnect(),
|
|
2371
|
+
r.disconnect(), a.dispose();
|
|
2371
2372
|
};
|
|
2372
2373
|
}
|
|
2373
2374
|
} else r instanceof O.Object3D && s.add(r);
|
|
@@ -2430,7 +2431,7 @@ class ds {
|
|
|
2430
2431
|
constructor(e = {}) {
|
|
2431
2432
|
const t = this;
|
|
2432
2433
|
let s, i, r, o;
|
|
2433
|
-
const
|
|
2434
|
+
const a = {
|
|
2434
2435
|
camera: { style: "" },
|
|
2435
2436
|
objects: /* @__PURE__ */ new WeakMap()
|
|
2436
2437
|
}, h = e.element !== void 0 ? e.element : document.createElement("div");
|
|
@@ -2443,33 +2444,33 @@ class ds {
|
|
|
2443
2444
|
width: s,
|
|
2444
2445
|
height: i
|
|
2445
2446
|
};
|
|
2446
|
-
}, this.render = function(g,
|
|
2447
|
-
const _ =
|
|
2448
|
-
|
|
2447
|
+
}, this.render = function(g, n) {
|
|
2448
|
+
const _ = n.projectionMatrix.elements[5] * o;
|
|
2449
|
+
n.view && n.view.enabled ? (d.style.transform = `translate( ${-n.view.offsetX * (s / n.view.width)}px, ${-n.view.offsetY * (i / n.view.height)}px )`, d.style.transform += `scale( ${n.view.fullWidth / n.view.width}, ${n.view.fullHeight / n.view.height} )`) : d.style.transform = "", g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(), n.parent === null && n.matrixWorldAutoUpdate === !0 && n.updateMatrixWorld();
|
|
2449
2450
|
let E, y;
|
|
2450
|
-
|
|
2451
|
-
const w =
|
|
2452
|
-
|
|
2453
|
-
}, this.setSize = function(g,
|
|
2454
|
-
s = g, i =
|
|
2451
|
+
n.isOrthographicCamera && (E = -(n.right + n.left) / 2, y = (n.top + n.bottom) / 2);
|
|
2452
|
+
const w = n.view && n.view.enabled ? n.view.height / n.view.fullHeight : 1, T = n.isOrthographicCamera ? `scale( ${w} )scale(` + _ + ")translate(" + p(E) + "px," + p(y) + "px)" + C(n.matrixWorldInverse) : `scale( ${w} )translateZ(` + _ + "px)" + C(n.matrixWorldInverse), R = (n.isPerspectiveCamera ? "perspective(" + _ + "px) " : "") + T + "translate(" + r + "px," + o + "px)";
|
|
2453
|
+
a.camera.style !== R && (f.style.transform = R, a.camera.style = R), u(g, g, n);
|
|
2454
|
+
}, this.setSize = function(g, n) {
|
|
2455
|
+
s = g, i = n, r = s / 2, o = i / 2, h.style.width = g + "px", h.style.height = n + "px", d.style.width = g + "px", d.style.height = n + "px", f.style.width = g + "px", f.style.height = n + "px";
|
|
2455
2456
|
};
|
|
2456
2457
|
function p(g) {
|
|
2457
2458
|
return Math.abs(g) < 1e-10 ? 0 : g;
|
|
2458
2459
|
}
|
|
2459
2460
|
function C(g) {
|
|
2460
|
-
const
|
|
2461
|
-
return "matrix3d(" + p(
|
|
2461
|
+
const n = g.elements;
|
|
2462
|
+
return "matrix3d(" + p(n[0]) + "," + p(-n[1]) + "," + p(n[2]) + "," + p(n[3]) + "," + p(n[4]) + "," + p(-n[5]) + "," + p(n[6]) + "," + p(n[7]) + "," + p(n[8]) + "," + p(-n[9]) + "," + p(n[10]) + "," + p(n[11]) + "," + p(n[12]) + "," + p(-n[13]) + "," + p(n[14]) + "," + p(n[15]) + ")";
|
|
2462
2463
|
}
|
|
2463
2464
|
function v(g) {
|
|
2464
|
-
const
|
|
2465
|
-
return "translate(-50%,-50%)" + ("matrix3d(" + p(
|
|
2465
|
+
const n = g.elements;
|
|
2466
|
+
return "translate(-50%,-50%)" + ("matrix3d(" + p(n[0]) + "," + p(n[1]) + "," + p(n[2]) + "," + p(n[3]) + "," + p(-n[4]) + "," + p(-n[5]) + "," + p(-n[6]) + "," + p(-n[7]) + "," + p(n[8]) + "," + p(n[9]) + "," + p(n[10]) + "," + p(n[11]) + "," + p(n[12]) + "," + p(n[13]) + "," + p(n[14]) + "," + p(n[15]) + ")");
|
|
2466
2467
|
}
|
|
2467
2468
|
function m(g) {
|
|
2468
2469
|
g.isCSS3DObject && (g.element.style.display = "none");
|
|
2469
|
-
for (let
|
|
2470
|
-
m(g.children[
|
|
2470
|
+
for (let n = 0, _ = g.children.length; n < _; n++)
|
|
2471
|
+
m(g.children[n]);
|
|
2471
2472
|
}
|
|
2472
|
-
function u(g,
|
|
2473
|
+
function u(g, n, _, E) {
|
|
2473
2474
|
if (g.visible === !1) {
|
|
2474
2475
|
m(g);
|
|
2475
2476
|
return;
|
|
@@ -2477,20 +2478,20 @@ class ds {
|
|
|
2477
2478
|
if (g.isCSS3DObject) {
|
|
2478
2479
|
const y = g.layers.test(_.layers) === !0, w = g.element;
|
|
2479
2480
|
if (w.style.display = y === !0 ? "" : "none", y === !0) {
|
|
2480
|
-
g.onBeforeRender(t,
|
|
2481
|
+
g.onBeforeRender(t, n, _);
|
|
2481
2482
|
let T;
|
|
2482
2483
|
g.isCSS3DSprite ? (I.copy(_.matrixWorldInverse), I.transpose(), g.rotation2D !== 0 && I.multiply(cs.makeRotationZ(g.rotation2D)), g.matrixWorld.decompose(Ze, ls, We), I.setPosition(Ze), I.scale(We), I.elements[3] = 0, I.elements[7] = 0, I.elements[11] = 0, I.elements[15] = 1, T = v(I)) : T = v(g.matrixWorld);
|
|
2483
|
-
const P =
|
|
2484
|
+
const P = a.objects.get(g);
|
|
2484
2485
|
if (P === void 0 || P.style !== T) {
|
|
2485
2486
|
w.style.transform = T;
|
|
2486
2487
|
const R = { style: T };
|
|
2487
|
-
|
|
2488
|
+
a.objects.set(g, R);
|
|
2488
2489
|
}
|
|
2489
|
-
w.parentNode !== f && f.appendChild(w), g.onAfterRender(t,
|
|
2490
|
+
w.parentNode !== f && f.appendChild(w), g.onAfterRender(t, n, _);
|
|
2490
2491
|
}
|
|
2491
2492
|
}
|
|
2492
2493
|
for (let y = 0, w = g.children.length; y < w; y++)
|
|
2493
|
-
u(g.children[y],
|
|
2494
|
+
u(g.children[y], n, _);
|
|
2494
2495
|
}
|
|
2495
2496
|
}
|
|
2496
2497
|
}
|
|
@@ -2504,7 +2505,7 @@ class ps {
|
|
|
2504
2505
|
constructor(e = {}) {
|
|
2505
2506
|
const t = this;
|
|
2506
2507
|
let s, i, r, o;
|
|
2507
|
-
const
|
|
2508
|
+
const a = {
|
|
2508
2509
|
objects: /* @__PURE__ */ new WeakMap()
|
|
2509
2510
|
}, h = e.element !== void 0 ? e.element : document.createElement("div");
|
|
2510
2511
|
h.style.overflow = "hidden", this.domElement = h, this.getSize = function() {
|
|
@@ -2529,15 +2530,15 @@ class ps {
|
|
|
2529
2530
|
}
|
|
2530
2531
|
if (m.isCSS2DObject) {
|
|
2531
2532
|
X.setFromMatrixPosition(m.matrixWorld), X.applyMatrix4(Ke);
|
|
2532
|
-
const
|
|
2533
|
-
_.style.display =
|
|
2533
|
+
const n = X.z >= -1 && X.z <= 1 && m.layers.test(g.layers) === !0, _ = m.element;
|
|
2534
|
+
_.style.display = n === !0 ? "" : "none", n === !0 && (m.onBeforeRender(t, u, g), _.style.transform = "translate(" + -100 * m.center.x + "%," + -100 * m.center.y + "%)translate(" + (X.x * r + r) + "px," + (-X.y * o + o) + "px)", _.parentNode !== h && h.appendChild(_), m.onAfterRender(t, u, g));
|
|
2534
2535
|
const E = {
|
|
2535
2536
|
distanceToCameraSquared: p(g, m)
|
|
2536
2537
|
};
|
|
2537
|
-
|
|
2538
|
+
a.objects.set(m, E);
|
|
2538
2539
|
}
|
|
2539
|
-
for (let
|
|
2540
|
-
f(m.children[
|
|
2540
|
+
for (let n = 0, _ = m.children.length; n < _; n++)
|
|
2541
|
+
f(m.children[n], u, g);
|
|
2541
2542
|
}
|
|
2542
2543
|
function p(m, u) {
|
|
2543
2544
|
return Xe.setFromMatrixPosition(m.matrixWorld), qe.setFromMatrixPosition(u.matrixWorld), Xe.distanceToSquared(qe);
|
|
@@ -2549,14 +2550,14 @@ class ps {
|
|
|
2549
2550
|
}), u;
|
|
2550
2551
|
}
|
|
2551
2552
|
function v(m) {
|
|
2552
|
-
const u = C(m).sort(function(
|
|
2553
|
-
if (
|
|
2554
|
-
return _.renderOrder -
|
|
2555
|
-
const E =
|
|
2553
|
+
const u = C(m).sort(function(n, _) {
|
|
2554
|
+
if (n.renderOrder !== _.renderOrder)
|
|
2555
|
+
return _.renderOrder - n.renderOrder;
|
|
2556
|
+
const E = a.objects.get(n).distanceToCameraSquared, y = a.objects.get(_).distanceToCameraSquared;
|
|
2556
2557
|
return E - y;
|
|
2557
2558
|
}), g = u.length;
|
|
2558
|
-
for (let
|
|
2559
|
-
u[
|
|
2559
|
+
for (let n = 0, _ = u.length; n < _; n++)
|
|
2560
|
+
u[n].element.style.zIndex = g - n;
|
|
2560
2561
|
}
|
|
2561
2562
|
}
|
|
2562
2563
|
}
|
|
@@ -2765,13 +2766,13 @@ class bs {
|
|
|
2765
2766
|
composerParams: r
|
|
2766
2767
|
} = e, { renderer: o } = t;
|
|
2767
2768
|
this.renderer = o;
|
|
2768
|
-
const { multisampling:
|
|
2769
|
+
const { multisampling: a } = r, { maxSamples: h } = o.capabilities, d = o.getDrawingBufferSize(
|
|
2769
2770
|
new O.Vector2()
|
|
2770
2771
|
), f = new O.WebGLRenderTarget(
|
|
2771
2772
|
d.width,
|
|
2772
2773
|
d.height,
|
|
2773
2774
|
{
|
|
2774
|
-
samples: Math.min(
|
|
2775
|
+
samples: Math.min(a, h),
|
|
2775
2776
|
type: O.HalfFloatType
|
|
2776
2777
|
}
|
|
2777
2778
|
), p = new Me(o, f), C = this.getSize();
|
|
@@ -2800,19 +2801,19 @@ class bs {
|
|
|
2800
2801
|
this.outputPass && (this.outputPass.uniforms.premultiplieAlpha.value = e ? 1 : 0);
|
|
2801
2802
|
}
|
|
2802
2803
|
addSSAOPass(e) {
|
|
2803
|
-
const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new O.Vector2()), o = r.width,
|
|
2804
|
+
const { scene: t, camera: s, renderer: i } = this, r = i.getSize(new O.Vector2()), o = r.width, a = r.height, h = new kt(t, s, o, a);
|
|
2804
2805
|
h.kernelRadius = e.kernelRadius, h.minDistance = e.minDistance, h.maxDistance = e.maxDistance, this.ssaoPass = h, this.finalComposer.addPass(h);
|
|
2805
2806
|
}
|
|
2806
2807
|
addBloomPass(e) {
|
|
2807
|
-
const { renderer: t } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: o } = e,
|
|
2808
|
+
const { renderer: t } = this, { threshold: s, strength: i, radius: r, bloomAlphaType: o } = e, a = new Ht(
|
|
2808
2809
|
new O.Vector2(window.innerWidth, window.innerHeight),
|
|
2809
2810
|
i,
|
|
2810
2811
|
r,
|
|
2811
2812
|
s
|
|
2812
2813
|
);
|
|
2813
|
-
this.bloomPass =
|
|
2814
|
+
this.bloomPass = a;
|
|
2814
2815
|
const h = new Me(t);
|
|
2815
|
-
h.renderToScreen = !1, h.addPass(this.renderPass), h.addPass(
|
|
2816
|
+
h.renderToScreen = !1, h.addPass(this.renderPass), h.addPass(a), this.bloomComposer = h;
|
|
2816
2817
|
const d = _s(h);
|
|
2817
2818
|
d.uniforms.bloomAlphaType.value = o, this.bloomComposer = h, this.finalComposer.addPass(d), this.mixPass = d, this.bloomLayer.set(be);
|
|
2818
2819
|
}
|
|
@@ -2847,8 +2848,8 @@ class bs {
|
|
|
2847
2848
|
}), t.forEach((s) => {
|
|
2848
2849
|
s.traverse((i) => {
|
|
2849
2850
|
var h;
|
|
2850
|
-
const r = i, o = i,
|
|
2851
|
-
(h = r.material) != null && h.isShadowMaterial ? e.push(r) : r.material && this.bloomLayer.test(r.layers) === !1 && (this.bloomMaterials[r.uuid] = r.material, o.isSprite ? o.material.sizeAttenuation ? o.material = Cs : o.material = Es : r.material instanceof tt ? r.material = Os :
|
|
2851
|
+
const r = i, o = i, a = i;
|
|
2852
|
+
(h = r.material) != null && h.isShadowMaterial ? e.push(r) : r.material && this.bloomLayer.test(r.layers) === !1 && (this.bloomMaterials[r.uuid] = r.material, o.isSprite ? o.material.sizeAttenuation ? o.material = Cs : o.material = Es : r.material instanceof tt ? r.material = Os : a.isPoints ? a.material.sizeAttenuation ? a.material = ys : a.material = vs : r.material = gs);
|
|
2852
2853
|
});
|
|
2853
2854
|
}), e.forEach((s) => {
|
|
2854
2855
|
this.bloomVisible[s.uuid] = s.visible, s.visible = !1;
|
|
@@ -2902,8 +2903,8 @@ class Qe extends O.Loader {
|
|
|
2902
2903
|
load(e, t, s, i) {
|
|
2903
2904
|
let r, o;
|
|
2904
2905
|
this.options.type === "image" ? (o = document.createElement("img"), r = new O.Texture(o)) : this.options.type === "video" ? (o = document.createElement("video"), o.preload = "auto", o.autoplay = !1, o.loop = !1, o.muted = !0, o.setAttribute("webkit-playsinline", "webkit-playsinline"), o.setAttribute("playsinline", ""), r = new O.VideoTexture(o)) : r = new O.Texture();
|
|
2905
|
-
const
|
|
2906
|
-
return
|
|
2906
|
+
const a = new O.FileLoader(this.manager);
|
|
2907
|
+
return a.setResponseType("blob"), a.setRequestHeader(this.requestHeader), a.setPath(this.path), a.setWithCredentials(this.withCredentials), a.load(
|
|
2907
2908
|
e,
|
|
2908
2909
|
(h) => {
|
|
2909
2910
|
let d = h;
|
|
@@ -2934,7 +2935,7 @@ class Ps extends O.Loader {
|
|
|
2934
2935
|
r.setResponseType("blob"), r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
|
|
2935
2936
|
e,
|
|
2936
2937
|
(o) => {
|
|
2937
|
-
const
|
|
2938
|
+
const a = o, h = new DecompressionStream("gzip"), d = a.stream().pipeThrough(h);
|
|
2938
2939
|
new Response(d).json().then((p) => {
|
|
2939
2940
|
t == null || t(p);
|
|
2940
2941
|
}).catch((p) => {
|
|
@@ -3050,8 +3051,8 @@ class Ss {
|
|
|
3050
3051
|
}
|
|
3051
3052
|
load(e, t) {
|
|
3052
3053
|
return J(this, null, function* () {
|
|
3053
|
-
var
|
|
3054
|
-
const s = (
|
|
3054
|
+
var a, h;
|
|
3055
|
+
const s = (a = t == null ? void 0 : t.type) != null ? a : this.getAssetType(e);
|
|
3055
3056
|
if (!s)
|
|
3056
3057
|
return;
|
|
3057
3058
|
const i = (t == null ? void 0 : t.cache) !== !1, r = Bt();
|
|
@@ -3161,15 +3162,15 @@ class Rs {
|
|
|
3161
3162
|
if (!this.enabled)
|
|
3162
3163
|
return;
|
|
3163
3164
|
r.preventDefault();
|
|
3164
|
-
const o = e === "move" ? t : s,
|
|
3165
|
+
const o = e === "move" ? t : s, a = [];
|
|
3165
3166
|
if (this.pickFunctionsMap.forEach((m) => {
|
|
3166
|
-
o.has(m.type) &&
|
|
3167
|
+
o.has(m.type) && a.push(Q(z({}, m), {
|
|
3167
3168
|
objArr: m.objArr instanceof Function ? m.objArr() : m.objArr
|
|
3168
3169
|
}));
|
|
3169
|
-
}),
|
|
3170
|
+
}), a.length === 0) return;
|
|
3170
3171
|
this.activeObjects.clear(), this.objCallbackMap.clear();
|
|
3171
3172
|
const h = this.objCallbackMap, d = [];
|
|
3172
|
-
for (const m of
|
|
3173
|
+
for (const m of a)
|
|
3173
3174
|
for (const u of m.objArr) {
|
|
3174
3175
|
if (!u.object3d || !u.visibleWithAncestors) continue;
|
|
3175
3176
|
h.has(u) || (h.set(u, /* @__PURE__ */ new Map()), d.push(u));
|
|
@@ -3207,8 +3208,8 @@ class Rs {
|
|
|
3207
3208
|
const i = this.objCallbackMap, r = e.index || -1;
|
|
3208
3209
|
let o = e.object;
|
|
3209
3210
|
for (; o; ) {
|
|
3210
|
-
const
|
|
3211
|
-
|
|
3211
|
+
const a = this.pencil.lead.objMap.get(o);
|
|
3212
|
+
a && i.has(a) && this.activeObjects.add(a), o = o.parent;
|
|
3212
3213
|
}
|
|
3213
3214
|
s === "move" ? this.handleLeaveEvents(t) : s === "down" && this.handleDownOutside(t), this.processObjectHierarchy(t, s, r);
|
|
3214
3215
|
}
|
|
@@ -3218,16 +3219,16 @@ class Rs {
|
|
|
3218
3219
|
const o = () => {
|
|
3219
3220
|
r = !0;
|
|
3220
3221
|
};
|
|
3221
|
-
for (const
|
|
3222
|
+
for (const a of this.activeObjects) {
|
|
3222
3223
|
if (r) break;
|
|
3223
|
-
const h = i.get(
|
|
3224
|
+
const h = i.get(a);
|
|
3224
3225
|
if (h)
|
|
3225
3226
|
if (t === "move") {
|
|
3226
3227
|
const d = h.get("enter");
|
|
3227
|
-
if (d && !this.prevActiveObjects.has(
|
|
3228
|
+
if (d && !this.prevActiveObjects.has(a))
|
|
3228
3229
|
for (const p of d)
|
|
3229
3230
|
p({
|
|
3230
|
-
baseObject:
|
|
3231
|
+
baseObject: a,
|
|
3231
3232
|
mouseEvent: e,
|
|
3232
3233
|
sp: o,
|
|
3233
3234
|
intersectionIndex: s
|
|
@@ -3236,7 +3237,7 @@ class Rs {
|
|
|
3236
3237
|
if (f)
|
|
3237
3238
|
for (const p of f)
|
|
3238
3239
|
p({
|
|
3239
|
-
baseObject:
|
|
3240
|
+
baseObject: a,
|
|
3240
3241
|
mouseEvent: e,
|
|
3241
3242
|
sp: o,
|
|
3242
3243
|
intersectionIndex: s
|
|
@@ -3246,7 +3247,7 @@ class Rs {
|
|
|
3246
3247
|
if (d)
|
|
3247
3248
|
for (const p of d)
|
|
3248
3249
|
p({
|
|
3249
|
-
baseObject:
|
|
3250
|
+
baseObject: a,
|
|
3250
3251
|
mouseEvent: e,
|
|
3251
3252
|
sp: o,
|
|
3252
3253
|
intersectionIndex: s
|
|
@@ -3259,7 +3260,7 @@ class Rs {
|
|
|
3259
3260
|
if (!r && Math.abs(C.clientX - e.clientX) <= v && Math.abs(C.clientY - e.clientY) <= v)
|
|
3260
3261
|
for (const m of f)
|
|
3261
3262
|
m({
|
|
3262
|
-
baseObject:
|
|
3263
|
+
baseObject: a,
|
|
3263
3264
|
mouseEvent: e,
|
|
3264
3265
|
sp: o,
|
|
3265
3266
|
intersectionIndex: s
|
|
@@ -3298,9 +3299,9 @@ class Rs {
|
|
|
3298
3299
|
i === "mousemove" ? i = "move" : i === "mouseenter" ? i = "enter" : i === "mouseleave" && (i = "leave"), this.pickFunctionsMapIndex += 1;
|
|
3299
3300
|
const r = this.pickFunctionsMapIndex;
|
|
3300
3301
|
return this.pickFunctionsMap.set(r, { objArr: e, type: i, cb: s }), this.pickListener.move || Array.from(this.pickFunctionsMap.values()).some(
|
|
3301
|
-
(
|
|
3302
|
+
(a) => ["move", "enter", "leave"].includes(a.type)
|
|
3302
3303
|
) && (this.pickListener.move = !0, this.addPickListener("move")), this.pickListener.down || Array.from(this.pickFunctionsMap.values()).some(
|
|
3303
|
-
(
|
|
3304
|
+
(a) => ["down", "downOutside", "click"].includes(a.type)
|
|
3304
3305
|
) && (this.pickListener.down = !0, this.addPickListener("down")), r;
|
|
3305
3306
|
}
|
|
3306
3307
|
removePick(e) {
|
|
@@ -3311,8 +3312,8 @@ class Rs {
|
|
|
3311
3312
|
return console.warn("handlePickNode:err:不支持 downOutside"), -1;
|
|
3312
3313
|
this.pickNodeFunctionsMapIndex += 1;
|
|
3313
3314
|
const i = this.pickNodeFunctionsMapIndex, r = e instanceof Function ? e() : e, o = [];
|
|
3314
|
-
for (const
|
|
3315
|
-
const h =
|
|
3315
|
+
for (const a of r) {
|
|
3316
|
+
const h = a;
|
|
3316
3317
|
h.element.style.pointerEvents = "auto";
|
|
3317
3318
|
const d = (p) => {
|
|
3318
3319
|
this.enabled && (p.preventDefault(), s({
|
|
@@ -3367,17 +3368,17 @@ class Us extends Rs {
|
|
|
3367
3368
|
getAllObject(e, t) {
|
|
3368
3369
|
e.includes("#") && console.warn("getAllObject:err:不支持 #", e);
|
|
3369
3370
|
const { key: s } = t || {}, i = `${e}${s ? `#${s}` : ""}`, r = [];
|
|
3370
|
-
return this.objects.forEach((o,
|
|
3371
|
-
(
|
|
3371
|
+
return this.objects.forEach((o, a) => {
|
|
3372
|
+
(a.startsWith(s ? i : `${i}#`) || a === i) && r.push(o);
|
|
3372
3373
|
}), r;
|
|
3373
3374
|
}
|
|
3374
3375
|
draw(e, t, s) {
|
|
3375
3376
|
return J(this, null, function* () {
|
|
3376
|
-
var r, o,
|
|
3377
|
+
var r, o, a, h;
|
|
3377
3378
|
const i = this.objectNamesToFactories.get(e);
|
|
3378
3379
|
if (i) {
|
|
3379
3380
|
t || (t = {}), t.target === void 0 && (t.target = s);
|
|
3380
|
-
const d = t.target, f = (r = t.onTop) != null ? r : 0, p = (o = t.prefab) != null ? o : !1, C = (
|
|
3381
|
+
const d = t.target, f = (r = t.onTop) != null ? r : 0, p = (o = t.prefab) != null ? o : !1, C = (a = t.create) != null ? a : !0, v = new i().create(t);
|
|
3381
3382
|
let m;
|
|
3382
3383
|
return d === null ? m = null : typeof d == "string" ? m = this.objects.get(d) : (h = d == null ? void 0 : d.objectType) != null && h.startsWith("BaseObject") || d ? m = d : p ? m = this.prefabGroup : m = this.group, C === !1 ? v.create = () => {
|
|
3383
3384
|
} : C !== !0 && (v.create = () => {
|
|
@@ -3398,17 +3399,17 @@ class Us extends Rs {
|
|
|
3398
3399
|
const i = e.objectType, [, r] = i.split("#");
|
|
3399
3400
|
let o = t.replace("$t:", r);
|
|
3400
3401
|
if (s) {
|
|
3401
|
-
const [,
|
|
3402
|
-
o = o.replace("$p:",
|
|
3402
|
+
const [, a] = s.split("#");
|
|
3403
|
+
o = o.replace("$p:", a);
|
|
3403
3404
|
}
|
|
3404
3405
|
return this.objects.has(o) && (o.includes("#") ? o += `-${Ue()}` : o += `#${Ue()}`), e.key = o, this.objects.set(o, e), o;
|
|
3405
3406
|
}
|
|
3406
3407
|
updateBaseObjectKey(e, t) {
|
|
3407
3408
|
var o;
|
|
3408
3409
|
let s;
|
|
3409
|
-
for (const [
|
|
3410
|
+
for (const [a, h] of this.objects.entries())
|
|
3410
3411
|
if (h === e) {
|
|
3411
|
-
s =
|
|
3412
|
+
s = a;
|
|
3412
3413
|
break;
|
|
3413
3414
|
}
|
|
3414
3415
|
const i = (o = e.parent) == null ? void 0 : o.key;
|
|
@@ -3504,10 +3505,10 @@ const ue = class ue {
|
|
|
3504
3505
|
transformControls: i
|
|
3505
3506
|
} = this.options;
|
|
3506
3507
|
if (this.init(), this.options.WebGPUTHREE || this.initComposer(), this.initCSSRenderer(), i && this.initTransformControls(), s) {
|
|
3507
|
-
const
|
|
3508
|
+
const a = new bt({
|
|
3508
3509
|
horizontal: !1
|
|
3509
3510
|
});
|
|
3510
|
-
|
|
3511
|
+
a.dom.style.position = "absolute", a.init(this.renderer), t.appendChild(a.dom), this.stats = a;
|
|
3511
3512
|
}
|
|
3512
3513
|
this.initResizeObserver(), this.tweenUpdateRaf();
|
|
3513
3514
|
}
|
|
@@ -3567,7 +3568,7 @@ const ue = class ue {
|
|
|
3567
3568
|
this.sceneController.setPageActive(e), t && ((s = this.cssRendererController) == null || s.render(t, this.camera)), this.cameraController.setPageActive(e), this.controlsController.setPageActive(e), this.loaderController.setPageActive(e), this.leadController.setPageActive(e), this.pageActiveIndex = e;
|
|
3568
3569
|
}
|
|
3569
3570
|
init() {
|
|
3570
|
-
var
|
|
3571
|
+
var n;
|
|
3571
3572
|
const {
|
|
3572
3573
|
container: e,
|
|
3573
3574
|
WebGPUTHREE: t,
|
|
@@ -3575,7 +3576,7 @@ const ue = class ue {
|
|
|
3575
3576
|
viewHelper: i,
|
|
3576
3577
|
renderer: r,
|
|
3577
3578
|
controls: o,
|
|
3578
|
-
loader:
|
|
3579
|
+
loader: a
|
|
3579
3580
|
} = this.options, { width: h, height: d } = this.getSize(), f = t ? new ts({
|
|
3580
3581
|
width: h,
|
|
3581
3582
|
height: d,
|
|
@@ -3592,12 +3593,12 @@ const ue = class ue {
|
|
|
3592
3593
|
height: d
|
|
3593
3594
|
}), C = new os({}), v = new as({
|
|
3594
3595
|
controlsParams: {
|
|
3595
|
-
domElement: (
|
|
3596
|
+
domElement: (n = o == null ? void 0 : o.domElement) != null ? n : f.renderer.domElement
|
|
3596
3597
|
}
|
|
3597
3598
|
}), m = new Ms({
|
|
3598
3599
|
loaderParams: z({
|
|
3599
3600
|
anisotropy: f.renderer.capabilities.getMaxAnisotropy()
|
|
3600
|
-
},
|
|
3601
|
+
}, a)
|
|
3601
3602
|
}), u = new zs({
|
|
3602
3603
|
pencil: this
|
|
3603
3604
|
});
|
|
@@ -3681,16 +3682,16 @@ const ue = class ue {
|
|
|
3681
3682
|
rendererController: i,
|
|
3682
3683
|
cameraController: r,
|
|
3683
3684
|
composerController: o,
|
|
3684
|
-
cssRendererController:
|
|
3685
|
+
cssRendererController: a,
|
|
3685
3686
|
leadController: h
|
|
3686
3687
|
} = this, d = this.renderer.getSize(new O.Vector2());
|
|
3687
|
-
d.x === e && d.y === t || (r.setSize(e, t), i.setSize(e, t), o == null || o.setSize(e, t),
|
|
3688
|
+
d.x === e && d.y === t || (r.setSize(e, t), i.setSize(e, t), o == null || o.setSize(e, t), a == null || a.setSize(e, t), h.setSize(e, t), this.installPlugins.forEach((f) => {
|
|
3688
3689
|
var p;
|
|
3689
3690
|
(p = f.setSize) == null || p.call(f, e, t);
|
|
3690
3691
|
}), this.render(), s && this.event.emit("resize", { width: e, height: t }));
|
|
3691
3692
|
}
|
|
3692
3693
|
setDevicePixelRatio(e) {
|
|
3693
|
-
var
|
|
3694
|
+
var a;
|
|
3694
3695
|
this.userSetDprCache = e;
|
|
3695
3696
|
const { width: t, height: s } = this.getSize();
|
|
3696
3697
|
let i = Math.sqrt(this.maxBackufferArea / (t * s));
|
|
@@ -3703,12 +3704,12 @@ const ue = class ue {
|
|
|
3703
3704
|
r
|
|
3704
3705
|
);
|
|
3705
3706
|
const o = this.renderer.getPixelRatio();
|
|
3706
|
-
r !== o && (this.rendererController.setPixelRatio(r), (
|
|
3707
|
+
r !== o && (this.rendererController.setPixelRatio(r), (a = this.composerController) == null || a.setPixelRatio(r));
|
|
3707
3708
|
}
|
|
3708
3709
|
pick(e, t, s = !0) {
|
|
3709
|
-
const { raycaster: i, options: r } = this, { container: o } = r,
|
|
3710
|
-
if (
|
|
3711
|
-
i.setFromCamera(
|
|
3710
|
+
const { raycaster: i, options: r } = this, { container: o } = r, a = new O.Vector2(), h = o.getBoundingClientRect();
|
|
3711
|
+
if (a.x = (e.clientX - h.left) / (h.right - h.left) * 2 - 1, a.y = -((e.clientY - h.top) / (h.bottom - h.top)) * 2 + 1, this.camera && this.scene) {
|
|
3712
|
+
i.setFromCamera(a, this.camera);
|
|
3712
3713
|
const d = i.intersectObjects(
|
|
3713
3714
|
t || this.scene.children,
|
|
3714
3715
|
s
|
|
@@ -3722,7 +3723,7 @@ const ue = class ue {
|
|
|
3722
3723
|
}
|
|
3723
3724
|
}
|
|
3724
3725
|
render() {
|
|
3725
|
-
var s, i, r, o,
|
|
3726
|
+
var s, i, r, o, a, h;
|
|
3726
3727
|
if (!this.camera || !this.scene)
|
|
3727
3728
|
return;
|
|
3728
3729
|
this.timer.update(), ye.update();
|
|
@@ -3734,7 +3735,7 @@ const ue = class ue {
|
|
|
3734
3735
|
e,
|
|
3735
3736
|
this.controlsController,
|
|
3736
3737
|
this.cameraTarget
|
|
3737
|
-
), (i = this.composerController) != null && i.active ? this.composerController.render() : (r = this.rendererController) == null || r.render(this.scene, this.camera), (o = this.helperController) == null || o.renderViewHelper(this.renderer), (
|
|
3738
|
+
), (i = this.composerController) != null && i.active ? this.composerController.render() : (r = this.rendererController) == null || r.render(this.scene, this.camera), (o = this.helperController) == null || o.renderViewHelper(this.renderer), (a = this.cssRendererController) == null || a.render(this.scene, this.camera), (h = this.stats) == null || h.update(), this.event.emit("render", { delta: e, elapsed: t });
|
|
3738
3739
|
}
|
|
3739
3740
|
start() {
|
|
3740
3741
|
window.cancelAnimationFrame(this.TweenRaf), this.renderer.setAnimationLoop(this.render.bind(this)), this.event.emit("start");
|
|
@@ -3772,11 +3773,11 @@ const ue = class ue {
|
|
|
3772
3773
|
}
|
|
3773
3774
|
}
|
|
3774
3775
|
dispose() {
|
|
3775
|
-
var e, t, s, i, r, o,
|
|
3776
|
+
var e, t, s, i, r, o, a, h, d, f, p, C, v;
|
|
3776
3777
|
this.stop(), this.timer.dispose(), ye.removeAll(), this.event.removeAllListeners(), (e = this.resizeObserver) == null || e.unobserve(this.options.container), this.installPlugins.forEach((m) => {
|
|
3777
3778
|
var u;
|
|
3778
3779
|
(u = m.dispose) == null || u.call(m);
|
|
3779
|
-
}), (t = this.controlsController) == null || t.dispose(), (s = this.transformController) == null || s.dispose(), (i = this.cssRendererController) == null || i.dispose(), (r = this.sceneController) == null || r.dispose(), (o = this.cameraController) == null || o.dispose(), (
|
|
3780
|
+
}), (t = this.controlsController) == null || t.dispose(), (s = this.transformController) == null || s.dispose(), (i = this.cssRendererController) == null || i.dispose(), (r = this.sceneController) == null || r.dispose(), (o = this.cameraController) == null || o.dispose(), (a = this.helperController) == null || a.dispose(), (h = this.composerController) == null || h.dispose(), (d = this.rendererController) == null || d.dispose(), (f = this.loaderController) == null || f.dispose(), (p = this.leadController) == null || p.dispose(), this.cssRendererController = void 0, this.installPlugins.clear(), (C = this.stats) == null || C.dom.remove(), (v = this.renderer) == null || v.domElement.remove();
|
|
3780
3781
|
}
|
|
3781
3782
|
};
|
|
3782
3783
|
ue.options = {
|
|
@@ -3800,11 +3801,11 @@ ue.options = {
|
|
|
3800
3801
|
css3DRendererParams: z({}, $e)
|
|
3801
3802
|
};
|
|
3802
3803
|
let et = ue;
|
|
3803
|
-
const
|
|
3804
|
+
const _i = $.ACTION;
|
|
3804
3805
|
export {
|
|
3805
3806
|
Mt as BaseObject,
|
|
3806
3807
|
et as Pencil,
|
|
3807
3808
|
At as ResourceTracker,
|
|
3808
|
-
|
|
3809
|
+
_i as cameraControlsAction,
|
|
3809
3810
|
et as default
|
|
3810
3811
|
};
|