gl-draw 0.14.21 → 0.14.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/Lead/Lead.d.ts +2 -1
- package/dist/index.js +2 -2
- package/dist/index.module.js +222 -210
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +1 -1
- package/package.json +1 -1
package/dist/index.module.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var ft = Object.defineProperty, _t = Object.defineProperties;
|
|
2
2
|
var gt = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Le = Object.getOwnPropertySymbols;
|
|
4
|
-
var vt = Object.prototype.hasOwnProperty,
|
|
4
|
+
var vt = Object.prototype.hasOwnProperty, yt = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var Se = (l, e, t) => e in l ? ft(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t, z = (l, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
7
|
vt.call(e, t) && Se(l, t, e[t]);
|
|
8
8
|
if (Le)
|
|
9
9
|
for (var t of Le(e))
|
|
10
|
-
|
|
10
|
+
yt.call(e, t) && Se(l, t, e[t]);
|
|
11
11
|
return l;
|
|
12
12
|
}, Q = (l, e) => _t(l, gt(e));
|
|
13
13
|
var J = (l, e, t) => new Promise((s, i) => {
|
|
@@ -27,9 +27,9 @@ var J = (l, e, t) => new Promise((s, i) => {
|
|
|
27
27
|
a((t = t.apply(l, e)).next());
|
|
28
28
|
});
|
|
29
29
|
import * as O from "three";
|
|
30
|
-
import { Vector3 as oe, Quaternion as
|
|
30
|
+
import { Vector3 as oe, Quaternion as Ct, Matrix4 as fe, UniformsUtils as Et, RawShaderMaterial as Ot } from "three";
|
|
31
31
|
import { Timer as Tt } from "three/examples/jsm/misc/Timer";
|
|
32
|
-
import * as
|
|
32
|
+
import * as ye from "@tweenjs/tween.js";
|
|
33
33
|
import xt from "deepmerge";
|
|
34
34
|
import wt from "stats-gl";
|
|
35
35
|
import { C as bt, c as Pt, i as Lt } from "./isPlainObject.module.js";
|
|
@@ -57,7 +57,7 @@ import { GLTFLoader as De } from "three/examples/jsm/loaders/GLTFLoader";
|
|
|
57
57
|
import { DRACOLoader as It } from "three/examples/jsm/loaders/DRACOLoader";
|
|
58
58
|
import { EXRLoader as jt } from "three/examples/jsm/loaders/EXRLoader";
|
|
59
59
|
import { LottieLoader as Vt } from "three/examples/jsm/loaders/LottieLoader";
|
|
60
|
-
import { makePromiseCreator as
|
|
60
|
+
import { makePromiseCreator as Bt, generateUUID as Re } from "esus-lite";
|
|
61
61
|
const D = {
|
|
62
62
|
LEFT: 1,
|
|
63
63
|
RIGHT: 2,
|
|
@@ -89,7 +89,7 @@ const D = {
|
|
|
89
89
|
IN: 1,
|
|
90
90
|
OUT: -1
|
|
91
91
|
};
|
|
92
|
-
function
|
|
92
|
+
function B(l) {
|
|
93
93
|
return l.isPerspectiveCamera;
|
|
94
94
|
}
|
|
95
95
|
function j(l) {
|
|
@@ -120,27 +120,27 @@ function he(l, e, t, s, i = 1 / 0, r) {
|
|
|
120
120
|
let d = l - e;
|
|
121
121
|
const f = e, p = i * s;
|
|
122
122
|
d = F(d, -p, p), e = l - d;
|
|
123
|
-
const
|
|
124
|
-
t.value = (t.value - o *
|
|
125
|
-
let v = e + (d +
|
|
123
|
+
const C = (t.value + o * d) * r;
|
|
124
|
+
t.value = (t.value - o * C) * h;
|
|
125
|
+
let v = e + (d + C) * h;
|
|
126
126
|
return f - l > 0 == v > f && (v = f, t.value = (v - f) / r), v;
|
|
127
127
|
}
|
|
128
128
|
function ke(l, e, t, s, i = 1 / 0, r, o) {
|
|
129
129
|
s = Math.max(1e-4, s);
|
|
130
130
|
const a = 2 / s, h = a * r, d = 1 / (1 + h + 0.48 * h * h + 0.235 * h * h * h);
|
|
131
|
-
let f = e.x, p = e.y,
|
|
132
|
-
const
|
|
133
|
-
if (w >
|
|
131
|
+
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, n = p, _ = C, E = i * s, y = E * E, w = v * v + m * m + u * u;
|
|
133
|
+
if (w > y) {
|
|
134
134
|
const ve = Math.sqrt(w);
|
|
135
135
|
v = v / ve * E, m = m / ve * E, u = u / ve * E;
|
|
136
136
|
}
|
|
137
|
-
f = l.x - v, p = l.y - m,
|
|
137
|
+
f = l.x - v, p = l.y - m, C = l.z - u;
|
|
138
138
|
const T = (t.x + a * v) * r, P = (t.y + a * m) * r, R = (t.z + a * u) * r;
|
|
139
|
-
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 =
|
|
140
|
-
const V =
|
|
141
|
-
return V * pt + ae * mt + dt * ut > 0 && (o.x =
|
|
139
|
+
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;
|
|
140
|
+
const V = g - l.x, ae = n - l.y, dt = _ - l.z, pt = o.x - g, mt = o.y - n, ut = o.z - _;
|
|
141
|
+
return V * pt + ae * mt + dt * ut > 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
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function Ce(l, e) {
|
|
144
144
|
e.set(0, 0), l.forEach((t) => {
|
|
145
145
|
e.x += t.clientX, e.y += t.clientY;
|
|
146
146
|
}), e.x /= l.length, e.y /= l.length;
|
|
@@ -148,7 +148,7 @@ function ye(l, e) {
|
|
|
148
148
|
function Ee(l, e) {
|
|
149
149
|
return j(l) ? (console.warn(`${e} is not supported in OrthographicCamera`), !0) : !1;
|
|
150
150
|
}
|
|
151
|
-
class
|
|
151
|
+
class Yt {
|
|
152
152
|
constructor() {
|
|
153
153
|
this._listeners = {};
|
|
154
154
|
}
|
|
@@ -213,8 +213,8 @@ class Bt {
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
const le = 1 / 8, Zt = /Mac/.test(navigator.platform);
|
|
216
|
-
let x, Fe, ce, Oe, U, b, L, G, ie, N, H,
|
|
217
|
-
class $ extends
|
|
216
|
+
let x, Fe, ce, Oe, U, b, L, G, ie, N, H, Y, Ne, He, k, re, K, Ie, Te, je, xe, we, de;
|
|
217
|
+
class $ extends Yt {
|
|
218
218
|
/**
|
|
219
219
|
* Injects THREE as the dependency. You can then proceed to use CameraControls.
|
|
220
220
|
*
|
|
@@ -256,7 +256,7 @@ class $ extends Bt {
|
|
|
256
256
|
* @category Statics
|
|
257
257
|
*/
|
|
258
258
|
static install(e) {
|
|
259
|
-
x = e.THREE, Fe = Object.freeze(new x.Vector3(0, 0, 0)), ce = Object.freeze(new x.Vector3(0, 1, 0)), Oe = Object.freeze(new x.Vector3(0, 0, 1)), U = new x.Vector2(), b = new x.Vector3(), L = new x.Vector3(), G = new x.Vector3(), ie = new x.Vector3(), N = new x.Vector3(), H = new x.Vector3(),
|
|
259
|
+
x = e.THREE, Fe = Object.freeze(new x.Vector3(0, 0, 0)), ce = Object.freeze(new x.Vector3(0, 1, 0)), Oe = Object.freeze(new x.Vector3(0, 0, 1)), U = new x.Vector2(), b = new x.Vector3(), L = new x.Vector3(), G = new x.Vector3(), ie = new x.Vector3(), N = new x.Vector3(), H = new x.Vector3(), Y = new x.Vector3(), Ne = new x.Vector3(), He = new x.Vector3(), k = new x.Spherical(), re = new x.Spherical(), K = new x.Box3(), Ie = new x.Box3(), Te = new x.Sphere(), je = new x.Quaternion(), xe = new x.Quaternion(), we = new x.Matrix4(), de = new x.Raycaster();
|
|
260
260
|
}
|
|
261
261
|
/**
|
|
262
262
|
* list all ACTIONs
|
|
@@ -284,17 +284,17 @@ class $ extends Bt {
|
|
|
284
284
|
*/
|
|
285
285
|
constructor(e, t) {
|
|
286
286
|
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 = (n,
|
|
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 = (n, _, E, y) => {
|
|
288
288
|
let w, T;
|
|
289
|
-
if (
|
|
289
|
+
if (B(this._camera)) {
|
|
290
290
|
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 * n * V / this._elementRect.height, T = this.truckSpeed *
|
|
291
|
+
w = this.truckSpeed * n * V / this._elementRect.height, T = this.truckSpeed * _ * V / this._elementRect.height;
|
|
292
292
|
} else if (j(this._camera)) {
|
|
293
293
|
const P = this._camera;
|
|
294
|
-
w = this.truckSpeed * n * (P.right - P.left) / P.zoom / this._elementRect.width, T = this.truckSpeed *
|
|
294
|
+
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
295
|
} else
|
|
296
296
|
return;
|
|
297
|
-
|
|
297
|
+
y ? (E ? this.setFocalOffset(
|
|
298
298
|
this._focalOffsetEnd.x + w,
|
|
299
299
|
this._focalOffsetEnd.y,
|
|
300
300
|
this._focalOffsetEnd.z,
|
|
@@ -305,19 +305,19 @@ class $ extends Bt {
|
|
|
305
305
|
this._focalOffsetEnd.z,
|
|
306
306
|
!0
|
|
307
307
|
) : this.truck(w, T, !0);
|
|
308
|
-
}, this._rotateInternal = (n,
|
|
309
|
-
const E = W * this.azimuthRotateSpeed * n / this._elementRect.height,
|
|
310
|
-
this.rotate(E,
|
|
311
|
-
}, this._dollyInternal = (n,
|
|
312
|
-
const
|
|
308
|
+
}, this._rotateInternal = (n, _) => {
|
|
309
|
+
const E = W * this.azimuthRotateSpeed * n / this._elementRect.height, y = W * this.polarRotateSpeed * _ / this._elementRect.height;
|
|
310
|
+
this.rotate(E, y, !0);
|
|
311
|
+
}, this._dollyInternal = (n, _, E) => {
|
|
312
|
+
const y = Math.pow(0.95, -n * this.dollySpeed), w = this._sphericalEnd.radius, T = this._sphericalEnd.radius * y, P = F(
|
|
313
313
|
T,
|
|
314
314
|
this.minDistance,
|
|
315
315
|
this.maxDistance
|
|
316
316
|
), 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(
|
|
318
|
-
}, this._zoomInternal = (n,
|
|
319
|
-
const
|
|
320
|
-
this.zoomTo(T, !0), this.dollyToCursor && (this._changedZoom += T - w, this._dollyControlCoord.set(
|
|
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(-n);
|
|
318
|
+
}, this._zoomInternal = (n, _, E) => {
|
|
319
|
+
const y = Math.pow(0.95, n * this.dollySpeed), w = this._zoom, T = this._zoom * y;
|
|
320
|
+
this.zoomTo(T, !0), this.dollyToCursor && (this._changedZoom += T - w, this._dollyControlCoord.set(_, E));
|
|
321
321
|
}, typeof x == "undefined" && console.error(
|
|
322
322
|
"camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."
|
|
323
323
|
), this._camera = e, this._yAxisUpSpace = new x.Quaternion().setFromUnitVectors(
|
|
@@ -337,23 +337,23 @@ class $ extends Bt {
|
|
|
337
337
|
left: c.ROTATE,
|
|
338
338
|
middle: c.DOLLY,
|
|
339
339
|
right: c.TRUCK,
|
|
340
|
-
wheel:
|
|
340
|
+
wheel: B(this._camera) ? c.DOLLY : j(this._camera) ? c.ZOOM : c.NONE
|
|
341
341
|
}, this.touches = {
|
|
342
342
|
one: c.TOUCH_ROTATE,
|
|
343
|
-
two:
|
|
343
|
+
two: B(this._camera) ? c.TOUCH_DOLLY_TRUCK : j(this._camera) ? c.TOUCH_ZOOM_TRUCK : c.NONE,
|
|
344
344
|
three: c.TOUCH_TRUCK
|
|
345
345
|
};
|
|
346
346
|
const s = new x.Vector2(), i = new x.Vector2(), r = new x.Vector2(), o = (n) => {
|
|
347
347
|
if (!this._enabled || !this._domElement) return;
|
|
348
348
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
349
|
-
const
|
|
349
|
+
const y = this._domElement.getBoundingClientRect(), w = (n.clientX - y.left) / (y.right - y.left), T = (n.clientY - y.top) / (y.bottom - y.top);
|
|
350
350
|
if (w < this._interactiveArea.left || w > this._interactiveArea.right || T < this._interactiveArea.top || T > this._interactiveArea.bottom)
|
|
351
351
|
return;
|
|
352
352
|
}
|
|
353
|
-
const
|
|
354
|
-
if (
|
|
355
|
-
const
|
|
356
|
-
|
|
353
|
+
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
|
+
if (_ !== null) {
|
|
355
|
+
const y = this._findPointerByMouseButton(_);
|
|
356
|
+
y && this._disposePointer(y);
|
|
357
357
|
}
|
|
358
358
|
if ((n.buttons & D.LEFT) === D.LEFT && this._lockedPointer)
|
|
359
359
|
return;
|
|
@@ -363,7 +363,7 @@ class $ extends Bt {
|
|
|
363
363
|
clientY: n.clientY,
|
|
364
364
|
deltaX: 0,
|
|
365
365
|
deltaY: 0,
|
|
366
|
-
mouseButton:
|
|
366
|
+
mouseButton: _
|
|
367
367
|
};
|
|
368
368
|
this._activePointers.push(E), this._domElement.ownerDocument.removeEventListener(
|
|
369
369
|
"pointermove",
|
|
@@ -376,10 +376,10 @@ class $ extends Bt {
|
|
|
376
376
|
"pointermove",
|
|
377
377
|
a,
|
|
378
378
|
{ passive: !1 }
|
|
379
|
-
), this._domElement.ownerDocument.addEventListener("pointerup", h), this._isDragging = !0,
|
|
379
|
+
), this._domElement.ownerDocument.addEventListener("pointerup", h), this._isDragging = !0, C(n);
|
|
380
380
|
}, a = (n) => {
|
|
381
381
|
n.cancelable && n.preventDefault();
|
|
382
|
-
const
|
|
382
|
+
const _ = n.pointerId, E = this._lockedPointer || this._findPointerById(_);
|
|
383
383
|
if (E) {
|
|
384
384
|
if (E.clientX = n.clientX, E.clientY = n.clientY, E.deltaX = n.movementX, E.deltaY = n.movementY, this._state = 0, n.pointerType === "touch")
|
|
385
385
|
switch (this._activePointers.length) {
|
|
@@ -398,9 +398,9 @@ class $ extends Bt {
|
|
|
398
398
|
v();
|
|
399
399
|
}
|
|
400
400
|
}, h = (n) => {
|
|
401
|
-
const
|
|
402
|
-
if (!(
|
|
403
|
-
if (
|
|
401
|
+
const _ = this._findPointerById(n.pointerId);
|
|
402
|
+
if (!(_ && _ === this._lockedPointer)) {
|
|
403
|
+
if (_ && this._disposePointer(_), n.pointerType === "touch")
|
|
404
404
|
switch (this._activePointers.length) {
|
|
405
405
|
case 0:
|
|
406
406
|
this._state = c.NONE;
|
|
@@ -432,7 +432,7 @@ class $ extends Bt {
|
|
|
432
432
|
const T = performance.now();
|
|
433
433
|
d - T < 1e3 && this._getClientRect(this._elementRect), d = T;
|
|
434
434
|
}
|
|
435
|
-
const
|
|
435
|
+
const _ = Zt ? -1 : -3, E = n.deltaMode === 1 ? 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
436
|
switch (this.mouseButtons.wheel) {
|
|
437
437
|
case c.ROTATE: {
|
|
438
438
|
this._rotateInternal(n.deltaX, n.deltaY), this._isUserControllingRotate = !0;
|
|
@@ -451,11 +451,11 @@ class $ extends Bt {
|
|
|
451
451
|
break;
|
|
452
452
|
}
|
|
453
453
|
case c.DOLLY: {
|
|
454
|
-
this._dollyInternal(-E,
|
|
454
|
+
this._dollyInternal(-E, y, w), this._isUserControllingDolly = !0;
|
|
455
455
|
break;
|
|
456
456
|
}
|
|
457
457
|
case c.ZOOM: {
|
|
458
|
-
this._zoomInternal(-E,
|
|
458
|
+
this._zoomInternal(-E, y, w), this._isUserControllingZoom = !0;
|
|
459
459
|
break;
|
|
460
460
|
}
|
|
461
461
|
}
|
|
@@ -463,7 +463,7 @@ class $ extends Bt {
|
|
|
463
463
|
}, p = (n) => {
|
|
464
464
|
if (!(!this._domElement || !this._enabled)) {
|
|
465
465
|
if (this.mouseButtons.right === $.ACTION.NONE) {
|
|
466
|
-
const
|
|
466
|
+
const _ = n instanceof PointerEvent ? n.pointerId : 0, E = this._findPointerById(_);
|
|
467
467
|
E && this._disposePointer(E), this._domElement.ownerDocument.removeEventListener(
|
|
468
468
|
"pointermove",
|
|
469
469
|
a,
|
|
@@ -476,10 +476,10 @@ class $ extends Bt {
|
|
|
476
476
|
}
|
|
477
477
|
n.preventDefault();
|
|
478
478
|
}
|
|
479
|
-
},
|
|
479
|
+
}, C = (n) => {
|
|
480
480
|
if (!this._enabled) return;
|
|
481
|
-
if (
|
|
482
|
-
const E = U.x - this._activePointers[1].clientX,
|
|
481
|
+
if (Ce(this._activePointers, U), this._getClientRect(this._elementRect), s.copy(U), i.copy(U), this._activePointers.length >= 2) {
|
|
482
|
+
const E = U.x - this._activePointers[1].clientX, y = U.y - this._activePointers[1].clientY, w = Math.sqrt(E * E + y * y);
|
|
483
483
|
r.set(0, w);
|
|
484
484
|
const T = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, P = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
|
|
485
485
|
i.set(T, P);
|
|
@@ -503,16 +503,16 @@ class $ extends Bt {
|
|
|
503
503
|
((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
504
|
}, v = () => {
|
|
505
505
|
if (!this._enabled || !this._dragNeedsUpdate) return;
|
|
506
|
-
this._dragNeedsUpdate = !1,
|
|
507
|
-
const
|
|
508
|
-
if (i.copy(U), ((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._rotateInternal(E,
|
|
506
|
+
this._dragNeedsUpdate = !1, Ce(this._activePointers, U);
|
|
507
|
+
const _ = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, E = _ ? -_.deltaX : i.x - U.x, y = _ ? -_.deltaY : i.y - U.y;
|
|
508
|
+
if (i.copy(U), ((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._rotateInternal(E, y), this._isUserControllingRotate = !0), (this._state & c.DOLLY) === c.DOLLY || (this._state & c.ZOOM) === c.ZOOM) {
|
|
509
509
|
const w = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, T = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, P = this.dollyDragInverted ? -1 : 1;
|
|
510
510
|
(this._state & c.DOLLY) === c.DOLLY ? (this._dollyInternal(
|
|
511
|
-
P *
|
|
511
|
+
P * y * le,
|
|
512
512
|
w,
|
|
513
513
|
T
|
|
514
514
|
), this._isUserControllingDolly = !0) : (this._zoomInternal(
|
|
515
|
-
P *
|
|
515
|
+
P * y * le,
|
|
516
516
|
w,
|
|
517
517
|
T
|
|
518
518
|
), this._isUserControllingZoom = !0);
|
|
@@ -523,9 +523,9 @@ class $ extends Bt {
|
|
|
523
523
|
const V = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, ae = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
524
524
|
(this._state & c.TOUCH_DOLLY) === c.TOUCH_DOLLY || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (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._dollyInternal(R * le, V, ae), this._isUserControllingDolly = !0) : (this._zoomInternal(R * le, V, ae), this._isUserControllingZoom = !0);
|
|
525
525
|
}
|
|
526
|
-
((this._state & c.TRUCK) === c.TRUCK || (this._state & c.TOUCH_TRUCK) === c.TOUCH_TRUCK || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK) && (this._truckInternal(E,
|
|
526
|
+
((this._state & c.TRUCK) === c.TRUCK || (this._state & c.TOUCH_TRUCK) === c.TOUCH_TRUCK || (this._state & c.TOUCH_DOLLY_TRUCK) === c.TOUCH_DOLLY_TRUCK || (this._state & c.TOUCH_ZOOM_TRUCK) === c.TOUCH_ZOOM_TRUCK) && (this._truckInternal(E, y, !1, !1), this._isUserControllingTruck = !0), ((this._state & c.SCREEN_PAN) === c.SCREEN_PAN || (this._state & c.TOUCH_SCREEN_PAN) === c.TOUCH_SCREEN_PAN || (this._state & c.TOUCH_DOLLY_SCREEN_PAN) === c.TOUCH_DOLLY_SCREEN_PAN || (this._state & c.TOUCH_ZOOM_SCREEN_PAN) === c.TOUCH_ZOOM_SCREEN_PAN) && (this._truckInternal(E, y, !1, !0), this._isUserControllingTruck = !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._truckInternal(E, y, !0, !1), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
|
|
527
527
|
}, m = () => {
|
|
528
|
-
|
|
528
|
+
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
529
|
"pointermove",
|
|
530
530
|
a,
|
|
531
531
|
{ passive: !1 }
|
|
@@ -554,25 +554,25 @@ class $ extends Bt {
|
|
|
554
554
|
u
|
|
555
555
|
), this._domElement.ownerDocument.addEventListener(
|
|
556
556
|
"pointerlockerror",
|
|
557
|
-
|
|
557
|
+
g
|
|
558
558
|
), this._domElement.ownerDocument.addEventListener(
|
|
559
559
|
"pointermove",
|
|
560
560
|
a,
|
|
561
561
|
{ passive: !1 }
|
|
562
|
-
), this._domElement.ownerDocument.addEventListener("pointerup", h),
|
|
562
|
+
), this._domElement.ownerDocument.addEventListener("pointerup", h), C());
|
|
563
563
|
}, this.unlockPointer = () => {
|
|
564
|
-
var n,
|
|
565
|
-
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (n = this._domElement) === null || n === void 0 || n.ownerDocument.exitPointerLock(), (
|
|
564
|
+
var n, _, E;
|
|
565
|
+
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
566
|
"pointerlockchange",
|
|
567
567
|
u
|
|
568
568
|
), (E = this._domElement) === null || E === void 0 || E.ownerDocument.removeEventListener(
|
|
569
569
|
"pointerlockerror",
|
|
570
|
-
|
|
570
|
+
g
|
|
571
571
|
), this.cancel();
|
|
572
572
|
};
|
|
573
573
|
const u = () => {
|
|
574
574
|
this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement || this.unlockPointer();
|
|
575
|
-
},
|
|
575
|
+
}, g = () => {
|
|
576
576
|
this.unlockPointer();
|
|
577
577
|
};
|
|
578
578
|
this._addAllEventListeners = (n) => {
|
|
@@ -594,7 +594,7 @@ class $ extends Bt {
|
|
|
594
594
|
u
|
|
595
595
|
), this._domElement.ownerDocument.removeEventListener(
|
|
596
596
|
"pointerlockerror",
|
|
597
|
-
|
|
597
|
+
g
|
|
598
598
|
));
|
|
599
599
|
}, this.cancel = () => {
|
|
600
600
|
this._state !== c.NONE && (this._state = c.NONE, this._activePointers.length = 0, m());
|
|
@@ -1028,23 +1028,23 @@ class $ extends Bt {
|
|
|
1028
1028
|
), Promise.resolve());
|
|
1029
1029
|
const f = ze(this._sphericalEnd.theta, Ue), p = ze(this._sphericalEnd.phi, Ue);
|
|
1030
1030
|
h.push(this.rotateTo(f, p, t));
|
|
1031
|
-
const
|
|
1031
|
+
const C = b.setFromSpherical(this._sphericalEnd).normalize(), v = je.setFromUnitVectors(C, Oe), m = S(Math.abs(C.y), 1);
|
|
1032
1032
|
m && v.multiply(xe.setFromAxisAngle(ce, f)), v.multiply(this._yAxisUpSpaceInverse);
|
|
1033
1033
|
const u = Ie.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 += a, v.setFromUnitVectors(Oe,
|
|
1035
|
-
const
|
|
1036
|
-
if (
|
|
1037
|
-
const
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
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 += a, v.setFromUnitVectors(Oe, C), m && v.premultiply(xe.invert()), v.premultiply(this._yAxisUpSpace);
|
|
1035
|
+
const g = u.getSize(b), n = u.getCenter(L).applyQuaternion(v);
|
|
1036
|
+
if (B(this._camera)) {
|
|
1037
|
+
const _ = this.getDistanceToFitBox(
|
|
1038
|
+
g.x,
|
|
1039
|
+
g.y,
|
|
1040
|
+
g.z,
|
|
1041
1041
|
s
|
|
1042
1042
|
);
|
|
1043
1043
|
h.push(
|
|
1044
1044
|
this.moveTo(n.x, n.y, n.z, t)
|
|
1045
|
-
), h.push(this.dollyTo(
|
|
1045
|
+
), h.push(this.dollyTo(_, t)), h.push(this.setFocalOffset(0, 0, 0, t));
|
|
1046
1046
|
} else if (j(this._camera)) {
|
|
1047
|
-
const
|
|
1047
|
+
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
1048
|
h.push(
|
|
1049
1049
|
this.moveTo(n.x, n.y, n.z, t)
|
|
1050
1050
|
), h.push(this.zoomTo(w, t)), h.push(this.setFocalOffset(0, 0, 0, t));
|
|
@@ -1066,7 +1066,7 @@ class $ extends Bt {
|
|
|
1066
1066
|
r.center.z,
|
|
1067
1067
|
t
|
|
1068
1068
|
)
|
|
1069
|
-
),
|
|
1069
|
+
), B(this._camera)) {
|
|
1070
1070
|
const o = this.getDistanceToFitSphere(r.radius);
|
|
1071
1071
|
s.push(this.dollyTo(o, t));
|
|
1072
1072
|
} else if (j(this._camera)) {
|
|
@@ -1125,20 +1125,20 @@ class $ extends Bt {
|
|
|
1125
1125
|
* @param enableTransition
|
|
1126
1126
|
* @category Methods
|
|
1127
1127
|
*/
|
|
1128
|
-
lerpLookAt(e, t, s, i, r, o, a, h, d, f, p,
|
|
1128
|
+
lerpLookAt(e, t, s, i, r, o, a, h, d, f, p, C, v, m = !1) {
|
|
1129
1129
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = Z.NONE, this._changedDolly = 0;
|
|
1130
|
-
const u = b.set(i, r, o),
|
|
1130
|
+
const u = b.set(i, r, o), g = L.set(e, t, s);
|
|
1131
1131
|
k.setFromVector3(
|
|
1132
|
-
|
|
1132
|
+
g.sub(u).applyQuaternion(this._yAxisUpSpace)
|
|
1133
1133
|
);
|
|
1134
|
-
const n = G.set(f, p,
|
|
1134
|
+
const n = G.set(f, p, C), _ = L.set(a, h, d);
|
|
1135
1135
|
re.setFromVector3(
|
|
1136
|
-
|
|
1136
|
+
_.sub(n).applyQuaternion(this._yAxisUpSpace)
|
|
1137
1137
|
), this._targetEnd.copy(u.lerp(n, v));
|
|
1138
|
-
const E = re.theta - k.theta,
|
|
1138
|
+
const E = re.theta - k.theta, y = re.phi - k.phi, w = re.radius - k.radius;
|
|
1139
1139
|
this._sphericalEnd.set(
|
|
1140
1140
|
k.radius + w * v,
|
|
1141
|
-
k.phi +
|
|
1141
|
+
k.phi + y * v,
|
|
1142
1142
|
k.theta + E * v
|
|
1143
1143
|
), this.normalizeRotations(), this._needsUpdate = !0, m || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
1144
1144
|
const T = !m || 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(
|
|
@@ -1235,9 +1235,9 @@ class $ extends Bt {
|
|
|
1235
1235
|
* @category Methods
|
|
1236
1236
|
*/
|
|
1237
1237
|
setOrbitPoint(e, t, s) {
|
|
1238
|
-
this._camera.updateMatrixWorld(), N.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), H.setFromMatrixColumn(this._camera.matrixWorldInverse, 1),
|
|
1238
|
+
this._camera.updateMatrixWorld(), N.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), H.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Y.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
|
|
1239
1239
|
const i = b.set(e, t, s), r = i.distanceTo(this._camera.position), o = i.sub(this._camera.position);
|
|
1240
|
-
N.multiplyScalar(o.x), H.multiplyScalar(o.y),
|
|
1240
|
+
N.multiplyScalar(o.x), H.multiplyScalar(o.y), Y.multiplyScalar(o.z), b.copy(N).add(H).add(Y), b.z = b.z + r, this.dollyTo(r, !1), this.setFocalOffset(-b.x, b.y, -b.z, !1), this.moveTo(e, t, s, !1);
|
|
1241
1241
|
}
|
|
1242
1242
|
/**
|
|
1243
1243
|
* Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
|
|
@@ -1494,40 +1494,40 @@ class $ extends Bt {
|
|
|
1494
1494
|
);
|
|
1495
1495
|
}
|
|
1496
1496
|
if (this.dollyToCursor) {
|
|
1497
|
-
if (
|
|
1498
|
-
const p = this._spherical.radius - this._lastDistance,
|
|
1497
|
+
if (B(this._camera) && this._changedDolly !== 0) {
|
|
1498
|
+
const p = this._spherical.radius - this._lastDistance, C = this._camera, v = this._getCameraDirection(ie), m = b.copy(v).cross(C.up).normalize();
|
|
1499
1499
|
m.lengthSq() === 0 && (m.x = 1);
|
|
1500
|
-
const u = L.crossVectors(m, v),
|
|
1500
|
+
const u = L.crossVectors(m, v), g = this._sphericalEnd.radius * Math.tan(C.getEffectiveFOV() * ee * 0.5), _ = (this._sphericalEnd.radius - p - this._sphericalEnd.radius) / this._sphericalEnd.radius, E = G.copy(this._targetEnd).add(
|
|
1501
1501
|
m.multiplyScalar(
|
|
1502
|
-
this._dollyControlCoord.x *
|
|
1502
|
+
this._dollyControlCoord.x * g * C.aspect
|
|
1503
1503
|
)
|
|
1504
1504
|
).add(
|
|
1505
|
-
u.multiplyScalar(this._dollyControlCoord.y *
|
|
1506
|
-
),
|
|
1505
|
+
u.multiplyScalar(this._dollyControlCoord.y * g)
|
|
1506
|
+
), y = b.copy(this._targetEnd).lerp(E, _), w = this._lastDollyDirection === Z.IN && this._spherical.radius <= this.minDistance, T = this._lastDollyDirection === Z.OUT && this.maxDistance <= this._spherical.radius;
|
|
1507
1507
|
if (this.infinityDolly && (w || T)) {
|
|
1508
1508
|
this._sphericalEnd.radius -= p, this._spherical.radius -= p;
|
|
1509
1509
|
const R = L.copy(v).multiplyScalar(-p);
|
|
1510
|
-
|
|
1510
|
+
y.add(R);
|
|
1511
1511
|
}
|
|
1512
|
-
this._boundary.clampPoint(
|
|
1513
|
-
const P = L.subVectors(
|
|
1514
|
-
this._targetEnd.copy(
|
|
1512
|
+
this._boundary.clampPoint(y, y);
|
|
1513
|
+
const P = L.subVectors(y, this._targetEnd);
|
|
1514
|
+
this._targetEnd.copy(y), this._target.add(P), this._changedDolly -= p, M(this._changedDolly) && (this._changedDolly = 0);
|
|
1515
1515
|
} else if (j(this._camera) && this._changedZoom !== 0) {
|
|
1516
|
-
const p = this._zoom - this._lastZoom,
|
|
1516
|
+
const p = this._zoom - this._lastZoom, C = this._camera, v = b.set(
|
|
1517
1517
|
this._dollyControlCoord.x,
|
|
1518
1518
|
this._dollyControlCoord.y,
|
|
1519
|
-
(
|
|
1520
|
-
).unproject(
|
|
1519
|
+
(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))), 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
1521
|
w - E
|
|
1522
1522
|
);
|
|
1523
|
-
|
|
1524
|
-
const P = L.subVectors(
|
|
1525
|
-
this._targetEnd.copy(
|
|
1523
|
+
y.sub(T), this._boundary.clampPoint(y, y);
|
|
1524
|
+
const P = L.subVectors(y, this._targetEnd);
|
|
1525
|
+
this._targetEnd.copy(y), this._target.add(P), this._changedZoom -= p, M(this._changedZoom) && (this._changedZoom = 0);
|
|
1526
1526
|
}
|
|
1527
1527
|
}
|
|
1528
1528
|
this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
|
|
1529
1529
|
const h = this._collisionTest();
|
|
1530
|
-
this._spherical.radius = Math.min(this._spherical.radius, h), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!M(this._focalOffset.x) || !M(this._focalOffset.y) || !M(this._focalOffset.z)) && (N.setFromMatrixColumn(this._camera.matrix, 0), H.setFromMatrixColumn(this._camera.matrix, 1),
|
|
1530
|
+
this._spherical.radius = Math.min(this._spherical.radius, h), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!M(this._focalOffset.x) || !M(this._focalOffset.y) || !M(this._focalOffset.z)) && (N.setFromMatrixColumn(this._camera.matrix, 0), H.setFromMatrixColumn(this._camera.matrix, 1), Y.setFromMatrixColumn(this._camera.matrix, 2), N.multiplyScalar(this._focalOffset.x), H.multiplyScalar(-this._focalOffset.y), Y.multiplyScalar(this._focalOffset.z), b.copy(N).add(H).add(Y), this._camera.position.add(b), this._camera.updateMatrixWorld()), this._boundaryEnclosesCamera && this._encloseToBoundary(
|
|
1531
1531
|
this._camera.position.copy(this._target),
|
|
1532
1532
|
b.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),
|
|
1533
1533
|
1
|
|
@@ -1644,7 +1644,7 @@ class $ extends Bt {
|
|
|
1644
1644
|
}
|
|
1645
1645
|
}
|
|
1646
1646
|
_updateNearPlaneCorners() {
|
|
1647
|
-
if (
|
|
1647
|
+
if (B(this._camera)) {
|
|
1648
1648
|
const e = this._camera, t = e.near, s = e.getEffectiveFOV() * ee, i = Math.tan(s * 0.5) * t, r = i * e.aspect;
|
|
1649
1649
|
this._nearPlaneCorners[0].set(-r, -i, 0), this._nearPlaneCorners[1].set(r, -i, 0), this._nearPlaneCorners[2].set(r, i, 0), this._nearPlaneCorners[3].set(-r, i, 0);
|
|
1650
1650
|
} else if (j(this._camera)) {
|
|
@@ -1743,7 +1743,7 @@ class $ extends Bt {
|
|
|
1743
1743
|
const h = a.geometry.clone();
|
|
1744
1744
|
h.applyMatrix4(a.matrixWorld);
|
|
1745
1745
|
const f = h.attributes.position;
|
|
1746
|
-
for (let p = 0,
|
|
1746
|
+
for (let p = 0, C = f.count; p < C; p++)
|
|
1747
1747
|
b.fromBufferAttribute(f, p), r = Math.max(r, i.distanceToSquared(b));
|
|
1748
1748
|
}), s.radius = Math.sqrt(r), s;
|
|
1749
1749
|
}
|
|
@@ -1771,7 +1771,7 @@ A.EventEmitter = A;
|
|
|
1771
1771
|
A.prototype._events = void 0;
|
|
1772
1772
|
A.prototype._eventsCount = 0;
|
|
1773
1773
|
A.prototype._maxListeners = void 0;
|
|
1774
|
-
var
|
|
1774
|
+
var Be = 10;
|
|
1775
1775
|
function _e(l) {
|
|
1776
1776
|
if (typeof l != "function")
|
|
1777
1777
|
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof l);
|
|
@@ -1779,12 +1779,12 @@ function _e(l) {
|
|
|
1779
1779
|
Object.defineProperty(A, "defaultMaxListeners", {
|
|
1780
1780
|
enumerable: !0,
|
|
1781
1781
|
get: function() {
|
|
1782
|
-
return
|
|
1782
|
+
return Be;
|
|
1783
1783
|
},
|
|
1784
1784
|
set: function(l) {
|
|
1785
1785
|
if (typeof l != "number" || l < 0 || st(l))
|
|
1786
1786
|
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + l + ".");
|
|
1787
|
-
|
|
1787
|
+
Be = l;
|
|
1788
1788
|
}
|
|
1789
1789
|
});
|
|
1790
1790
|
A.init = function() {
|
|
@@ -1995,7 +1995,7 @@ class Jt {
|
|
|
1995
1995
|
toneMappingExposure: d,
|
|
1996
1996
|
outputColorSpace: f,
|
|
1997
1997
|
logarithmicDepthBuffer: p,
|
|
1998
|
-
preserveDrawingBuffer:
|
|
1998
|
+
preserveDrawingBuffer: C,
|
|
1999
1999
|
stencil: v,
|
|
2000
2000
|
depth: m
|
|
2001
2001
|
} = i, u = new O.WebGLRenderer({
|
|
@@ -2003,7 +2003,7 @@ class Jt {
|
|
|
2003
2003
|
antialias: a,
|
|
2004
2004
|
powerPreference: h,
|
|
2005
2005
|
logarithmicDepthBuffer: p,
|
|
2006
|
-
preserveDrawingBuffer:
|
|
2006
|
+
preserveDrawingBuffer: C,
|
|
2007
2007
|
stencil: v,
|
|
2008
2008
|
depth: m
|
|
2009
2009
|
});
|
|
@@ -2413,7 +2413,7 @@ class hs {
|
|
|
2413
2413
|
this.event.removeAllListeners(), (e = this.controls) == null || e.dispose();
|
|
2414
2414
|
}
|
|
2415
2415
|
}
|
|
2416
|
-
const
|
|
2416
|
+
const Ye = new oe(), ls = new Ct(), Ze = new oe(), I = new fe(), cs = new fe();
|
|
2417
2417
|
class ds {
|
|
2418
2418
|
constructor(e = {}) {
|
|
2419
2419
|
const t = this;
|
|
@@ -2431,54 +2431,54 @@ class ds {
|
|
|
2431
2431
|
width: s,
|
|
2432
2432
|
height: i
|
|
2433
2433
|
};
|
|
2434
|
-
}, this.render = function(
|
|
2435
|
-
const
|
|
2436
|
-
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 = "",
|
|
2437
|
-
let E,
|
|
2438
|
-
n.isOrthographicCamera && (E = -(n.right + n.left) / 2,
|
|
2439
|
-
const w = n.view && n.view.enabled ? n.view.height / n.view.fullHeight : 1, T = n.isOrthographicCamera ? `scale( ${w} )scale(` +
|
|
2440
|
-
a.camera.style !== R && (f.style.transform = R, a.camera.style = R), u(
|
|
2441
|
-
}, this.setSize = function(
|
|
2442
|
-
s =
|
|
2434
|
+
}, this.render = function(g, n) {
|
|
2435
|
+
const _ = n.projectionMatrix.elements[5] * o;
|
|
2436
|
+
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();
|
|
2437
|
+
let E, y;
|
|
2438
|
+
n.isOrthographicCamera && (E = -(n.right + n.left) / 2, y = (n.top + n.bottom) / 2);
|
|
2439
|
+
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)";
|
|
2440
|
+
a.camera.style !== R && (f.style.transform = R, a.camera.style = R), u(g, g, n);
|
|
2441
|
+
}, this.setSize = function(g, n) {
|
|
2442
|
+
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";
|
|
2443
2443
|
};
|
|
2444
|
-
function p(
|
|
2445
|
-
return Math.abs(
|
|
2444
|
+
function p(g) {
|
|
2445
|
+
return Math.abs(g) < 1e-10 ? 0 : g;
|
|
2446
2446
|
}
|
|
2447
|
-
function
|
|
2448
|
-
const n =
|
|
2447
|
+
function C(g) {
|
|
2448
|
+
const n = g.elements;
|
|
2449
2449
|
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]) + ")";
|
|
2450
2450
|
}
|
|
2451
|
-
function v(
|
|
2452
|
-
const n =
|
|
2451
|
+
function v(g) {
|
|
2452
|
+
const n = g.elements;
|
|
2453
2453
|
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]) + ")");
|
|
2454
2454
|
}
|
|
2455
|
-
function m(
|
|
2456
|
-
|
|
2457
|
-
for (let n = 0,
|
|
2458
|
-
m(
|
|
2455
|
+
function m(g) {
|
|
2456
|
+
g.isCSS3DObject && (g.element.style.display = "none");
|
|
2457
|
+
for (let n = 0, _ = g.children.length; n < _; n++)
|
|
2458
|
+
m(g.children[n]);
|
|
2459
2459
|
}
|
|
2460
|
-
function u(
|
|
2461
|
-
if (
|
|
2462
|
-
m(
|
|
2460
|
+
function u(g, n, _, E) {
|
|
2461
|
+
if (g.visible === !1) {
|
|
2462
|
+
m(g);
|
|
2463
2463
|
return;
|
|
2464
2464
|
}
|
|
2465
|
-
if (
|
|
2466
|
-
const
|
|
2467
|
-
if (w.style.display =
|
|
2468
|
-
|
|
2465
|
+
if (g.isCSS3DObject) {
|
|
2466
|
+
const y = g.layers.test(_.layers) === !0, w = g.element;
|
|
2467
|
+
if (w.style.display = y === !0 ? "" : "none", y === !0) {
|
|
2468
|
+
g.onBeforeRender(t, n, _);
|
|
2469
2469
|
let T;
|
|
2470
|
-
|
|
2471
|
-
const P = a.objects.get(
|
|
2470
|
+
g.isCSS3DSprite ? (I.copy(_.matrixWorldInverse), I.transpose(), g.rotation2D !== 0 && I.multiply(cs.makeRotationZ(g.rotation2D)), g.matrixWorld.decompose(Ye, ls, Ze), I.setPosition(Ye), I.scale(Ze), I.elements[3] = 0, I.elements[7] = 0, I.elements[11] = 0, I.elements[15] = 1, T = v(I)) : T = v(g.matrixWorld);
|
|
2471
|
+
const P = a.objects.get(g);
|
|
2472
2472
|
if (P === void 0 || P.style !== T) {
|
|
2473
2473
|
w.style.transform = T;
|
|
2474
2474
|
const R = { style: T };
|
|
2475
|
-
a.objects.set(
|
|
2475
|
+
a.objects.set(g, R);
|
|
2476
2476
|
}
|
|
2477
|
-
w.parentNode !== f && f.appendChild(w),
|
|
2477
|
+
w.parentNode !== f && f.appendChild(w), g.onAfterRender(t, n, _);
|
|
2478
2478
|
}
|
|
2479
2479
|
}
|
|
2480
|
-
for (let
|
|
2481
|
-
u(
|
|
2480
|
+
for (let y = 0, w = g.children.length; y < w; y++)
|
|
2481
|
+
u(g.children[y], n, _);
|
|
2482
2482
|
}
|
|
2483
2483
|
}
|
|
2484
2484
|
}
|
|
@@ -2502,44 +2502,44 @@ class ps {
|
|
|
2502
2502
|
};
|
|
2503
2503
|
function d(m) {
|
|
2504
2504
|
m.isCSS2DObject && (m.element.style.display = "none");
|
|
2505
|
-
for (let u = 0,
|
|
2505
|
+
for (let u = 0, g = m.children.length; u < g; u++)
|
|
2506
2506
|
d(m.children[u]);
|
|
2507
2507
|
}
|
|
2508
|
-
function f(m, u,
|
|
2508
|
+
function f(m, u, g) {
|
|
2509
2509
|
if (m.visible === !1) {
|
|
2510
2510
|
d(m);
|
|
2511
2511
|
return;
|
|
2512
2512
|
}
|
|
2513
2513
|
if (m.isCSS2DObject) {
|
|
2514
2514
|
X.setFromMatrixPosition(m.matrixWorld), X.applyMatrix4(Ge);
|
|
2515
|
-
const n = X.z >= -1 && X.z <= 1 && m.layers.test(
|
|
2516
|
-
|
|
2515
|
+
const n = X.z >= -1 && X.z <= 1 && m.layers.test(g.layers) === !0, _ = m.element;
|
|
2516
|
+
_.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));
|
|
2517
2517
|
const E = {
|
|
2518
|
-
distanceToCameraSquared: p(
|
|
2518
|
+
distanceToCameraSquared: p(g, m)
|
|
2519
2519
|
};
|
|
2520
2520
|
a.objects.set(m, E);
|
|
2521
2521
|
}
|
|
2522
|
-
for (let n = 0,
|
|
2523
|
-
f(m.children[n], u,
|
|
2522
|
+
for (let n = 0, _ = m.children.length; n < _; n++)
|
|
2523
|
+
f(m.children[n], u, g);
|
|
2524
2524
|
}
|
|
2525
2525
|
function p(m, u) {
|
|
2526
2526
|
return Ke.setFromMatrixPosition(m.matrixWorld), Xe.setFromMatrixPosition(u.matrixWorld), Ke.distanceToSquared(Xe);
|
|
2527
2527
|
}
|
|
2528
|
-
function
|
|
2528
|
+
function C(m) {
|
|
2529
2529
|
const u = [];
|
|
2530
|
-
return m.traverseVisible(function(
|
|
2531
|
-
|
|
2530
|
+
return m.traverseVisible(function(g) {
|
|
2531
|
+
g.isCSS2DObject && u.push(g);
|
|
2532
2532
|
}), u;
|
|
2533
2533
|
}
|
|
2534
2534
|
function v(m) {
|
|
2535
|
-
const u =
|
|
2536
|
-
if (n.renderOrder !==
|
|
2537
|
-
return
|
|
2538
|
-
const E = a.objects.get(n).distanceToCameraSquared,
|
|
2539
|
-
return E -
|
|
2540
|
-
}),
|
|
2541
|
-
for (let n = 0,
|
|
2542
|
-
u[n].element.style.zIndex =
|
|
2535
|
+
const u = C(m).sort(function(n, _) {
|
|
2536
|
+
if (n.renderOrder !== _.renderOrder)
|
|
2537
|
+
return _.renderOrder - n.renderOrder;
|
|
2538
|
+
const E = a.objects.get(n).distanceToCameraSquared, y = a.objects.get(_).distanceToCameraSquared;
|
|
2539
|
+
return E - y;
|
|
2540
|
+
}), g = u.length;
|
|
2541
|
+
for (let n = 0, _ = u.length; n < _; n++)
|
|
2542
|
+
u[n].element.style.zIndex = g - n;
|
|
2543
2543
|
}
|
|
2544
2544
|
}
|
|
2545
2545
|
}
|
|
@@ -2708,10 +2708,10 @@ const _s = (l) => {
|
|
|
2708
2708
|
}, be = 1, pe = !1, gs = new O.MeshBasicMaterial({ color: "black" }), vs = new O.PointsMaterial({
|
|
2709
2709
|
color: "black",
|
|
2710
2710
|
sizeAttenuation: !1
|
|
2711
|
-
}),
|
|
2711
|
+
}), ys = new O.PointsMaterial({
|
|
2712
2712
|
color: "black",
|
|
2713
2713
|
sizeAttenuation: !0
|
|
2714
|
-
}),
|
|
2714
|
+
}), Cs = new O.SpriteMaterial({
|
|
2715
2715
|
color: "black",
|
|
2716
2716
|
sizeAttenuation: !0
|
|
2717
2717
|
}), Es = new O.SpriteMaterial({
|
|
@@ -2753,8 +2753,8 @@ class bs {
|
|
|
2753
2753
|
samples: Math.min(a, h),
|
|
2754
2754
|
type: O.HalfFloatType
|
|
2755
2755
|
}
|
|
2756
|
-
), p = new Me(o, f),
|
|
2757
|
-
p.setSize(
|
|
2756
|
+
), p = new Me(o, f), C = this.getSize();
|
|
2757
|
+
p.setSize(C.width, C.height);
|
|
2758
2758
|
const v = new Ut(
|
|
2759
2759
|
s.scene,
|
|
2760
2760
|
i.camera
|
|
@@ -2832,7 +2832,7 @@ class bs {
|
|
|
2832
2832
|
s.traverse((i) => {
|
|
2833
2833
|
var h;
|
|
2834
2834
|
const r = i, o = i, a = i;
|
|
2835
|
-
(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 =
|
|
2835
|
+
(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 et ? r.material = Os : a.isPoints ? a.material.sizeAttenuation ? a.material = ys : a.material = vs : r.material = gs);
|
|
2836
2836
|
});
|
|
2837
2837
|
}), e.forEach((s) => {
|
|
2838
2838
|
this.bloomVisible[s.uuid] = s.visible, s.visible = !1;
|
|
@@ -2892,12 +2892,12 @@ class $e extends O.Loader {
|
|
|
2892
2892
|
let d = h;
|
|
2893
2893
|
const f = e.split(".").pop(), p = this.options.type === "image" ? `image/${f || "png"}` : `video/${f || "mp4"}`;
|
|
2894
2894
|
d = d.slice(0, h.size, p);
|
|
2895
|
-
const
|
|
2895
|
+
const C = () => {
|
|
2896
2896
|
o.removeEventListener("load", v, !1), o.removeEventListener("error", m, !1);
|
|
2897
2897
|
}, v = () => {
|
|
2898
|
-
|
|
2899
|
-
}, m = (
|
|
2900
|
-
|
|
2898
|
+
C(), r.needsUpdate = !0, t && t(r);
|
|
2899
|
+
}, m = (g) => {
|
|
2900
|
+
C(), i && i(g), this.manager.itemError(e), this.manager.itemEnd(e);
|
|
2901
2901
|
};
|
|
2902
2902
|
o.addEventListener("load", v, !1), o.addEventListener("error", m, !1);
|
|
2903
2903
|
const u = window.URL.createObjectURL(d);
|
|
@@ -3037,7 +3037,7 @@ class Ss {
|
|
|
3037
3037
|
const s = (a = t == null ? void 0 : t.type) != null ? a : this.getAssetType(e);
|
|
3038
3038
|
if (!s)
|
|
3039
3039
|
return;
|
|
3040
|
-
const i = (t == null ? void 0 : t.cache) !== !1, r =
|
|
3040
|
+
const i = (t == null ? void 0 : t.cache) !== !1, r = Bt();
|
|
3041
3041
|
if (i) {
|
|
3042
3042
|
if (this.assets.has(e))
|
|
3043
3043
|
return this.assets.get(e);
|
|
@@ -3156,8 +3156,8 @@ class Rs {
|
|
|
3156
3156
|
for (const u of m.objArr) {
|
|
3157
3157
|
if (!u.object3d || !u.visibleWithAncestors) continue;
|
|
3158
3158
|
h.has(u) || (h.set(u, /* @__PURE__ */ new Map()), d.push(u));
|
|
3159
|
-
const
|
|
3160
|
-
|
|
3159
|
+
const g = h.get(u);
|
|
3160
|
+
g.has(m.type) || g.set(m.type, []), g.get(m.type).push(m.cb);
|
|
3161
3161
|
}
|
|
3162
3162
|
if (d.length === 0) return;
|
|
3163
3163
|
const f = d.map((m) => m.object3d);
|
|
@@ -3174,8 +3174,8 @@ class Rs {
|
|
|
3174
3174
|
const m = p[0];
|
|
3175
3175
|
this.processIntersection(m, r, e);
|
|
3176
3176
|
}
|
|
3177
|
-
const
|
|
3178
|
-
this.prevActiveObjects = this.activeObjects, this.activeObjects =
|
|
3177
|
+
const C = this.prevActiveObjects;
|
|
3178
|
+
this.prevActiveObjects = this.activeObjects, this.activeObjects = C, this.activeObjects.clear();
|
|
3179
3179
|
};
|
|
3180
3180
|
this.domElement.addEventListener(
|
|
3181
3181
|
`pointer${e}`,
|
|
@@ -3236,10 +3236,10 @@ class Rs {
|
|
|
3236
3236
|
});
|
|
3237
3237
|
const f = h.get("click");
|
|
3238
3238
|
if (f) {
|
|
3239
|
-
const p = (
|
|
3240
|
-
|
|
3239
|
+
const p = (C) => {
|
|
3240
|
+
C.preventDefault();
|
|
3241
3241
|
const v = 5;
|
|
3242
|
-
if (!r && Math.abs(
|
|
3242
|
+
if (!r && Math.abs(C.clientX - e.clientX) <= v && Math.abs(C.clientY - e.clientY) <= v)
|
|
3243
3243
|
for (const m of f)
|
|
3244
3244
|
m({
|
|
3245
3245
|
baseObject: a,
|
|
@@ -3360,30 +3360,42 @@ class Us extends Rs {
|
|
|
3360
3360
|
const i = this.objectNamesToFactories.get(e);
|
|
3361
3361
|
if (i) {
|
|
3362
3362
|
t || (t = {}), t.target === void 0 && (t.target = s);
|
|
3363
|
-
const
|
|
3364
|
-
let
|
|
3365
|
-
this.objects.
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3363
|
+
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);
|
|
3364
|
+
let m;
|
|
3365
|
+
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 = () => {
|
|
3366
|
+
} : C !== !0 && (v.create = () => {
|
|
3367
|
+
C(v);
|
|
3368
|
+
}), v.pencil = this.pencil, v.lead = this, v.prefab = p, v.objectType = `BaseObject#${e}`, v.objectOptions = t, this.setBaseObjectKey(
|
|
3369
|
+
v,
|
|
3370
|
+
t.key ? `$t:#${t.key}` : "$t:",
|
|
3371
|
+
m == null ? void 0 : m.key
|
|
3372
|
+
), this.objectsPm.set(
|
|
3373
|
+
v.key,
|
|
3374
|
+
this.addBaseObject(v, m, f)
|
|
3375
|
+
), yield this.objectsPm.get(v.key), this.objectsPm.delete(v.key), v;
|
|
3374
3376
|
}
|
|
3375
3377
|
throw new Error(`Unrecognized:${e}`);
|
|
3376
3378
|
});
|
|
3377
3379
|
}
|
|
3378
|
-
|
|
3379
|
-
const i = e.
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3380
|
+
setBaseObjectKey(e, t, s) {
|
|
3381
|
+
const i = e.objectType, [, r] = i.split("#");
|
|
3382
|
+
let o = r;
|
|
3383
|
+
return o = t.replace("$t:", r), s && (o = t.replace("$P:", s)), this.objects.has(o) && (o.includes("#") ? o += `-${Re()}` : o += `#${Re()}`), e.key = o, this.objects.set(o, e), o;
|
|
3384
|
+
}
|
|
3385
|
+
updateBaseObjectKey(e, t) {
|
|
3386
|
+
var r;
|
|
3387
|
+
let s;
|
|
3388
|
+
for (const [o, a] of this.objects.entries())
|
|
3389
|
+
if (a === e) {
|
|
3390
|
+
s = o;
|
|
3391
|
+
break;
|
|
3392
|
+
}
|
|
3393
|
+
const i = (r = e.parent) == null ? void 0 : r.key;
|
|
3394
|
+
return s ? (this.objects.delete(s), this.setBaseObjectKey(e, t, i)) : this.setBaseObjectKey(e, t, i);
|
|
3383
3395
|
}
|
|
3384
3396
|
addBaseObject(e, t, s) {
|
|
3385
3397
|
return J(this, null, function* () {
|
|
3386
|
-
|
|
3398
|
+
yield e.create(), e.object3d && (s && e.setTop(s), t !== null && (t.add(e.object3d), this.objMap.set(e.object3d, e))), e.render();
|
|
3387
3399
|
});
|
|
3388
3400
|
}
|
|
3389
3401
|
erase(...e) {
|
|
@@ -3505,7 +3517,7 @@ const ue = class ue {
|
|
|
3505
3517
|
return this.leadController.lead;
|
|
3506
3518
|
}
|
|
3507
3519
|
tweenUpdateRaf() {
|
|
3508
|
-
|
|
3520
|
+
ye.update(), this.TweenRaf = requestAnimationFrame(this.tweenUpdateRaf.bind(this));
|
|
3509
3521
|
}
|
|
3510
3522
|
use(e, ...t) {
|
|
3511
3523
|
this.installPlugins.has(e.pluginName) ? console.log("plugin already installed") : typeof e.install == "function" && (e.install(this, ...t), this.installPlugins.set(e.pluginName, e));
|
|
@@ -3553,7 +3565,7 @@ const ue = class ue {
|
|
|
3553
3565
|
}), p = new is({
|
|
3554
3566
|
width: h,
|
|
3555
3567
|
height: d
|
|
3556
|
-
}),
|
|
3568
|
+
}), C = new os({}), v = new as({
|
|
3557
3569
|
controlsParams: {
|
|
3558
3570
|
domElement: (n = o == null ? void 0 : o.domElement) != null ? n : f.renderer.domElement
|
|
3559
3571
|
}
|
|
@@ -3564,18 +3576,18 @@ const ue = class ue {
|
|
|
3564
3576
|
}), u = new zs({
|
|
3565
3577
|
pencil: this
|
|
3566
3578
|
});
|
|
3567
|
-
this.sceneController =
|
|
3568
|
-
const
|
|
3579
|
+
this.sceneController = C, this.cameraController = p, this.controlsController = v, this.rendererController = f, this.loaderController = m, this.leadController = u;
|
|
3580
|
+
const g = this.addPage({
|
|
3569
3581
|
sceneOptions: this.options.scene,
|
|
3570
3582
|
cameraOptions: this.options.camera
|
|
3571
3583
|
});
|
|
3572
|
-
if (this.showPage(
|
|
3573
|
-
const
|
|
3584
|
+
if (this.showPage(g), s) {
|
|
3585
|
+
const _ = new ns({
|
|
3574
3586
|
container: e,
|
|
3575
|
-
sceneController:
|
|
3587
|
+
sceneController: C,
|
|
3576
3588
|
cameraController: p
|
|
3577
3589
|
});
|
|
3578
|
-
|
|
3590
|
+
_.add(C.scene), this.helperController = _, i && _.addViewHelper();
|
|
3579
3591
|
}
|
|
3580
3592
|
e.appendChild(f.renderer.domElement);
|
|
3581
3593
|
}
|
|
@@ -3688,7 +3700,7 @@ const ue = class ue {
|
|
|
3688
3700
|
var s, i, r, o, a, h;
|
|
3689
3701
|
if (!this.camera || !this.scene)
|
|
3690
3702
|
return;
|
|
3691
|
-
this.timer.update(),
|
|
3703
|
+
this.timer.update(), ye.update();
|
|
3692
3704
|
const e = this.timer.getDelta(), t = this.timer.getElapsed();
|
|
3693
3705
|
this.controlsController.update(e, t), this.leadController.update(e, t), this.installPlugins.forEach((d) => {
|
|
3694
3706
|
var f;
|
|
@@ -3748,11 +3760,11 @@ const ue = class ue {
|
|
|
3748
3760
|
}
|
|
3749
3761
|
}
|
|
3750
3762
|
dispose() {
|
|
3751
|
-
var e, t, s, i, r, o, a, h, d, f, p,
|
|
3752
|
-
this.stop(), this.timer.dispose(),
|
|
3763
|
+
var e, t, s, i, r, o, a, h, d, f, p, C, v;
|
|
3764
|
+
this.stop(), this.timer.dispose(), ye.removeAll(), this.event.removeAllListeners(), (e = this.resizeObserver) == null || e.unobserve(this.options.container), this.installPlugins.forEach((m) => {
|
|
3753
3765
|
var u;
|
|
3754
3766
|
(u = m.dispose) == null || u.call(m);
|
|
3755
|
-
}), (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(), (
|
|
3767
|
+
}), (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();
|
|
3756
3768
|
}
|
|
3757
3769
|
};
|
|
3758
3770
|
ue.options = {
|