gl-draw 0.17.0-beta.23 → 0.17.0-beta.25
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/BaseObject/PointerEvent.d.ts +1 -0
- package/dist/core/Lead/Pick.d.ts +15 -1
- package/dist/index.js +2 -2
- package/dist/index.module.js +346 -310
- package/dist/index.module2.js +17 -14
- package/dist/index2.js +3 -3
- package/dist/objects/group/index.d.ts +1 -0
- package/dist/objects/index.js +1 -1
- package/dist/objects/index.module.js +111 -104
- package/package.json +1 -1
package/dist/index.module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var Pt = Object.defineProperty,
|
|
2
|
-
var
|
|
1
|
+
var Pt = Object.defineProperty, St = Object.defineProperties;
|
|
2
|
+
var At = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Me = Object.getOwnPropertySymbols;
|
|
4
4
|
var Mt = Object.prototype.hasOwnProperty, Dt = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var De = (c, e, t) => e in c ? Pt(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t, U = (c, e) => {
|
|
@@ -9,7 +9,7 @@ var De = (c, e, t) => e in c ? Pt(c, e, { enumerable: !0, configurable: !0, writ
|
|
|
9
9
|
for (var t of Me(e))
|
|
10
10
|
Dt.call(e, t) && De(c, t, e[t]);
|
|
11
11
|
return c;
|
|
12
|
-
}, te = (c, e) =>
|
|
12
|
+
}, te = (c, e) => St(c, At(e));
|
|
13
13
|
var se = (c, e, t) => new Promise((s, i) => {
|
|
14
14
|
var r = (a) => {
|
|
15
15
|
try {
|
|
@@ -26,10 +26,10 @@ var se = (c, e, t) => new Promise((s, i) => {
|
|
|
26
26
|
}, n = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(r, o);
|
|
27
27
|
n((t = t.apply(c, e)).next());
|
|
28
28
|
});
|
|
29
|
-
import * as
|
|
29
|
+
import * as Oe from "@tweenjs/tween.js";
|
|
30
30
|
import Rt from "deepmerge";
|
|
31
31
|
import Ut from "stats-gl";
|
|
32
|
-
import { Vector3 as I, PerspectiveCamera as kt, Matrix4 as W, ShaderMaterial as zt, UniformsUtils as
|
|
32
|
+
import { Vector3 as I, PerspectiveCamera as kt, Matrix4 as W, ShaderMaterial as zt, UniformsUtils as jt, RawShaderMaterial as Ft, MeshBasicMaterial as Nt, PointsMaterial as ot, SpriteMaterial as nt, Color as It, Layers as Ht, Vector2 as B, WebGLRenderTarget as Bt, HalfFloatType as Vt, MathUtils as Yt, Vector4 as Zt, Quaternion as at, Spherical as Wt, Box3 as lt, Sphere as Kt, Raycaster as ht, AxesHelper as Re, CameraHelper as $t, PointLightHelper as Gt, DirectionalLightHelper as Xt, SpotLightHelper as qt, HemisphereLightHelper as Qt, Box3Helper as Ue, Scene as ct, Group as ke, Camera as Jt, Loader as dt, FileLoader as Se, Texture as fe, VideoTexture as es, LoadingManager as ts, DataTexture as ss, WebGLRenderer as is, REVISION as rs, Object3D as os, Timer as ns } from "three";
|
|
33
33
|
import { M as pt, B as as, a as ls, R as Pe, I as he } from "./index.module2.js";
|
|
34
34
|
import { EffectComposer as ze } from "three/examples/jsm/postprocessing/EffectComposer";
|
|
35
35
|
import { RenderPass as hs } from "three/examples/jsm/postprocessing/RenderPass";
|
|
@@ -47,15 +47,15 @@ import "three/examples/jsm/lights/RectAreaLightUniformsLib";
|
|
|
47
47
|
import "three/examples/jsm/lines/LineSegments2";
|
|
48
48
|
import { ShaderPass as ps } from "three/examples/jsm/postprocessing/ShaderPass";
|
|
49
49
|
import { OutputPass as ms } from "three/examples/jsm/postprocessing/OutputPass";
|
|
50
|
-
import { FullScreenQuad as
|
|
50
|
+
import { FullScreenQuad as je } from "three/examples/jsm/postprocessing/Pass";
|
|
51
51
|
import { RectAreaLightHelper as us } from "three/examples/jsm/helpers/RectAreaLightHelper";
|
|
52
52
|
import { ViewHelper as fs } from "three/examples/jsm/helpers/ViewHelper";
|
|
53
53
|
import { generateUUID as _s, makePromiseCreator as gs } from "esus-lite";
|
|
54
|
-
import { DRACOLoader as
|
|
55
|
-
import { EXRLoader as
|
|
56
|
-
import { GLTFLoader as
|
|
57
|
-
import { LottieLoader as
|
|
58
|
-
import { a as
|
|
54
|
+
import { DRACOLoader as vs } from "three/examples/jsm/loaders/DRACOLoader";
|
|
55
|
+
import { EXRLoader as ys } from "three/examples/jsm/loaders/EXRLoader";
|
|
56
|
+
import { GLTFLoader as Fe } from "three/examples/jsm/loaders/GLTFLoader";
|
|
57
|
+
import { LottieLoader as Os } from "three/examples/jsm/loaders/LottieLoader";
|
|
58
|
+
import { a as Cs, C as Es, i as Ts } from "./isPlainObject.module.js";
|
|
59
59
|
import { TransformControls as bs } from "three/examples/jsm/controls/TransformControls";
|
|
60
60
|
const M = {
|
|
61
61
|
LEFT: 1,
|
|
@@ -94,15 +94,15 @@ function Y(c) {
|
|
|
94
94
|
function H(c) {
|
|
95
95
|
return c.isOrthographicCamera;
|
|
96
96
|
}
|
|
97
|
-
const $ = Math.PI * 2,
|
|
97
|
+
const $ = Math.PI * 2, Ne = Math.PI / 2, mt = 1e-5, ie = Math.PI / 180;
|
|
98
98
|
function z(c, e, t) {
|
|
99
99
|
return Math.max(e, Math.min(t, c));
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function A(c, e = mt) {
|
|
102
102
|
return Math.abs(c) < e;
|
|
103
103
|
}
|
|
104
104
|
function P(c, e, t = mt) {
|
|
105
|
-
return
|
|
105
|
+
return A(c - e, t);
|
|
106
106
|
}
|
|
107
107
|
function Ie(c, e) {
|
|
108
108
|
return Math.round(c / e) * e;
|
|
@@ -119,27 +119,27 @@ function ce(c, e, t, s, i = 1 / 0, r) {
|
|
|
119
119
|
let h = c - e;
|
|
120
120
|
const m = e, p = i * s;
|
|
121
121
|
h = z(h, -p, p), e = c - h;
|
|
122
|
-
const
|
|
123
|
-
t.value = (t.value - o *
|
|
124
|
-
let
|
|
125
|
-
return m - c > 0 ==
|
|
122
|
+
const y = (t.value + o * h) * r;
|
|
123
|
+
t.value = (t.value - o * y) * a;
|
|
124
|
+
let f = e + (h + y) * a;
|
|
125
|
+
return m - c > 0 == f > m && (f = m, t.value = (f - m) / r), f;
|
|
126
126
|
}
|
|
127
127
|
function He(c, e, t, s, i = 1 / 0, r, o) {
|
|
128
128
|
s = Math.max(1e-4, s);
|
|
129
129
|
const n = 2 / s, a = n * r, h = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
|
|
130
|
-
let m = e.x, p = e.y,
|
|
131
|
-
const
|
|
132
|
-
if (b >
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
m = c.x -
|
|
137
|
-
const E = (t.x + n *
|
|
138
|
-
t.x = (t.x - n * E) * h, t.y = (t.y - n * x) * h, t.z = (t.z - n * D) * h, o.x = m + (
|
|
139
|
-
const V =
|
|
140
|
-
return V * wt + le * xt + bt * Lt > 0 && (o.x =
|
|
130
|
+
let m = e.x, p = e.y, y = e.z, f = c.x - m, u = c.y - p, g = c.z - y;
|
|
131
|
+
const v = m, l = p, _ = y, C = i * s, O = C * C, b = f * f + u * u + g * g;
|
|
132
|
+
if (b > O) {
|
|
133
|
+
const ye = Math.sqrt(b);
|
|
134
|
+
f = f / ye * C, u = u / ye * C, g = g / ye * C;
|
|
135
|
+
}
|
|
136
|
+
m = c.x - f, p = c.y - u, y = c.z - g;
|
|
137
|
+
const E = (t.x + n * f) * r, x = (t.y + n * u) * r, D = (t.z + n * g) * r;
|
|
138
|
+
t.x = (t.x - n * E) * h, t.y = (t.y - n * x) * h, t.z = (t.z - n * D) * h, o.x = m + (f + E) * h, o.y = p + (u + x) * h, o.z = y + (g + D) * h;
|
|
139
|
+
const V = v - c.x, le = l - c.y, bt = _ - c.z, wt = o.x - v, xt = o.y - l, Lt = o.z - _;
|
|
140
|
+
return V * wt + le * xt + bt * Lt > 0 && (o.x = v, o.y = l, o.z = _, t.x = (o.x - v) / r, t.y = (o.y - l) / r, t.z = (o.z - _) / r), o;
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function Ce(c, e) {
|
|
143
143
|
e.set(0, 0), c.forEach((t) => {
|
|
144
144
|
e.x += t.clientX, e.y += t.clientY;
|
|
145
145
|
}), e.x /= c.length, e.y /= c.length;
|
|
@@ -212,10 +212,10 @@ class ws {
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
const de = 1 / 8, xs = /Mac/.test(navigator.platform);
|
|
215
|
-
let T, Be, pe, Te, R, w, L, G, ne,
|
|
215
|
+
let T, Be, pe, Te, R, w, L, G, ne, j, F, Z, Ve, Ye, k, ae, X, Ze, be, We, we, xe, me;
|
|
216
216
|
class J extends ws {
|
|
217
217
|
static install(e) {
|
|
218
|
-
T = e.THREE, Be = Object.freeze(new T.Vector3(0, 0, 0)), pe = Object.freeze(new T.Vector3(0, 1, 0)), Te = Object.freeze(new T.Vector3(0, 0, 1)), R = new T.Vector2(), w = new T.Vector3(), L = new T.Vector3(), G = new T.Vector3(), ne = new T.Vector3(),
|
|
218
|
+
T = e.THREE, Be = Object.freeze(new T.Vector3(0, 0, 0)), pe = Object.freeze(new T.Vector3(0, 1, 0)), Te = Object.freeze(new T.Vector3(0, 0, 1)), R = new T.Vector2(), w = new T.Vector3(), L = new T.Vector3(), G = new T.Vector3(), ne = new T.Vector3(), j = new T.Vector3(), F = new T.Vector3(), Z = new T.Vector3(), Ve = new T.Vector3(), Ye = new T.Vector3(), k = new T.Spherical(), ae = new T.Spherical(), X = new T.Box3(), Ze = new T.Box3(), be = new T.Sphere(), We = new T.Quaternion(), we = new T.Quaternion(), xe = new T.Matrix4(), me = new T.Raycaster();
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
221
221
|
* list all ACTIONs
|
|
@@ -243,40 +243,40 @@ class J extends ws {
|
|
|
243
243
|
*/
|
|
244
244
|
constructor(e, t) {
|
|
245
245
|
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 = () => {
|
|
246
|
-
}, this._enabled = !0, this._state = d.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 = K.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new T.Vector3(), this._focalOffsetVelocity = new T.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (l,
|
|
246
|
+
}, this._enabled = !0, this._state = d.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 = K.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new T.Vector3(), this._focalOffsetVelocity = new T.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (l, _, C, O) => {
|
|
247
247
|
let b, E;
|
|
248
248
|
if (Y(this._camera)) {
|
|
249
249
|
const x = w.copy(this._camera.position).sub(this._target), D = this._camera.getEffectiveFOV() * ie, V = x.length() * Math.tan(D * 0.5);
|
|
250
|
-
b = this.truckSpeed * l * V / this._elementRect.height, E = this.truckSpeed *
|
|
250
|
+
b = this.truckSpeed * l * V / this._elementRect.height, E = this.truckSpeed * _ * V / this._elementRect.height;
|
|
251
251
|
} else if (H(this._camera)) {
|
|
252
252
|
const x = this._camera;
|
|
253
|
-
b = this.truckSpeed * l * (x.right - x.left) / x.zoom / this._elementRect.width, E = this.truckSpeed *
|
|
253
|
+
b = this.truckSpeed * l * (x.right - x.left) / x.zoom / this._elementRect.width, E = this.truckSpeed * _ * (x.top - x.bottom) / x.zoom / this._elementRect.height;
|
|
254
254
|
} else
|
|
255
255
|
return;
|
|
256
|
-
|
|
256
|
+
O ? (C ? this.setFocalOffset(
|
|
257
257
|
this._focalOffsetEnd.x + b,
|
|
258
258
|
this._focalOffsetEnd.y,
|
|
259
259
|
this._focalOffsetEnd.z,
|
|
260
260
|
!0
|
|
261
|
-
) : this.truck(b, 0, !0), this.forward(-E, !0)) :
|
|
261
|
+
) : this.truck(b, 0, !0), this.forward(-E, !0)) : C ? this.setFocalOffset(
|
|
262
262
|
this._focalOffsetEnd.x + b,
|
|
263
263
|
this._focalOffsetEnd.y + E,
|
|
264
264
|
this._focalOffsetEnd.z,
|
|
265
265
|
!0
|
|
266
266
|
) : this.truck(b, E, !0);
|
|
267
|
-
}, this._rotateInternal = (l,
|
|
268
|
-
const
|
|
269
|
-
this.rotate(
|
|
270
|
-
}, this._dollyInternal = (l,
|
|
271
|
-
const
|
|
267
|
+
}, this._rotateInternal = (l, _) => {
|
|
268
|
+
const C = $ * this.azimuthRotateSpeed * l / this._elementRect.height, O = $ * this.polarRotateSpeed * _ / this._elementRect.height;
|
|
269
|
+
this.rotate(C, O, !0);
|
|
270
|
+
}, this._dollyInternal = (l, _, C) => {
|
|
271
|
+
const O = Math.pow(0.95, -l * this.dollySpeed), b = this._sphericalEnd.radius, E = this._sphericalEnd.radius * O, x = z(
|
|
272
272
|
E,
|
|
273
273
|
this.minDistance,
|
|
274
274
|
this.maxDistance
|
|
275
275
|
), D = x - E;
|
|
276
|
-
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(D, !0), this._dollyToNoClamp(x, !0)) : this._dollyToNoClamp(x, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? E : x) - b, this._dollyControlCoord.set(
|
|
277
|
-
}, this._zoomInternal = (l,
|
|
278
|
-
const
|
|
279
|
-
this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E - b, this._dollyControlCoord.set(
|
|
276
|
+
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(D, !0), this._dollyToNoClamp(x, !0)) : this._dollyToNoClamp(x, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? E : x) - b, this._dollyControlCoord.set(_, C)), this._lastDollyDirection = Math.sign(-l);
|
|
277
|
+
}, this._zoomInternal = (l, _, C) => {
|
|
278
|
+
const O = Math.pow(0.95, l * this.dollySpeed), b = this._zoom, E = this._zoom * O;
|
|
279
|
+
this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E - b, this._dollyControlCoord.set(_, C));
|
|
280
280
|
}, typeof T == "undefined" && console.error(
|
|
281
281
|
"camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."
|
|
282
282
|
), this._camera = e, this._yAxisUpSpace = new T.Quaternion().setFromUnitVectors(
|
|
@@ -305,26 +305,26 @@ class J extends ws {
|
|
|
305
305
|
const s = new T.Vector2(), i = new T.Vector2(), r = new T.Vector2(), o = (l) => {
|
|
306
306
|
if (!this._enabled || !this._domElement) return;
|
|
307
307
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
308
|
-
const
|
|
308
|
+
const O = this._domElement.getBoundingClientRect(), b = (l.clientX - O.left) / (O.right - O.left), E = (l.clientY - O.top) / (O.bottom - O.top);
|
|
309
309
|
if (b < this._interactiveArea.left || b > this._interactiveArea.right || E < this._interactiveArea.top || E > this._interactiveArea.bottom)
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
312
|
-
const
|
|
313
|
-
if (
|
|
314
|
-
const
|
|
315
|
-
|
|
312
|
+
const _ = l.pointerType !== "mouse" ? null : (l.buttons & M.LEFT) === M.LEFT ? M.LEFT : (l.buttons & M.MIDDLE) === M.MIDDLE ? M.MIDDLE : (l.buttons & M.RIGHT) === M.RIGHT ? M.RIGHT : null;
|
|
313
|
+
if (_ !== null) {
|
|
314
|
+
const O = this._findPointerByMouseButton(_);
|
|
315
|
+
O && this._disposePointer(O);
|
|
316
316
|
}
|
|
317
317
|
if ((l.buttons & M.LEFT) === M.LEFT && this._lockedPointer)
|
|
318
318
|
return;
|
|
319
|
-
const
|
|
319
|
+
const C = {
|
|
320
320
|
pointerId: l.pointerId,
|
|
321
321
|
clientX: l.clientX,
|
|
322
322
|
clientY: l.clientY,
|
|
323
323
|
deltaX: 0,
|
|
324
324
|
deltaY: 0,
|
|
325
|
-
mouseButton:
|
|
325
|
+
mouseButton: _
|
|
326
326
|
};
|
|
327
|
-
this._activePointers.push(
|
|
327
|
+
this._activePointers.push(C), this._domElement.ownerDocument.removeEventListener(
|
|
328
328
|
"pointermove",
|
|
329
329
|
n,
|
|
330
330
|
{ passive: !1 }
|
|
@@ -335,12 +335,12 @@ class J extends ws {
|
|
|
335
335
|
"pointermove",
|
|
336
336
|
n,
|
|
337
337
|
{ passive: !1 }
|
|
338
|
-
), this._domElement.ownerDocument.addEventListener("pointerup", a), this._isDragging = !0,
|
|
338
|
+
), this._domElement.ownerDocument.addEventListener("pointerup", a), this._isDragging = !0, y(l);
|
|
339
339
|
}, n = (l) => {
|
|
340
340
|
l.cancelable && l.preventDefault();
|
|
341
|
-
const
|
|
342
|
-
if (
|
|
343
|
-
if (
|
|
341
|
+
const _ = l.pointerId, C = this._lockedPointer || this._findPointerById(_);
|
|
342
|
+
if (C) {
|
|
343
|
+
if (C.clientX = l.clientX, C.clientY = l.clientY, C.deltaX = l.movementX, C.deltaY = l.movementY, this._state = 0, l.pointerType === "touch")
|
|
344
344
|
switch (this._activePointers.length) {
|
|
345
345
|
case 1:
|
|
346
346
|
this._state = this.touches.one;
|
|
@@ -354,12 +354,12 @@ class J extends ws {
|
|
|
354
354
|
}
|
|
355
355
|
else
|
|
356
356
|
(!this._isDragging && this._lockedPointer || this._isDragging && (l.buttons & M.LEFT) === M.LEFT) && (this._state = this._state | this.mouseButtons.left), this._isDragging && (l.buttons & M.MIDDLE) === M.MIDDLE && (this._state = this._state | this.mouseButtons.middle), this._isDragging && (l.buttons & M.RIGHT) === M.RIGHT && (this._state = this._state | this.mouseButtons.right);
|
|
357
|
-
|
|
357
|
+
f();
|
|
358
358
|
}
|
|
359
359
|
}, a = (l) => {
|
|
360
|
-
const
|
|
361
|
-
if (!(
|
|
362
|
-
if (
|
|
360
|
+
const _ = this._findPointerById(l.pointerId);
|
|
361
|
+
if (!(_ && _ === this._lockedPointer)) {
|
|
362
|
+
if (_ && this._disposePointer(_), l.pointerType === "touch")
|
|
363
363
|
switch (this._activePointers.length) {
|
|
364
364
|
case 0:
|
|
365
365
|
this._state = d.NONE;
|
|
@@ -391,7 +391,7 @@ class J extends ws {
|
|
|
391
391
|
const E = performance.now();
|
|
392
392
|
h - E < 1e3 && this._getClientRect(this._elementRect), h = E;
|
|
393
393
|
}
|
|
394
|
-
const
|
|
394
|
+
const _ = xs ? -1 : -3, C = l.deltaMode === 1 || l.ctrlKey ? l.deltaY / _ : l.deltaY / (_ * 10), O = this.dollyToCursor ? (l.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, b = this.dollyToCursor ? (l.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
395
395
|
switch (this.mouseButtons.wheel) {
|
|
396
396
|
case d.ROTATE: {
|
|
397
397
|
this._rotateInternal(l.deltaX, l.deltaY), this._isUserControllingRotate = !0;
|
|
@@ -410,11 +410,11 @@ class J extends ws {
|
|
|
410
410
|
break;
|
|
411
411
|
}
|
|
412
412
|
case d.DOLLY: {
|
|
413
|
-
this._dollyInternal(-
|
|
413
|
+
this._dollyInternal(-C, O, b), this._isUserControllingDolly = !0;
|
|
414
414
|
break;
|
|
415
415
|
}
|
|
416
416
|
case d.ZOOM: {
|
|
417
|
-
this._zoomInternal(-
|
|
417
|
+
this._zoomInternal(-C, O, b), this._isUserControllingZoom = !0;
|
|
418
418
|
break;
|
|
419
419
|
}
|
|
420
420
|
}
|
|
@@ -422,8 +422,8 @@ class J extends ws {
|
|
|
422
422
|
}, p = (l) => {
|
|
423
423
|
if (!(!this._domElement || !this._enabled)) {
|
|
424
424
|
if (this.mouseButtons.right === J.ACTION.NONE) {
|
|
425
|
-
const
|
|
426
|
-
|
|
425
|
+
const _ = l instanceof PointerEvent ? l.pointerId : 0, C = this._findPointerById(_);
|
|
426
|
+
C && this._disposePointer(C), this._domElement.ownerDocument.removeEventListener(
|
|
427
427
|
"pointermove",
|
|
428
428
|
n,
|
|
429
429
|
{ passive: !1 }
|
|
@@ -435,10 +435,10 @@ class J extends ws {
|
|
|
435
435
|
}
|
|
436
436
|
l.preventDefault();
|
|
437
437
|
}
|
|
438
|
-
},
|
|
438
|
+
}, y = (l) => {
|
|
439
439
|
if (!this._enabled) return;
|
|
440
|
-
if (
|
|
441
|
-
const
|
|
440
|
+
if (Ce(this._activePointers, R), this._getClientRect(this._elementRect), s.copy(R), i.copy(R), this._activePointers.length >= 2) {
|
|
441
|
+
const C = R.x - this._activePointers[1].clientX, O = R.y - this._activePointers[1].clientY, b = Math.sqrt(C * C + O * O);
|
|
442
442
|
r.set(0, b);
|
|
443
443
|
const E = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, x = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
|
|
444
444
|
i.set(E, x);
|
|
@@ -460,18 +460,18 @@ class J extends ws {
|
|
|
460
460
|
else
|
|
461
461
|
!this._lockedPointer && (l.buttons & M.LEFT) === M.LEFT && (this._state = this._state | this.mouseButtons.left), (l.buttons & M.MIDDLE) === M.MIDDLE && (this._state = this._state | this.mouseButtons.middle), (l.buttons & M.RIGHT) === M.RIGHT && (this._state = this._state | this.mouseButtons.right);
|
|
462
462
|
((this._state & d.ROTATE) === d.ROTATE || (this._state & d.TOUCH_ROTATE) === d.TOUCH_ROTATE || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.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 & d.TRUCK) === d.TRUCK || (this._state & d.SCREEN_PAN) === d.SCREEN_PAN || (this._state & d.TOUCH_TRUCK) === d.TOUCH_TRUCK || (this._state & d.TOUCH_SCREEN_PAN) === d.TOUCH_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN) && (this._targetEnd.copy(this._target), this._targetVelocity.set(0, 0, 0)), ((this._state & d.DOLLY) === d.DOLLY || (this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE) && (this._sphericalEnd.radius = this._spherical.radius, this._radiusVelocity.value = 0), ((this._state & d.ZOOM) === d.ZOOM || (this._state & d.TOUCH_ZOOM) === d.TOUCH_ZOOM || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) && (this._zoomEnd = this._zoom, this._zoomVelocity.value = 0), ((this._state & d.OFFSET) === d.OFFSET || (this._state & d.TOUCH_OFFSET) === d.TOUCH_OFFSET || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET) && (this._focalOffsetEnd.copy(this._focalOffset), this._focalOffsetVelocity.set(0, 0, 0)), this.dispatchEvent({ type: "controlstart" });
|
|
463
|
-
},
|
|
463
|
+
}, f = () => {
|
|
464
464
|
if (!this._enabled || !this._dragNeedsUpdate) return;
|
|
465
|
-
this._dragNeedsUpdate = !1,
|
|
466
|
-
const
|
|
467
|
-
if (i.copy(R), ((this._state & d.ROTATE) === d.ROTATE || (this._state & d.TOUCH_ROTATE) === d.TOUCH_ROTATE || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(
|
|
465
|
+
this._dragNeedsUpdate = !1, Ce(this._activePointers, R);
|
|
466
|
+
const _ = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, C = _ ? -_.deltaX : i.x - R.x, O = _ ? -_.deltaY : i.y - R.y;
|
|
467
|
+
if (i.copy(R), ((this._state & d.ROTATE) === d.ROTATE || (this._state & d.TOUCH_ROTATE) === d.TOUCH_ROTATE || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(C, O), this._isUserControllingRotate = !0), (this._state & d.DOLLY) === d.DOLLY || (this._state & d.ZOOM) === d.ZOOM) {
|
|
468
468
|
const b = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, E = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, x = this.dollyDragInverted ? -1 : 1;
|
|
469
469
|
(this._state & d.DOLLY) === d.DOLLY ? (this._dollyInternal(
|
|
470
|
-
x *
|
|
470
|
+
x * O * de,
|
|
471
471
|
b,
|
|
472
472
|
E
|
|
473
473
|
), this._isUserControllingDolly = !0) : (this._zoomInternal(
|
|
474
|
-
x *
|
|
474
|
+
x * O * de,
|
|
475
475
|
b,
|
|
476
476
|
E
|
|
477
477
|
), this._isUserControllingZoom = !0);
|
|
@@ -482,9 +482,9 @@ class J extends ws {
|
|
|
482
482
|
const V = this.dollyToCursor ? (i.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, le = this.dollyToCursor ? (i.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
483
483
|
(this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(D * de, V, le), this._isUserControllingDolly = !0) : (this._zoomInternal(D * de, V, le), this._isUserControllingZoom = !0);
|
|
484
484
|
}
|
|
485
|
-
((this._state & d.TRUCK) === d.TRUCK || (this._state & d.TOUCH_TRUCK) === d.TOUCH_TRUCK || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK) && (this._truckInternal(
|
|
485
|
+
((this._state & d.TRUCK) === d.TRUCK || (this._state & d.TOUCH_TRUCK) === d.TOUCH_TRUCK || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK) && (this._truckInternal(C, O, !1, !1), this._isUserControllingTruck = !0), ((this._state & d.SCREEN_PAN) === d.SCREEN_PAN || (this._state & d.TOUCH_SCREEN_PAN) === d.TOUCH_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_ZOOM_SCREEN_PAN) === d.TOUCH_ZOOM_SCREEN_PAN) && (this._truckInternal(C, O, !1, !0), this._isUserControllingTruck = !0), ((this._state & d.OFFSET) === d.OFFSET || (this._state & d.TOUCH_OFFSET) === d.TOUCH_OFFSET || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET) && (this._truckInternal(C, O, !0, !1), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
|
|
486
486
|
}, u = () => {
|
|
487
|
-
|
|
487
|
+
Ce(this._activePointers, R), i.copy(R), 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(
|
|
488
488
|
"pointermove",
|
|
489
489
|
n,
|
|
490
490
|
{ passive: !1 }
|
|
@@ -513,25 +513,25 @@ class J extends ws {
|
|
|
513
513
|
g
|
|
514
514
|
), this._domElement.ownerDocument.addEventListener(
|
|
515
515
|
"pointerlockerror",
|
|
516
|
-
|
|
516
|
+
v
|
|
517
517
|
), this._domElement.ownerDocument.addEventListener(
|
|
518
518
|
"pointermove",
|
|
519
519
|
n,
|
|
520
520
|
{ passive: !1 }
|
|
521
|
-
), this._domElement.ownerDocument.addEventListener("pointerup", a),
|
|
521
|
+
), this._domElement.ownerDocument.addEventListener("pointerup", a), y());
|
|
522
522
|
}, this.unlockPointer = () => {
|
|
523
|
-
var l,
|
|
524
|
-
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (l = this._domElement) === null || l === void 0 || l.ownerDocument.exitPointerLock(), (
|
|
523
|
+
var l, _, C;
|
|
524
|
+
this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (l = this._domElement) === null || l === void 0 || l.ownerDocument.exitPointerLock(), (_ = this._domElement) === null || _ === void 0 || _.ownerDocument.removeEventListener(
|
|
525
525
|
"pointerlockchange",
|
|
526
526
|
g
|
|
527
|
-
), (
|
|
527
|
+
), (C = this._domElement) === null || C === void 0 || C.ownerDocument.removeEventListener(
|
|
528
528
|
"pointerlockerror",
|
|
529
|
-
|
|
529
|
+
v
|
|
530
530
|
), this.cancel();
|
|
531
531
|
};
|
|
532
532
|
const g = () => {
|
|
533
533
|
this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement || this.unlockPointer();
|
|
534
|
-
},
|
|
534
|
+
}, v = () => {
|
|
535
535
|
this.unlockPointer();
|
|
536
536
|
};
|
|
537
537
|
this._addAllEventListeners = (l) => {
|
|
@@ -553,7 +553,7 @@ class J extends ws {
|
|
|
553
553
|
g
|
|
554
554
|
), this._domElement.ownerDocument.removeEventListener(
|
|
555
555
|
"pointerlockerror",
|
|
556
|
-
|
|
556
|
+
v
|
|
557
557
|
));
|
|
558
558
|
}, this.cancel = () => {
|
|
559
559
|
this._state !== d.NONE && (this._state = d.NONE, this._activePointers.length = 0, u());
|
|
@@ -899,8 +899,8 @@ class J extends ws {
|
|
|
899
899
|
* @category Methods
|
|
900
900
|
*/
|
|
901
901
|
truck(e, t, s = !1) {
|
|
902
|
-
this._camera.updateMatrix(),
|
|
903
|
-
const i = w.copy(
|
|
902
|
+
this._camera.updateMatrix(), j.setFromMatrixColumn(this._camera.matrix, 0), F.setFromMatrixColumn(this._camera.matrix, 1), j.multiplyScalar(e), F.multiplyScalar(-t);
|
|
903
|
+
const i = w.copy(j).add(F), r = L.copy(this._targetEnd).add(i);
|
|
904
904
|
return this.moveTo(r.x, r.y, r.z, s);
|
|
905
905
|
}
|
|
906
906
|
/**
|
|
@@ -985,25 +985,25 @@ class J extends ws {
|
|
|
985
985
|
h.isEmpty() && (console.warn(
|
|
986
986
|
"camera-controls: fitTo() cannot be used with an empty box. Aborting"
|
|
987
987
|
), Promise.resolve());
|
|
988
|
-
const m = Ie(this._sphericalEnd.theta,
|
|
988
|
+
const m = Ie(this._sphericalEnd.theta, Ne), p = Ie(this._sphericalEnd.phi, Ne);
|
|
989
989
|
a.push(this.rotateTo(m, p, t));
|
|
990
|
-
const
|
|
991
|
-
u &&
|
|
990
|
+
const y = w.setFromSpherical(this._sphericalEnd).normalize(), f = We.setFromUnitVectors(y, Te), u = P(Math.abs(y.y), 1);
|
|
991
|
+
u && f.multiply(we.setFromAxisAngle(pe, m)), f.multiply(this._yAxisUpSpaceInverse);
|
|
992
992
|
const g = Ze.makeEmpty();
|
|
993
|
-
L.copy(h.min).applyQuaternion(
|
|
994
|
-
const
|
|
993
|
+
L.copy(h.min).applyQuaternion(f), g.expandByPoint(L), L.copy(h.min).setX(h.max.x).applyQuaternion(f), g.expandByPoint(L), L.copy(h.min).setY(h.max.y).applyQuaternion(f), g.expandByPoint(L), L.copy(h.max).setZ(h.min.z).applyQuaternion(f), g.expandByPoint(L), L.copy(h.min).setZ(h.max.z).applyQuaternion(f), g.expandByPoint(L), L.copy(h.max).setY(h.min.y).applyQuaternion(f), g.expandByPoint(L), L.copy(h.max).setX(h.min.x).applyQuaternion(f), g.expandByPoint(L), L.copy(h.max).applyQuaternion(f), g.expandByPoint(L), g.min.x -= i, g.min.y -= o, g.max.x += r, g.max.y += n, f.setFromUnitVectors(Te, y), u && f.premultiply(we.invert()), f.premultiply(this._yAxisUpSpace);
|
|
994
|
+
const v = g.getSize(w), l = g.getCenter(L).applyQuaternion(f);
|
|
995
995
|
if (Y(this._camera)) {
|
|
996
|
-
const
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
996
|
+
const _ = this.getDistanceToFitBox(
|
|
997
|
+
v.x,
|
|
998
|
+
v.y,
|
|
999
|
+
v.z,
|
|
1000
1000
|
s
|
|
1001
1001
|
);
|
|
1002
1002
|
a.push(
|
|
1003
1003
|
this.moveTo(l.x, l.y, l.z, t)
|
|
1004
|
-
), a.push(this.dollyTo(
|
|
1004
|
+
), a.push(this.dollyTo(_, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
1005
1005
|
} else if (H(this._camera)) {
|
|
1006
|
-
const
|
|
1006
|
+
const _ = this._camera, C = _.right - _.left, O = _.top - _.bottom, b = s ? Math.max(C / v.x, O / v.y) : Math.min(C / v.x, O / v.y);
|
|
1007
1007
|
a.push(
|
|
1008
1008
|
this.moveTo(l.x, l.y, l.z, t)
|
|
1009
1009
|
), a.push(this.zoomTo(b, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
@@ -1084,21 +1084,21 @@ class J extends ws {
|
|
|
1084
1084
|
* @param enableTransition
|
|
1085
1085
|
* @category Methods
|
|
1086
1086
|
*/
|
|
1087
|
-
lerpLookAt(e, t, s, i, r, o, n, a, h, m, p,
|
|
1087
|
+
lerpLookAt(e, t, s, i, r, o, n, a, h, m, p, y, f, u = !1) {
|
|
1088
1088
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
|
|
1089
|
-
const g = w.set(i, r, o),
|
|
1089
|
+
const g = w.set(i, r, o), v = L.set(e, t, s);
|
|
1090
1090
|
k.setFromVector3(
|
|
1091
|
-
|
|
1091
|
+
v.sub(g).applyQuaternion(this._yAxisUpSpace)
|
|
1092
1092
|
);
|
|
1093
|
-
const l = G.set(m, p,
|
|
1093
|
+
const l = G.set(m, p, y), _ = L.set(n, a, h);
|
|
1094
1094
|
ae.setFromVector3(
|
|
1095
|
-
|
|
1096
|
-
), this._targetEnd.copy(g.lerp(l,
|
|
1097
|
-
const
|
|
1095
|
+
_.sub(l).applyQuaternion(this._yAxisUpSpace)
|
|
1096
|
+
), this._targetEnd.copy(g.lerp(l, f));
|
|
1097
|
+
const C = ae.theta - k.theta, O = ae.phi - k.phi, b = ae.radius - k.radius;
|
|
1098
1098
|
this._sphericalEnd.set(
|
|
1099
|
-
k.radius + b *
|
|
1100
|
-
k.phi +
|
|
1101
|
-
k.theta +
|
|
1099
|
+
k.radius + b * f,
|
|
1100
|
+
k.phi + O * f,
|
|
1101
|
+
k.theta + C * f
|
|
1102
1102
|
), this.normalizeRotations(), this._needsUpdate = !0, u || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
1103
1103
|
const E = !u || P(this._target.x, this._targetEnd.x, this.restThreshold) && P(this._target.y, this._targetEnd.y, this.restThreshold) && P(this._target.z, this._targetEnd.z, this.restThreshold) && P(
|
|
1104
1104
|
this._spherical.theta,
|
|
@@ -1194,9 +1194,9 @@ class J extends ws {
|
|
|
1194
1194
|
* @category Methods
|
|
1195
1195
|
*/
|
|
1196
1196
|
setOrbitPoint(e, t, s) {
|
|
1197
|
-
this._camera.updateMatrixWorld(),
|
|
1197
|
+
this._camera.updateMatrixWorld(), j.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), F.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Z.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
|
|
1198
1198
|
const i = w.set(e, t, s), r = i.distanceTo(this._camera.position), o = i.sub(this._camera.position);
|
|
1199
|
-
|
|
1199
|
+
j.multiplyScalar(o.x), F.multiplyScalar(o.y), Z.multiplyScalar(o.z), w.copy(j).add(F).add(Z), w.z = w.z + r, this.dollyTo(r, !1), this.setFocalOffset(-w.x, w.y, -w.z, !1), this.moveTo(e, t, s, !1);
|
|
1200
1200
|
}
|
|
1201
1201
|
/**
|
|
1202
1202
|
* Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
|
|
@@ -1372,7 +1372,7 @@ class J extends ws {
|
|
|
1372
1372
|
this._focalOffsetEnd,
|
|
1373
1373
|
this._focalOffset
|
|
1374
1374
|
), n = this._zoomEnd - this._zoom;
|
|
1375
|
-
if (
|
|
1375
|
+
if (A(t))
|
|
1376
1376
|
this._thetaVelocity.value = 0, this._spherical.theta = this._sphericalEnd.theta;
|
|
1377
1377
|
else {
|
|
1378
1378
|
const p = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
|
|
@@ -1385,7 +1385,7 @@ class J extends ws {
|
|
|
1385
1385
|
e
|
|
1386
1386
|
), this._needsUpdate = !0;
|
|
1387
1387
|
}
|
|
1388
|
-
if (
|
|
1388
|
+
if (A(s))
|
|
1389
1389
|
this._phiVelocity.value = 0, this._spherical.phi = this._sphericalEnd.phi;
|
|
1390
1390
|
else {
|
|
1391
1391
|
const p = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
|
|
@@ -1398,7 +1398,7 @@ class J extends ws {
|
|
|
1398
1398
|
e
|
|
1399
1399
|
), this._needsUpdate = !0;
|
|
1400
1400
|
}
|
|
1401
|
-
if (
|
|
1401
|
+
if (A(i))
|
|
1402
1402
|
this._radiusVelocity.value = 0, this._spherical.radius = this._sphericalEnd.radius;
|
|
1403
1403
|
else {
|
|
1404
1404
|
const p = this._isUserControllingDolly ? this.draggingSmoothTime : this.smoothTime;
|
|
@@ -1411,7 +1411,7 @@ class J extends ws {
|
|
|
1411
1411
|
e
|
|
1412
1412
|
), this._needsUpdate = !0;
|
|
1413
1413
|
}
|
|
1414
|
-
if (
|
|
1414
|
+
if (A(r.x) && A(r.y) && A(r.z))
|
|
1415
1415
|
this._targetVelocity.set(0, 0, 0), this._target.copy(this._targetEnd);
|
|
1416
1416
|
else {
|
|
1417
1417
|
const p = this._isUserControllingTruck ? this.draggingSmoothTime : this.smoothTime;
|
|
@@ -1425,7 +1425,7 @@ class J extends ws {
|
|
|
1425
1425
|
this._target
|
|
1426
1426
|
), this._needsUpdate = !0;
|
|
1427
1427
|
}
|
|
1428
|
-
if (
|
|
1428
|
+
if (A(o.x) && A(o.y) && A(o.z))
|
|
1429
1429
|
this._focalOffsetVelocity.set(0, 0, 0), this._focalOffset.copy(this._focalOffsetEnd);
|
|
1430
1430
|
else {
|
|
1431
1431
|
const p = this._isUserControllingOffset ? this.draggingSmoothTime : this.smoothTime;
|
|
@@ -1439,7 +1439,7 @@ class J extends ws {
|
|
|
1439
1439
|
this._focalOffset
|
|
1440
1440
|
), this._needsUpdate = !0;
|
|
1441
1441
|
}
|
|
1442
|
-
if (
|
|
1442
|
+
if (A(n))
|
|
1443
1443
|
this._zoomVelocity.value = 0, this._zoom = this._zoomEnd;
|
|
1444
1444
|
else {
|
|
1445
1445
|
const p = this._isUserControllingZoom ? this.draggingSmoothTime : this.smoothTime;
|
|
@@ -1454,45 +1454,45 @@ class J extends ws {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
if (this.dollyToCursor) {
|
|
1456
1456
|
if (Y(this._camera) && this._changedDolly !== 0) {
|
|
1457
|
-
const p = this._spherical.radius - this._lastDistance,
|
|
1457
|
+
const p = this._spherical.radius - this._lastDistance, y = this._camera, f = this._getCameraDirection(ne), u = w.copy(f).cross(y.up).normalize();
|
|
1458
1458
|
u.lengthSq() === 0 && (u.x = 1);
|
|
1459
|
-
const g = L.crossVectors(u,
|
|
1459
|
+
const g = L.crossVectors(u, f), v = this._sphericalEnd.radius * Math.tan(y.getEffectiveFOV() * ie * 0.5), _ = (this._sphericalEnd.radius - p - this._sphericalEnd.radius) / this._sphericalEnd.radius, C = G.copy(this._targetEnd).add(
|
|
1460
1460
|
u.multiplyScalar(
|
|
1461
|
-
this._dollyControlCoord.x *
|
|
1461
|
+
this._dollyControlCoord.x * v * y.aspect
|
|
1462
1462
|
)
|
|
1463
1463
|
).add(
|
|
1464
|
-
g.multiplyScalar(this._dollyControlCoord.y *
|
|
1465
|
-
),
|
|
1464
|
+
g.multiplyScalar(this._dollyControlCoord.y * v)
|
|
1465
|
+
), O = w.copy(this._targetEnd).lerp(C, _), b = this._lastDollyDirection === K.IN && this._spherical.radius <= this.minDistance, E = this._lastDollyDirection === K.OUT && this.maxDistance <= this._spherical.radius;
|
|
1466
1466
|
if (this.infinityDolly && (b || E)) {
|
|
1467
1467
|
this._sphericalEnd.radius -= p, this._spherical.radius -= p;
|
|
1468
|
-
const D = L.copy(
|
|
1469
|
-
|
|
1468
|
+
const D = L.copy(f).multiplyScalar(-p);
|
|
1469
|
+
O.add(D);
|
|
1470
1470
|
}
|
|
1471
|
-
this._boundary.clampPoint(
|
|
1472
|
-
const x = L.subVectors(
|
|
1473
|
-
this._targetEnd.copy(
|
|
1471
|
+
this._boundary.clampPoint(O, O);
|
|
1472
|
+
const x = L.subVectors(O, this._targetEnd);
|
|
1473
|
+
this._targetEnd.copy(O), this._target.add(x), this._changedDolly -= p, A(this._changedDolly) && (this._changedDolly = 0);
|
|
1474
1474
|
} else if (H(this._camera) && this._changedZoom !== 0) {
|
|
1475
|
-
const p = this._zoom - this._lastZoom,
|
|
1475
|
+
const p = this._zoom - this._lastZoom, y = this._camera, f = w.set(
|
|
1476
1476
|
this._dollyControlCoord.x,
|
|
1477
1477
|
this._dollyControlCoord.y,
|
|
1478
|
-
(
|
|
1479
|
-
).unproject(
|
|
1480
|
-
b -
|
|
1478
|
+
(y.near + y.far) / (y.near - y.far)
|
|
1479
|
+
).unproject(y), u = L.set(0, 0, -1).applyQuaternion(y.quaternion), g = G.copy(f).add(u.multiplyScalar(-f.dot(y.up))), l = -(this._zoom - p - this._zoom) / this._zoom, _ = this._getCameraDirection(ne), C = this._targetEnd.dot(_), O = w.copy(this._targetEnd).lerp(g, l), b = O.dot(_), E = _.multiplyScalar(
|
|
1480
|
+
b - C
|
|
1481
1481
|
);
|
|
1482
|
-
|
|
1483
|
-
const x = L.subVectors(
|
|
1484
|
-
this._targetEnd.copy(
|
|
1482
|
+
O.sub(E), this._boundary.clampPoint(O, O);
|
|
1483
|
+
const x = L.subVectors(O, this._targetEnd);
|
|
1484
|
+
this._targetEnd.copy(O), this._target.add(x), this._changedZoom -= p, A(this._changedZoom) && (this._changedZoom = 0);
|
|
1485
1485
|
}
|
|
1486
1486
|
}
|
|
1487
1487
|
this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
|
|
1488
1488
|
const a = this._collisionTest();
|
|
1489
|
-
this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!
|
|
1489
|
+
this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!A(this._focalOffset.x) || !A(this._focalOffset.y) || !A(this._focalOffset.z)) && (j.setFromMatrixColumn(this._camera.matrix, 0), F.setFromMatrixColumn(this._camera.matrix, 1), Z.setFromMatrixColumn(this._camera.matrix, 2), j.multiplyScalar(this._focalOffset.x), F.multiplyScalar(-this._focalOffset.y), Z.multiplyScalar(this._focalOffset.z), w.copy(j).add(F).add(Z), this._camera.position.add(w), this._camera.updateMatrixWorld()), this._boundaryEnclosesCamera && this._encloseToBoundary(
|
|
1490
1490
|
this._camera.position.copy(this._target),
|
|
1491
1491
|
w.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),
|
|
1492
1492
|
1
|
|
1493
1493
|
);
|
|
1494
1494
|
const m = this._needsUpdate;
|
|
1495
|
-
return m && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : m ? (this.dispatchEvent({ type: "update" }),
|
|
1495
|
+
return m && !this._updatedLastTime ? (this._hasRested = !1, this.dispatchEvent({ type: "wake" }), this.dispatchEvent({ type: "update" })) : m ? (this.dispatchEvent({ type: "update" }), A(t, this.restThreshold) && A(s, this.restThreshold) && A(i, this.restThreshold) && A(r.x, this.restThreshold) && A(r.y, this.restThreshold) && A(r.z, this.restThreshold) && A(o.x, this.restThreshold) && A(o.y, this.restThreshold) && A(o.z, this.restThreshold) && A(n, this.restThreshold) && !this._hasRested && (this._hasRested = !0, this.dispatchEvent({ type: "rest" }))) : !m && 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 = m, this._needsUpdate = !1, m;
|
|
1496
1496
|
}
|
|
1497
1497
|
/**
|
|
1498
1498
|
* Get all state in JSON string
|
|
@@ -1702,12 +1702,12 @@ class J extends ws {
|
|
|
1702
1702
|
const a = n.geometry.clone();
|
|
1703
1703
|
a.applyMatrix4(n.matrixWorld);
|
|
1704
1704
|
const m = a.attributes.position;
|
|
1705
|
-
for (let p = 0,
|
|
1705
|
+
for (let p = 0, y = m.count; p < y; p++)
|
|
1706
1706
|
w.fromBufferAttribute(m, p), r = Math.max(r, i.distanceToSquared(w));
|
|
1707
1707
|
}), s.radius = Math.sqrt(r), s;
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
1710
|
-
var
|
|
1710
|
+
var Ae = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null, Ke = Q && typeof Q.apply == "function" ? Q.apply : function(e, t, s) {
|
|
1711
1711
|
return Function.prototype.apply.call(e, t, s);
|
|
1712
1712
|
}, ue;
|
|
1713
1713
|
Q && typeof Q.ownKeys == "function" ? ue = Q.ownKeys : Object.getOwnPropertySymbols ? ue = function(e) {
|
|
@@ -1721,21 +1721,21 @@ function Ls(c) {
|
|
|
1721
1721
|
var ut = Number.isNaN || function(e) {
|
|
1722
1722
|
return e !== e;
|
|
1723
1723
|
};
|
|
1724
|
-
function
|
|
1725
|
-
|
|
1724
|
+
function S() {
|
|
1725
|
+
S.init.call(this);
|
|
1726
1726
|
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1727
|
+
Ae.exports = S;
|
|
1728
|
+
Ae.exports.once = Ms;
|
|
1729
|
+
S.EventEmitter = S;
|
|
1730
|
+
S.prototype._events = void 0;
|
|
1731
|
+
S.prototype._eventsCount = 0;
|
|
1732
|
+
S.prototype._maxListeners = void 0;
|
|
1733
1733
|
var $e = 10;
|
|
1734
1734
|
function ge(c) {
|
|
1735
1735
|
if (typeof c != "function")
|
|
1736
1736
|
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof c);
|
|
1737
1737
|
}
|
|
1738
|
-
Object.defineProperty(
|
|
1738
|
+
Object.defineProperty(S, "defaultMaxListeners", {
|
|
1739
1739
|
enumerable: !0,
|
|
1740
1740
|
get: function() {
|
|
1741
1741
|
return $e;
|
|
@@ -1746,21 +1746,21 @@ Object.defineProperty(A, "defaultMaxListeners", {
|
|
|
1746
1746
|
$e = c;
|
|
1747
1747
|
}
|
|
1748
1748
|
});
|
|
1749
|
-
|
|
1749
|
+
S.init = function() {
|
|
1750
1750
|
(this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
|
|
1751
1751
|
};
|
|
1752
|
-
|
|
1752
|
+
S.prototype.setMaxListeners = function(e) {
|
|
1753
1753
|
if (typeof e != "number" || e < 0 || ut(e))
|
|
1754
1754
|
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
|
|
1755
1755
|
return this._maxListeners = e, this;
|
|
1756
1756
|
};
|
|
1757
1757
|
function ft(c) {
|
|
1758
|
-
return c._maxListeners === void 0 ?
|
|
1758
|
+
return c._maxListeners === void 0 ? S.defaultMaxListeners : c._maxListeners;
|
|
1759
1759
|
}
|
|
1760
|
-
|
|
1760
|
+
S.prototype.getMaxListeners = function() {
|
|
1761
1761
|
return ft(this);
|
|
1762
1762
|
};
|
|
1763
|
-
|
|
1763
|
+
S.prototype.emit = function(e) {
|
|
1764
1764
|
for (var t = [], s = 1; s < arguments.length; s++) t.push(arguments[s]);
|
|
1765
1765
|
var i = e === "error", r = this._events;
|
|
1766
1766
|
if (r !== void 0)
|
|
@@ -1780,7 +1780,7 @@ A.prototype.emit = function(e) {
|
|
|
1780
1780
|
if (typeof a == "function")
|
|
1781
1781
|
Ke(a, this, t);
|
|
1782
1782
|
else
|
|
1783
|
-
for (var h = a.length, m =
|
|
1783
|
+
for (var h = a.length, m = Ot(a, h), s = 0; s < h; ++s)
|
|
1784
1784
|
Ke(m[s], this, t);
|
|
1785
1785
|
return !0;
|
|
1786
1786
|
};
|
|
@@ -1799,11 +1799,11 @@ function _t(c, e, t, s) {
|
|
|
1799
1799
|
}
|
|
1800
1800
|
return c;
|
|
1801
1801
|
}
|
|
1802
|
-
|
|
1802
|
+
S.prototype.addListener = function(e, t) {
|
|
1803
1803
|
return _t(this, e, t, !1);
|
|
1804
1804
|
};
|
|
1805
|
-
|
|
1806
|
-
|
|
1805
|
+
S.prototype.on = S.prototype.addListener;
|
|
1806
|
+
S.prototype.prependListener = function(e, t) {
|
|
1807
1807
|
return _t(this, e, t, !0);
|
|
1808
1808
|
};
|
|
1809
1809
|
function Ps() {
|
|
@@ -1814,13 +1814,13 @@ function gt(c, e, t) {
|
|
|
1814
1814
|
var s = { fired: !1, wrapFn: void 0, target: c, type: e, listener: t }, i = Ps.bind(s);
|
|
1815
1815
|
return i.listener = t, s.wrapFn = i, i;
|
|
1816
1816
|
}
|
|
1817
|
-
|
|
1817
|
+
S.prototype.once = function(e, t) {
|
|
1818
1818
|
return ge(t), this.on(e, gt(this, e, t)), this;
|
|
1819
1819
|
};
|
|
1820
|
-
|
|
1820
|
+
S.prototype.prependOnceListener = function(e, t) {
|
|
1821
1821
|
return ge(t), this.prependListener(e, gt(this, e, t)), this;
|
|
1822
1822
|
};
|
|
1823
|
-
|
|
1823
|
+
S.prototype.removeListener = function(e, t) {
|
|
1824
1824
|
var s, i, r, o, n;
|
|
1825
1825
|
if (ge(t), i = this._events, i === void 0)
|
|
1826
1826
|
return this;
|
|
@@ -1836,12 +1836,12 @@ A.prototype.removeListener = function(e, t) {
|
|
|
1836
1836
|
}
|
|
1837
1837
|
if (r < 0)
|
|
1838
1838
|
return this;
|
|
1839
|
-
r === 0 ? s.shift() :
|
|
1839
|
+
r === 0 ? s.shift() : Ss(s, r), s.length === 1 && (i[e] = s[0]), i.removeListener !== void 0 && this.emit("removeListener", e, n || t);
|
|
1840
1840
|
}
|
|
1841
1841
|
return this;
|
|
1842
1842
|
};
|
|
1843
|
-
|
|
1844
|
-
|
|
1843
|
+
S.prototype.off = S.prototype.removeListener;
|
|
1844
|
+
S.prototype.removeAllListeners = function(e) {
|
|
1845
1845
|
var t, s, i;
|
|
1846
1846
|
if (s = this._events, s === void 0)
|
|
1847
1847
|
return this;
|
|
@@ -1860,24 +1860,24 @@ A.prototype.removeAllListeners = function(e) {
|
|
|
1860
1860
|
this.removeListener(e, t[i]);
|
|
1861
1861
|
return this;
|
|
1862
1862
|
};
|
|
1863
|
-
function
|
|
1863
|
+
function vt(c, e, t) {
|
|
1864
1864
|
var s = c._events;
|
|
1865
1865
|
if (s === void 0)
|
|
1866
1866
|
return [];
|
|
1867
1867
|
var i = s[e];
|
|
1868
|
-
return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ?
|
|
1868
|
+
return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ? As(i) : Ot(i, i.length);
|
|
1869
1869
|
}
|
|
1870
|
-
|
|
1871
|
-
return
|
|
1870
|
+
S.prototype.listeners = function(e) {
|
|
1871
|
+
return vt(this, e, !0);
|
|
1872
1872
|
};
|
|
1873
|
-
|
|
1874
|
-
return
|
|
1873
|
+
S.prototype.rawListeners = function(e) {
|
|
1874
|
+
return vt(this, e, !1);
|
|
1875
1875
|
};
|
|
1876
|
-
|
|
1877
|
-
return typeof c.listenerCount == "function" ? c.listenerCount(e) :
|
|
1876
|
+
S.listenerCount = function(c, e) {
|
|
1877
|
+
return typeof c.listenerCount == "function" ? c.listenerCount(e) : yt.call(c, e);
|
|
1878
1878
|
};
|
|
1879
|
-
|
|
1880
|
-
function
|
|
1879
|
+
S.prototype.listenerCount = yt;
|
|
1880
|
+
function yt(c) {
|
|
1881
1881
|
var e = this._events;
|
|
1882
1882
|
if (e !== void 0) {
|
|
1883
1883
|
var t = e[c];
|
|
@@ -1888,20 +1888,20 @@ function vt(c) {
|
|
|
1888
1888
|
}
|
|
1889
1889
|
return 0;
|
|
1890
1890
|
}
|
|
1891
|
-
|
|
1891
|
+
S.prototype.eventNames = function() {
|
|
1892
1892
|
return this._eventsCount > 0 ? ue(this._events) : [];
|
|
1893
1893
|
};
|
|
1894
|
-
function
|
|
1894
|
+
function Ot(c, e) {
|
|
1895
1895
|
for (var t = new Array(e), s = 0; s < e; ++s)
|
|
1896
1896
|
t[s] = c[s];
|
|
1897
1897
|
return t;
|
|
1898
1898
|
}
|
|
1899
|
-
function
|
|
1899
|
+
function Ss(c, e) {
|
|
1900
1900
|
for (; e + 1 < c.length; e++)
|
|
1901
1901
|
c[e] = c[e + 1];
|
|
1902
1902
|
c.pop();
|
|
1903
1903
|
}
|
|
1904
|
-
function
|
|
1904
|
+
function As(c) {
|
|
1905
1905
|
for (var e = new Array(c.length), t = 0; t < e.length; ++t)
|
|
1906
1906
|
e[t] = c[t].listener || c[t];
|
|
1907
1907
|
return e;
|
|
@@ -1914,13 +1914,13 @@ function Ms(c, e) {
|
|
|
1914
1914
|
function r() {
|
|
1915
1915
|
typeof c.removeListener == "function" && c.removeListener("error", i), t([].slice.call(arguments));
|
|
1916
1916
|
}
|
|
1917
|
-
|
|
1917
|
+
Ct(c, e, r, { once: !0 }), e !== "error" && Ds(c, i, { once: !0 });
|
|
1918
1918
|
});
|
|
1919
1919
|
}
|
|
1920
1920
|
function Ds(c, e, t) {
|
|
1921
|
-
typeof c.on == "function" &&
|
|
1921
|
+
typeof c.on == "function" && Ct(c, "error", e, t);
|
|
1922
1922
|
}
|
|
1923
|
-
function
|
|
1923
|
+
function Ct(c, e, t, s) {
|
|
1924
1924
|
if (typeof c.on == "function")
|
|
1925
1925
|
s.once ? c.once(e, t) : c.on(e, t);
|
|
1926
1926
|
else if (typeof c.addEventListener == "function")
|
|
@@ -1930,7 +1930,7 @@ function Ot(c, e, t, s) {
|
|
|
1930
1930
|
else
|
|
1931
1931
|
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof c);
|
|
1932
1932
|
}
|
|
1933
|
-
var
|
|
1933
|
+
var ve = Ae.exports;
|
|
1934
1934
|
let Et = class {
|
|
1935
1935
|
constructor() {
|
|
1936
1936
|
this.mask = 1;
|
|
@@ -1965,7 +1965,7 @@ let Et = class {
|
|
|
1965
1965
|
};
|
|
1966
1966
|
class ee {
|
|
1967
1967
|
constructor() {
|
|
1968
|
-
this.event = new
|
|
1968
|
+
this.event = new ve.EventEmitter(), this.controllerMap = /* @__PURE__ */ new Map(), this.activeIndex = -1, this.activeControllerSet = /* @__PURE__ */ new Set();
|
|
1969
1969
|
}
|
|
1970
1970
|
addController(e, t) {
|
|
1971
1971
|
const s = new Et();
|
|
@@ -2217,18 +2217,18 @@ class zs extends ms {
|
|
|
2217
2217
|
constructor() {
|
|
2218
2218
|
super();
|
|
2219
2219
|
const e = ks;
|
|
2220
|
-
this.uniforms =
|
|
2220
|
+
this.uniforms = jt.clone(e.uniforms), this.material = new Ft({
|
|
2221
2221
|
name: e.name,
|
|
2222
2222
|
uniforms: this.uniforms,
|
|
2223
2223
|
vertexShader: e.vertexShader,
|
|
2224
2224
|
fragmentShader: e.fragmentShader
|
|
2225
|
-
}), this.fsQuad ? this.fsQuad = new
|
|
2225
|
+
}), this.fsQuad ? this.fsQuad = new je(this.material) : this._fsQuad && (this._fsQuad = new je(this.material));
|
|
2226
2226
|
}
|
|
2227
2227
|
}
|
|
2228
|
-
const
|
|
2228
|
+
const js = new Nt({ color: "black" }), Fs = new ot({
|
|
2229
2229
|
color: "black",
|
|
2230
2230
|
sizeAttenuation: !1
|
|
2231
|
-
}),
|
|
2231
|
+
}), Ns = new ot({
|
|
2232
2232
|
color: "black",
|
|
2233
2233
|
sizeAttenuation: !0
|
|
2234
2234
|
}), Is = new nt({
|
|
@@ -2271,13 +2271,13 @@ class Ws {
|
|
|
2271
2271
|
samples: Math.min(n, a),
|
|
2272
2272
|
type: Vt
|
|
2273
2273
|
}
|
|
2274
|
-
), p = new ze(o, m),
|
|
2275
|
-
p.setSize(
|
|
2276
|
-
const
|
|
2274
|
+
), p = new ze(o, m), y = this.getSize();
|
|
2275
|
+
p.setSize(y.width, y.height);
|
|
2276
|
+
const f = new hs(
|
|
2277
2277
|
s.scene,
|
|
2278
2278
|
i.camera
|
|
2279
2279
|
);
|
|
2280
|
-
p.addPass(
|
|
2280
|
+
p.addPass(f), this.scene = s.scene, this.camera = i.camera, this.finalComposer = p, this.renderPass = f, i.event.on("pageChange", (u) => {
|
|
2281
2281
|
this.changeCamera(u);
|
|
2282
2282
|
}), s.event.on("pageChange", (u) => {
|
|
2283
2283
|
this.changeScene(u);
|
|
@@ -2345,7 +2345,7 @@ class Ws {
|
|
|
2345
2345
|
e.push(o);
|
|
2346
2346
|
return;
|
|
2347
2347
|
}
|
|
2348
|
-
this.bloomMaterials[o.uuid] = o.material, n.isSprite ? n.material.sizeAttenuation ? n.material = Is : n.material = Hs : o.material instanceof pt ? o.material = Bs : a.isPoints ? a.material.sizeAttenuation ? a.material =
|
|
2348
|
+
this.bloomMaterials[o.uuid] = o.material, n.isSprite ? n.material.sizeAttenuation ? n.material = Is : n.material = Hs : o.material instanceof pt ? o.material = Bs : a.isPoints ? a.material.sizeAttenuation ? a.material = Ns : a.material = Fs : o.material = js;
|
|
2349
2349
|
}
|
|
2350
2350
|
});
|
|
2351
2351
|
}), e.forEach((i) => {
|
|
@@ -2461,54 +2461,54 @@ class $s {
|
|
|
2461
2461
|
height: i
|
|
2462
2462
|
};
|
|
2463
2463
|
}, this.render = function(u, g) {
|
|
2464
|
-
u.matrixWorldAutoUpdate === !0 && u.updateMatrixWorld(), g.parent === null && g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(), Xe.copy(g.matrixWorldInverse), qe.multiplyMatrices(g.projectionMatrix, Xe), m(u, u, g), this.sortObjects &&
|
|
2464
|
+
u.matrixWorldAutoUpdate === !0 && u.updateMatrixWorld(), g.parent === null && g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(), Xe.copy(g.matrixWorldInverse), qe.multiplyMatrices(g.projectionMatrix, Xe), m(u, u, g), this.sortObjects && f(u);
|
|
2465
2465
|
}, this.setSize = function(u, g) {
|
|
2466
2466
|
s = u, i = g, r = s / 2, o = i / 2, a.style.width = u + "px", a.style.height = g + "px";
|
|
2467
2467
|
};
|
|
2468
2468
|
function h(u) {
|
|
2469
2469
|
u.isCSS2DObject && (u.element.style.display = "none");
|
|
2470
|
-
for (let g = 0,
|
|
2470
|
+
for (let g = 0, v = u.children.length; g < v; g++)
|
|
2471
2471
|
h(u.children[g]);
|
|
2472
2472
|
}
|
|
2473
|
-
function m(u, g,
|
|
2473
|
+
function m(u, g, v) {
|
|
2474
2474
|
if (u.visible === !1) {
|
|
2475
2475
|
h(u);
|
|
2476
2476
|
return;
|
|
2477
2477
|
}
|
|
2478
2478
|
if (u.isCSS2DObject) {
|
|
2479
2479
|
q.setFromMatrixPosition(u.matrixWorld), q.applyMatrix4(qe);
|
|
2480
|
-
const l = q.z >= -1 && q.z <= 1 && u.layers.test(
|
|
2481
|
-
|
|
2482
|
-
const
|
|
2483
|
-
distanceToCameraSquared: p(
|
|
2480
|
+
const l = q.z >= -1 && q.z <= 1 && u.layers.test(v.layers) === !0, _ = u.element;
|
|
2481
|
+
_.style.display = l === !0 ? "" : "none", l === !0 && (u.onBeforeRender(t, g, v), _.style.transform = "translate(" + -100 * u.center.x + "%," + -100 * u.center.y + "%)translate(" + (q.x * r + r) + "px," + (-q.y * o + o) + "px)", _.parentNode !== a && a.appendChild(_), u.onAfterRender(t, g, v));
|
|
2482
|
+
const C = {
|
|
2483
|
+
distanceToCameraSquared: p(v, u)
|
|
2484
2484
|
};
|
|
2485
|
-
n.objects.set(u,
|
|
2485
|
+
n.objects.set(u, C);
|
|
2486
2486
|
}
|
|
2487
|
-
for (let l = 0,
|
|
2488
|
-
m(u.children[l], g,
|
|
2487
|
+
for (let l = 0, _ = u.children.length; l < _; l++)
|
|
2488
|
+
m(u.children[l], g, v);
|
|
2489
2489
|
}
|
|
2490
2490
|
function p(u, g) {
|
|
2491
2491
|
return Qe.setFromMatrixPosition(u.matrixWorld), Je.setFromMatrixPosition(g.matrixWorld), Qe.distanceToSquared(Je);
|
|
2492
2492
|
}
|
|
2493
|
-
function
|
|
2493
|
+
function y(u) {
|
|
2494
2494
|
const g = [];
|
|
2495
|
-
return u.traverseVisible(function(
|
|
2496
|
-
|
|
2495
|
+
return u.traverseVisible(function(v) {
|
|
2496
|
+
v.isCSS2DObject && g.push(v);
|
|
2497
2497
|
}), g;
|
|
2498
2498
|
}
|
|
2499
|
-
function
|
|
2500
|
-
const g =
|
|
2501
|
-
if (l.renderOrder !==
|
|
2502
|
-
return
|
|
2503
|
-
const
|
|
2504
|
-
return
|
|
2505
|
-
}),
|
|
2506
|
-
for (let l = 0,
|
|
2507
|
-
g[l].element.style.zIndex =
|
|
2499
|
+
function f(u) {
|
|
2500
|
+
const g = y(u).sort(function(l, _) {
|
|
2501
|
+
if (l.renderOrder !== _.renderOrder)
|
|
2502
|
+
return _.renderOrder - l.renderOrder;
|
|
2503
|
+
const C = n.objects.get(l).distanceToCameraSquared, O = n.objects.get(_).distanceToCameraSquared;
|
|
2504
|
+
return C - O;
|
|
2505
|
+
}), v = g.length;
|
|
2506
|
+
for (let l = 0, _ = g.length; l < _; l++)
|
|
2507
|
+
g[l].element.style.zIndex = v - l;
|
|
2508
2508
|
}
|
|
2509
2509
|
}
|
|
2510
2510
|
}
|
|
2511
|
-
const et = new I(), Gs = new at(), tt = new I(),
|
|
2511
|
+
const et = new I(), Gs = new at(), tt = new I(), N = new W(), Xs = new W();
|
|
2512
2512
|
class qs {
|
|
2513
2513
|
/**
|
|
2514
2514
|
* Constructs a new CSS3D renderer.
|
|
@@ -2531,54 +2531,54 @@ class qs {
|
|
|
2531
2531
|
width: s,
|
|
2532
2532
|
height: i
|
|
2533
2533
|
};
|
|
2534
|
-
}, this.render = function(
|
|
2535
|
-
const
|
|
2536
|
-
l.view && l.view.enabled ? (h.style.transform = `translate( ${-l.view.offsetX * (s / l.view.width)}px, ${-l.view.offsetY * (i / l.view.height)}px )`, h.style.transform += `scale( ${l.view.fullWidth / l.view.width}, ${l.view.fullHeight / l.view.height} )`) : h.style.transform = "",
|
|
2537
|
-
let
|
|
2538
|
-
l.isOrthographicCamera && (
|
|
2539
|
-
const b = l.view && l.view.enabled ? l.view.height / l.view.fullHeight : 1, E = l.isOrthographicCamera ? `scale( ${b} )scale(` +
|
|
2540
|
-
n.camera.style !== D && (m.style.transform = D, n.camera.style = D), g(
|
|
2541
|
-
}, this.setSize = function(
|
|
2542
|
-
s =
|
|
2534
|
+
}, this.render = function(v, l) {
|
|
2535
|
+
const _ = l.projectionMatrix.elements[5] * o;
|
|
2536
|
+
l.view && l.view.enabled ? (h.style.transform = `translate( ${-l.view.offsetX * (s / l.view.width)}px, ${-l.view.offsetY * (i / l.view.height)}px )`, h.style.transform += `scale( ${l.view.fullWidth / l.view.width}, ${l.view.fullHeight / l.view.height} )`) : h.style.transform = "", v.matrixWorldAutoUpdate === !0 && v.updateMatrixWorld(), l.parent === null && l.matrixWorldAutoUpdate === !0 && l.updateMatrixWorld();
|
|
2537
|
+
let C, O;
|
|
2538
|
+
l.isOrthographicCamera && (C = -(l.right + l.left) / 2, O = (l.top + l.bottom) / 2);
|
|
2539
|
+
const b = l.view && l.view.enabled ? l.view.height / l.view.fullHeight : 1, E = l.isOrthographicCamera ? `scale( ${b} )scale(` + _ + ")translate(" + p(C) + "px," + p(O) + "px)" + y(l.matrixWorldInverse) : `scale( ${b} )translateZ(` + _ + "px)" + y(l.matrixWorldInverse), D = (l.isPerspectiveCamera ? "perspective(" + _ + "px) " : "") + E + "translate(" + r + "px," + o + "px)";
|
|
2540
|
+
n.camera.style !== D && (m.style.transform = D, n.camera.style = D), g(v, v, l);
|
|
2541
|
+
}, this.setSize = function(v, l) {
|
|
2542
|
+
s = v, i = l, r = s / 2, o = i / 2, a.style.width = v + "px", a.style.height = l + "px", h.style.width = v + "px", h.style.height = l + "px", m.style.width = v + "px", m.style.height = l + "px";
|
|
2543
2543
|
};
|
|
2544
|
-
function p(
|
|
2545
|
-
return Math.abs(
|
|
2544
|
+
function p(v) {
|
|
2545
|
+
return Math.abs(v) < 1e-10 ? 0 : v;
|
|
2546
2546
|
}
|
|
2547
|
-
function v
|
|
2548
|
-
const l =
|
|
2547
|
+
function y(v) {
|
|
2548
|
+
const l = v.elements;
|
|
2549
2549
|
return "matrix3d(" + p(l[0]) + "," + p(-l[1]) + "," + p(l[2]) + "," + p(l[3]) + "," + p(l[4]) + "," + p(-l[5]) + "," + p(l[6]) + "," + p(l[7]) + "," + p(l[8]) + "," + p(-l[9]) + "," + p(l[10]) + "," + p(l[11]) + "," + p(l[12]) + "," + p(-l[13]) + "," + p(l[14]) + "," + p(l[15]) + ")";
|
|
2550
2550
|
}
|
|
2551
|
-
function
|
|
2552
|
-
const l =
|
|
2551
|
+
function f(v) {
|
|
2552
|
+
const l = v.elements;
|
|
2553
2553
|
return "translate(-50%,-50%)" + ("matrix3d(" + p(l[0]) + "," + p(l[1]) + "," + p(l[2]) + "," + p(l[3]) + "," + p(-l[4]) + "," + p(-l[5]) + "," + p(-l[6]) + "," + p(-l[7]) + "," + p(l[8]) + "," + p(l[9]) + "," + p(l[10]) + "," + p(l[11]) + "," + p(l[12]) + "," + p(l[13]) + "," + p(l[14]) + "," + p(l[15]) + ")");
|
|
2554
2554
|
}
|
|
2555
|
-
function u(
|
|
2556
|
-
|
|
2557
|
-
for (let l = 0,
|
|
2558
|
-
u(
|
|
2555
|
+
function u(v) {
|
|
2556
|
+
v.isCSS3DObject && (v.element.style.display = "none");
|
|
2557
|
+
for (let l = 0, _ = v.children.length; l < _; l++)
|
|
2558
|
+
u(v.children[l]);
|
|
2559
2559
|
}
|
|
2560
|
-
function g(
|
|
2561
|
-
if (
|
|
2562
|
-
u(
|
|
2560
|
+
function g(v, l, _, C) {
|
|
2561
|
+
if (v.visible === !1) {
|
|
2562
|
+
u(v);
|
|
2563
2563
|
return;
|
|
2564
2564
|
}
|
|
2565
|
-
if (
|
|
2566
|
-
const
|
|
2567
|
-
if (b.style.display =
|
|
2568
|
-
|
|
2565
|
+
if (v.isCSS3DObject) {
|
|
2566
|
+
const O = v.layers.test(_.layers) === !0, b = v.element;
|
|
2567
|
+
if (b.style.display = O === !0 ? "" : "none", O === !0) {
|
|
2568
|
+
v.onBeforeRender(t, l, _);
|
|
2569
2569
|
let E;
|
|
2570
|
-
|
|
2571
|
-
const x = n.objects.get(
|
|
2570
|
+
v.isCSS3DSprite ? (N.copy(_.matrixWorldInverse), N.transpose(), v.rotation2D !== 0 && N.multiply(Xs.makeRotationZ(v.rotation2D)), v.matrixWorld.decompose(et, Gs, tt), N.setPosition(et), N.scale(tt), N.elements[3] = 0, N.elements[7] = 0, N.elements[11] = 0, N.elements[15] = 1, E = f(N)) : E = f(v.matrixWorld);
|
|
2571
|
+
const x = n.objects.get(v);
|
|
2572
2572
|
if (x === void 0 || x.style !== E) {
|
|
2573
2573
|
b.style.transform = E;
|
|
2574
2574
|
const D = { style: E };
|
|
2575
|
-
n.objects.set(
|
|
2575
|
+
n.objects.set(v, D);
|
|
2576
2576
|
}
|
|
2577
|
-
b.parentNode !== m && m.appendChild(b),
|
|
2577
|
+
b.parentNode !== m && m.appendChild(b), v.onAfterRender(t, l, _);
|
|
2578
2578
|
}
|
|
2579
2579
|
}
|
|
2580
|
-
for (let
|
|
2581
|
-
g(
|
|
2580
|
+
for (let O = 0, b = v.children.length; O < b; O++)
|
|
2581
|
+
g(v.children[O], l, _);
|
|
2582
2582
|
}
|
|
2583
2583
|
}
|
|
2584
2584
|
}
|
|
@@ -2705,37 +2705,40 @@ class ei {
|
|
|
2705
2705
|
this.enabled = !0, this.pickFunctionsMap = /* @__PURE__ */ new Map(), this.pickNodeFunctionsMap = /* @__PURE__ */ new Map(), this.pickFunctionsMapIndex = -1, this.pickNodeFunctionsMapIndex = -1, this.activeObjects = /* @__PURE__ */ new Set(), this.activeObject = null, this.prevActiveObjects = /* @__PURE__ */ new Set(), this.objCallbackMap = /* @__PURE__ */ new Map(), this.pickListener = {
|
|
2706
2706
|
move: !1,
|
|
2707
2707
|
down: !1
|
|
2708
|
-
}, this.cursorObjects = /* @__PURE__ */ new Map(), this.cursorListenerAdded = !1, this.pencil = e, this.domElement = ((t = e.options.controls) == null ? void 0 : t.domElement) || e.options.container;
|
|
2708
|
+
}, this.hasEnterOnStopEvent = !1, this.cursorObjects = /* @__PURE__ */ new Map(), this.cursorListenerAdded = !1, this.moveStopTimer = null, this.moveStopDelay = 150, this.lastMoveEvent = null, this.lastMoveActiveObjects = /* @__PURE__ */ new Set(), this.lastMoveRealActiveObject = null, this.triggeredEnterOnStopObjects = /* @__PURE__ */ new Set(), this.pencil = e, this.domElement = ((t = e.options.controls) == null ? void 0 : t.domElement) || e.options.container;
|
|
2709
2709
|
}
|
|
2710
2710
|
addPickListener(e) {
|
|
2711
|
-
const t = /* @__PURE__ */ new Set(["move", "enter", "leave"]), s = /* @__PURE__ */ new Set(["down", "downOutside", "click"]), i = (r) => {
|
|
2712
|
-
var
|
|
2711
|
+
const t = /* @__PURE__ */ new Set(["move", "enter", "leave", "enterOnStop"]), s = /* @__PURE__ */ new Set(["down", "downOutside", "click"]), i = (r) => {
|
|
2712
|
+
var y;
|
|
2713
2713
|
if (!this.enabled)
|
|
2714
2714
|
return;
|
|
2715
2715
|
r.preventDefault();
|
|
2716
2716
|
const o = e === "move" ? t : s, n = [];
|
|
2717
|
-
if (this.pickFunctionsMap.forEach((
|
|
2718
|
-
o.has(
|
|
2719
|
-
objArr:
|
|
2717
|
+
if (this.pickFunctionsMap.forEach((f) => {
|
|
2718
|
+
o.has(f.type) && n.push(te(U({}, f), {
|
|
2719
|
+
objArr: f.objArr instanceof Function ? f.objArr() : f.objArr
|
|
2720
2720
|
}));
|
|
2721
2721
|
}), n.length === 0) return;
|
|
2722
2722
|
this.activeObjects.clear(), this.objCallbackMap.clear(), this.activeObject = null;
|
|
2723
2723
|
const a = this.objCallbackMap;
|
|
2724
|
-
for (const
|
|
2725
|
-
for (const u of
|
|
2724
|
+
for (const f of n)
|
|
2725
|
+
for (const u of f.objArr) {
|
|
2726
2726
|
if (!u.object3d || !u.visibleWithAncestors) continue;
|
|
2727
2727
|
a.has(u) || a.set(u, /* @__PURE__ */ new Map());
|
|
2728
2728
|
const g = a.get(u);
|
|
2729
|
-
g.has(
|
|
2729
|
+
g.has(f.type) || g.set(f.type, []), g.get(f.type).push(f.cb);
|
|
2730
2730
|
}
|
|
2731
2731
|
if (a.size === 0) return;
|
|
2732
|
-
const h = [...a.keys()].map((
|
|
2732
|
+
const h = [...a.keys()].map((f) => f.object3d), m = (y = this.pencil.pick(r, h, !1)) == null ? void 0 : y.intersects;
|
|
2733
2733
|
if (!m || m.length === 0)
|
|
2734
2734
|
e === "down" ? this.handleDownOutside(r) : e === "move" && this.handleLeaveEvents(r);
|
|
2735
2735
|
else {
|
|
2736
|
-
const
|
|
2737
|
-
this.processIntersection(
|
|
2736
|
+
const f = m[0];
|
|
2737
|
+
this.processIntersection(f, r, e);
|
|
2738
2738
|
}
|
|
2739
|
+
e === "move" && this.hasEnterOnStopEvent && (this.handleMoveStop(r), this.triggeredEnterOnStopObjects.forEach((f) => {
|
|
2740
|
+
this.activeObjects.has(f) || this.triggeredEnterOnStopObjects.delete(f);
|
|
2741
|
+
}));
|
|
2739
2742
|
const p = this.prevActiveObjects;
|
|
2740
2743
|
this.prevActiveObjects = this.activeObjects, this.activeObjects = p, this.activeObjects.clear();
|
|
2741
2744
|
};
|
|
@@ -2798,10 +2801,10 @@ class ei {
|
|
|
2798
2801
|
});
|
|
2799
2802
|
const m = a.get("click");
|
|
2800
2803
|
if (m) {
|
|
2801
|
-
const p = (
|
|
2802
|
-
|
|
2803
|
-
const
|
|
2804
|
-
if (!r && Math.abs(
|
|
2804
|
+
const p = (y) => {
|
|
2805
|
+
y.preventDefault();
|
|
2806
|
+
const f = 5;
|
|
2807
|
+
if (!r && Math.abs(y.clientX - e.clientX) <= f && Math.abs(y.clientY - e.clientY) <= f)
|
|
2805
2808
|
for (const u of m)
|
|
2806
2809
|
u({
|
|
2807
2810
|
baseObject: n,
|
|
@@ -2839,6 +2842,38 @@ class ei {
|
|
|
2839
2842
|
});
|
|
2840
2843
|
});
|
|
2841
2844
|
}
|
|
2845
|
+
/** 处理鼠标停止移动事件 */
|
|
2846
|
+
handleMoveStop(e) {
|
|
2847
|
+
this.moveStopTimer !== null && clearTimeout(this.moveStopTimer), this.lastMoveEvent = e, this.lastMoveActiveObjects.clear(), this.activeObjects.forEach((t) => this.lastMoveActiveObjects.add(t)), this.lastMoveRealActiveObject = this.activeObject, this.moveStopTimer = window.setTimeout(() => {
|
|
2848
|
+
this.triggerEnterOnStop();
|
|
2849
|
+
}, this.moveStopDelay);
|
|
2850
|
+
}
|
|
2851
|
+
/** 触发 enterOnStop 事件 */
|
|
2852
|
+
triggerEnterOnStop() {
|
|
2853
|
+
if (!this.lastMoveEvent || this.lastMoveActiveObjects.size === 0) return;
|
|
2854
|
+
const e = this.lastMoveEvent, t = this.objCallbackMap;
|
|
2855
|
+
let s = !1;
|
|
2856
|
+
const i = () => {
|
|
2857
|
+
s = !0;
|
|
2858
|
+
};
|
|
2859
|
+
for (const r of this.lastMoveActiveObjects) {
|
|
2860
|
+
if (s) break;
|
|
2861
|
+
const o = t.get(r);
|
|
2862
|
+
if (!o) continue;
|
|
2863
|
+
const n = o.get("enterOnStop");
|
|
2864
|
+
if (n && !this.triggeredEnterOnStopObjects.has(r)) {
|
|
2865
|
+
this.triggeredEnterOnStopObjects.add(r);
|
|
2866
|
+
for (const a of n)
|
|
2867
|
+
a({
|
|
2868
|
+
baseObject: r,
|
|
2869
|
+
realBaseObject: this.lastMoveRealActiveObject,
|
|
2870
|
+
mouseEvent: e,
|
|
2871
|
+
sp: i
|
|
2872
|
+
});
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
this.moveStopTimer = null;
|
|
2876
|
+
}
|
|
2842
2877
|
/** 重置鼠标样式 */
|
|
2843
2878
|
resetCursor() {
|
|
2844
2879
|
this.domElement.style.cursor = "";
|
|
@@ -2849,16 +2884,15 @@ class ei {
|
|
|
2849
2884
|
this.cursorListenerAdded = !0;
|
|
2850
2885
|
const e = (t) => {
|
|
2851
2886
|
var o;
|
|
2852
|
-
if (!this.enabled
|
|
2853
|
-
this.resetCursor();
|
|
2887
|
+
if (!this.enabled)
|
|
2854
2888
|
return;
|
|
2855
|
-
|
|
2889
|
+
this.cursorObjects.size === 0 && this.resetCursor();
|
|
2856
2890
|
const s = [...this.cursorObjects.keys()].filter((n) => n.object3d && n.visibleWithAncestors).map((n) => n.object3d);
|
|
2857
2891
|
if (s.length === 0) {
|
|
2858
2892
|
this.resetCursor();
|
|
2859
2893
|
return;
|
|
2860
2894
|
}
|
|
2861
|
-
const i = this.pencil.pick(t, s, !
|
|
2895
|
+
const i = this.pencil.pick(t, s, !1);
|
|
2862
2896
|
if (!((o = i == null ? void 0 : i.intersects) != null && o.length)) {
|
|
2863
2897
|
this.resetCursor();
|
|
2864
2898
|
return;
|
|
@@ -2897,14 +2931,16 @@ class ei {
|
|
|
2897
2931
|
let i = t;
|
|
2898
2932
|
i === "mousemove" ? i = "move" : i === "mouseenter" ? i = "enter" : i === "mouseleave" && (i = "leave"), this.pickFunctionsMapIndex += 1;
|
|
2899
2933
|
const r = this.pickFunctionsMapIndex;
|
|
2900
|
-
return this.pickFunctionsMap.set(r, { objArr: e, type: i, cb: s }), this.pickListener.move || Array.from(this.pickFunctionsMap.values()).some(
|
|
2901
|
-
(n) => ["move", "enter", "leave"].includes(n.type)
|
|
2934
|
+
return this.pickFunctionsMap.set(r, { objArr: e, type: i, cb: s }), i === "enterOnStop" && (this.hasEnterOnStopEvent = !0), this.pickListener.move || Array.from(this.pickFunctionsMap.values()).some(
|
|
2935
|
+
(n) => ["move", "enter", "leave", "enterOnStop"].includes(n.type)
|
|
2902
2936
|
) && (this.pickListener.move = !0, this.addPickListener("move")), this.pickListener.down || Array.from(this.pickFunctionsMap.values()).some(
|
|
2903
2937
|
(n) => ["down", "downOutside", "click"].includes(n.type)
|
|
2904
2938
|
) && (this.pickListener.down = !0, this.addPickListener("down")), r;
|
|
2905
2939
|
}
|
|
2906
2940
|
removePick(e) {
|
|
2907
|
-
this.pickFunctionsMap.delete(e)
|
|
2941
|
+
this.pickFunctionsMap.delete(e), this.hasEnterOnStopEvent = Array.from(this.pickFunctionsMap.values()).some(
|
|
2942
|
+
(t) => t.type === "enterOnStop"
|
|
2943
|
+
);
|
|
2908
2944
|
}
|
|
2909
2945
|
handlePickNode(e, t, s) {
|
|
2910
2946
|
if (t === "downOutside")
|
|
@@ -2937,7 +2973,7 @@ class ei {
|
|
|
2937
2973
|
}
|
|
2938
2974
|
}
|
|
2939
2975
|
dispose() {
|
|
2940
|
-
this.pickFunctionsMap.clear(), this.pickNodeFunctionsMap.clear(), this.activeObjects.clear(), this.prevActiveObjects.clear(), this.objCallbackMap.clear(), this.cursorObjects.clear();
|
|
2976
|
+
this.moveStopTimer !== null && (clearTimeout(this.moveStopTimer), this.moveStopTimer = null), this.pickFunctionsMap.clear(), this.pickNodeFunctionsMap.clear(), this.activeObjects.clear(), this.prevActiveObjects.clear(), this.lastMoveActiveObjects.clear(), this.triggeredEnterOnStopObjects.clear(), this.objCallbackMap.clear(), this.cursorObjects.clear();
|
|
2941
2977
|
}
|
|
2942
2978
|
}
|
|
2943
2979
|
class ti extends ei {
|
|
@@ -3007,12 +3043,12 @@ class ti extends ei {
|
|
|
3007
3043
|
}
|
|
3008
3044
|
draw(e, t, s) {
|
|
3009
3045
|
return se(this, null, function* () {
|
|
3010
|
-
var p,
|
|
3046
|
+
var p, y, f;
|
|
3011
3047
|
const i = this.objectNamesToFactories.get(String(e));
|
|
3012
3048
|
if (!i)
|
|
3013
3049
|
throw new Error(`Unrecognized factory: ${String(e)}`);
|
|
3014
3050
|
t || (t = {}), t.target === void 0 && (t.target = s);
|
|
3015
|
-
const r = t.target, o = (p = t.onTop) != null ? p : 0, n = (
|
|
3051
|
+
const r = t.target, o = (p = t.onTop) != null ? p : 0, n = (y = t.prefab) != null ? y : !1, a = (f = t.create) != null ? f : !0, h = new i().create(t);
|
|
3016
3052
|
let m;
|
|
3017
3053
|
if (r === null)
|
|
3018
3054
|
m = null;
|
|
@@ -3155,7 +3191,7 @@ class ii extends dt {
|
|
|
3155
3191
|
super(e);
|
|
3156
3192
|
}
|
|
3157
3193
|
load(e, t, s, i) {
|
|
3158
|
-
const r = new
|
|
3194
|
+
const r = new Se(this.manager);
|
|
3159
3195
|
r.setResponseType("blob"), r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
|
|
3160
3196
|
e,
|
|
3161
3197
|
(o) => {
|
|
@@ -3181,21 +3217,21 @@ class it extends dt {
|
|
|
3181
3217
|
load(e, t, s, i) {
|
|
3182
3218
|
let r, o;
|
|
3183
3219
|
this.options.type === "image" ? (o = document.createElement("img"), r = new fe(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 es(o)) : r = new fe();
|
|
3184
|
-
const n = new
|
|
3220
|
+
const n = new Se(this.manager);
|
|
3185
3221
|
return n.setResponseType("blob"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
|
|
3186
3222
|
e,
|
|
3187
3223
|
(a) => {
|
|
3188
3224
|
let h = a;
|
|
3189
3225
|
const m = e.split(".").pop(), p = this.options.type === "image" ? `image/${m || "png"}` : `video/${m || "mp4"}`;
|
|
3190
3226
|
h = h.slice(0, a.size, p);
|
|
3191
|
-
const
|
|
3192
|
-
o.removeEventListener("load",
|
|
3193
|
-
},
|
|
3194
|
-
|
|
3195
|
-
}, u = (
|
|
3196
|
-
|
|
3227
|
+
const y = () => {
|
|
3228
|
+
o.removeEventListener("load", f, !1), o.removeEventListener("error", u, !1);
|
|
3229
|
+
}, f = () => {
|
|
3230
|
+
y(), r.needsUpdate = !0, t && t(r);
|
|
3231
|
+
}, u = (v) => {
|
|
3232
|
+
y(), i && i(v), this.manager.itemError(e), this.manager.itemEnd(e);
|
|
3197
3233
|
};
|
|
3198
|
-
o.addEventListener("load",
|
|
3234
|
+
o.addEventListener("load", f, !1), o.addEventListener("error", u, !1);
|
|
3199
3235
|
const g = window.URL.createObjectURL(h);
|
|
3200
3236
|
o.src = g;
|
|
3201
3237
|
},
|
|
@@ -3215,7 +3251,7 @@ const ri = {
|
|
|
3215
3251
|
};
|
|
3216
3252
|
class oi {
|
|
3217
3253
|
constructor(e) {
|
|
3218
|
-
this.loadObj = [], this.delLoadArr = [], this.assets = /* @__PURE__ */ new Map(), this.event = new
|
|
3254
|
+
this.loadObj = [], this.delLoadArr = [], this.assets = /* @__PURE__ */ new Map(), this.event = new ve.EventEmitter(), this.options = U({
|
|
3219
3255
|
simpleTexture4deleted: !1,
|
|
3220
3256
|
prefix: ""
|
|
3221
3257
|
}, e), this.loadingManager = new ts(
|
|
@@ -3266,17 +3302,17 @@ class oi {
|
|
|
3266
3302
|
if (e === "media")
|
|
3267
3303
|
return this.videoTextureLoader || (this.videoTextureLoader = new it(this.loadingManager), this.videoTextureLoader.setOptions({ type: "video" }), this.options.prefix && this.videoTextureLoader.setPath(this.options.prefix)), this.videoTextureLoader;
|
|
3268
3304
|
if (e === "gltf" && (t != null && t.dracoPath))
|
|
3269
|
-
return this.dracoGltfLoader || (this.dracoGltfLoader = new
|
|
3305
|
+
return this.dracoGltfLoader || (this.dracoGltfLoader = new Fe(this.loadingManager), this.dracoLoader = new vs(), this.dracoLoader.setDecoderPath(t == null ? void 0 : t.dracoPath), this.dracoGltfLoader.setDRACOLoader(this.dracoLoader), this.options.prefix && this.dracoGltfLoader.setPath(this.options.prefix)), this.dracoGltfLoader;
|
|
3270
3306
|
if (e === "gltf")
|
|
3271
|
-
return this.gltfLoader || (this.gltfLoader = new
|
|
3307
|
+
return this.gltfLoader || (this.gltfLoader = new Fe(this.loadingManager), this.options.prefix && this.gltfLoader.setPath(this.options.prefix)), this.gltfLoader;
|
|
3272
3308
|
if (e === "lottie")
|
|
3273
|
-
return this.lottieLoader || (this.lottieLoader = new
|
|
3309
|
+
return this.lottieLoader || (this.lottieLoader = new Os(this.loadingManager), this.options.prefix && this.lottieLoader.setPath(this.options.prefix)), this.lottieLoader;
|
|
3274
3310
|
if (e === "gzipJson")
|
|
3275
3311
|
return this.gzipJsonLoader || (this.gzipJsonLoader = new ii(this.loadingManager), this.options.prefix && this.gzipJsonLoader.setPath(this.options.prefix)), this.gzipJsonLoader;
|
|
3276
3312
|
if (e === "json")
|
|
3277
|
-
return this.jsonLoader || (this.jsonLoader = new
|
|
3313
|
+
return this.jsonLoader || (this.jsonLoader = new Se(this.loadingManager), this.jsonLoader.setResponseType("json"), this.options.prefix && this.jsonLoader.setPath(this.options.prefix)), this.jsonLoader;
|
|
3278
3314
|
if (e === "exr")
|
|
3279
|
-
return this.exrLoader || (this.exrLoader = new
|
|
3315
|
+
return this.exrLoader || (this.exrLoader = new ys(this.loadingManager), this.options.prefix && this.exrLoader.setPath(this.options.prefix)), this.exrLoader;
|
|
3280
3316
|
}
|
|
3281
3317
|
add(e, t) {
|
|
3282
3318
|
typeof e == "string" && (e = [e]), e.forEach((s) => {
|
|
@@ -3496,8 +3532,8 @@ class li {
|
|
|
3496
3532
|
if (typeof h == "string" && !Number.isNaN(Number(h))) {
|
|
3497
3533
|
const p = Number(h);
|
|
3498
3534
|
if (p >= 0 && p < a.length) {
|
|
3499
|
-
const
|
|
3500
|
-
return this.rmBaseObjectMap(e,
|
|
3535
|
+
const y = a[p];
|
|
3536
|
+
return this.rmBaseObjectMap(e, y), a[p] = m, m && (this.applyColorSpaceToMaterials(m), this.addBaseObjectMap(e)), !0;
|
|
3501
3537
|
}
|
|
3502
3538
|
}
|
|
3503
3539
|
return a[h] = m, !0;
|
|
@@ -3566,7 +3602,7 @@ class li {
|
|
|
3566
3602
|
});
|
|
3567
3603
|
}
|
|
3568
3604
|
applyColorSpaceToMaterials(e) {
|
|
3569
|
-
|
|
3605
|
+
Cs({ material: e });
|
|
3570
3606
|
}
|
|
3571
3607
|
material2array(e) {
|
|
3572
3608
|
return Array.isArray(e) ? e : [e];
|
|
@@ -3654,16 +3690,16 @@ class di {
|
|
|
3654
3690
|
toneMappingExposure: h,
|
|
3655
3691
|
outputColorSpace: m,
|
|
3656
3692
|
logarithmicDepthBuffer: p,
|
|
3657
|
-
preserveDrawingBuffer:
|
|
3658
|
-
stencil:
|
|
3693
|
+
preserveDrawingBuffer: y,
|
|
3694
|
+
stencil: f,
|
|
3659
3695
|
depth: u
|
|
3660
3696
|
} = i, g = new is({
|
|
3661
3697
|
alpha: r,
|
|
3662
3698
|
antialias: n,
|
|
3663
3699
|
powerPreference: a,
|
|
3664
3700
|
logarithmicDepthBuffer: p,
|
|
3665
|
-
preserveDrawingBuffer:
|
|
3666
|
-
stencil:
|
|
3701
|
+
preserveDrawingBuffer: y,
|
|
3702
|
+
stencil: f,
|
|
3667
3703
|
depth: u
|
|
3668
3704
|
});
|
|
3669
3705
|
g.setSize(t, s), g.setPixelRatio(o), g.toneMappingExposure = h, g.outputColorSpace = m, this.renderer = g;
|
|
@@ -3715,7 +3751,7 @@ class mi extends ee {
|
|
|
3715
3751
|
}
|
|
3716
3752
|
class ui {
|
|
3717
3753
|
constructor(e) {
|
|
3718
|
-
this.event = new
|
|
3754
|
+
this.event = new ve.EventEmitter();
|
|
3719
3755
|
const { renderer: t, scene: s, camera: i } = e, r = new bs(
|
|
3720
3756
|
i,
|
|
3721
3757
|
t.domElement
|
|
@@ -3808,7 +3844,7 @@ class _i {
|
|
|
3808
3844
|
const _e = class _e {
|
|
3809
3845
|
constructor(e) {
|
|
3810
3846
|
var r, o;
|
|
3811
|
-
this.raycaster = new ht(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new I(), this._cameraTarget = new I(), this.event = new
|
|
3847
|
+
this.raycaster = new ht(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new I(), this._cameraTarget = new I(), this.event = new ve.EventEmitter(), this.timer = new ns(), this.userData = {}, this.pageActiveIndex = 0, this.pages = new Et(), this.userSetDprCache = 1, this.viewPadding = [0, 0, 0, 0], this._isDispose = !1, this.event.setMaxListeners(1 / 0), (o = (r = this.timer).connect) == null || o.call(r, document), this.options = Rt(_e.options, e, {
|
|
3812
3848
|
isMergeableObject: Ts
|
|
3813
3849
|
}), this.userSetDprCache = this.options.renderer.devicePixelRatio;
|
|
3814
3850
|
const {
|
|
@@ -3858,7 +3894,7 @@ const _e = class _e {
|
|
|
3858
3894
|
return this.mListController.mList;
|
|
3859
3895
|
}
|
|
3860
3896
|
tweenUpdateRaf() {
|
|
3861
|
-
|
|
3897
|
+
Oe.update(), this.TweenRaf = requestAnimationFrame(this.tweenUpdateRaf.bind(this));
|
|
3862
3898
|
}
|
|
3863
3899
|
use(e, ...t) {
|
|
3864
3900
|
this.installPlugins.has(e.pluginName) ? console.log("plugin already installed") : typeof e.install == "function" && (e.install(this, ...t), this.installPlugins.set(e.pluginName, e));
|
|
@@ -3885,7 +3921,7 @@ const _e = class _e {
|
|
|
3885
3921
|
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.mListController.setPageActive(e), this.leadController.setPageActive(e), this.pageActiveIndex = e;
|
|
3886
3922
|
}
|
|
3887
3923
|
init() {
|
|
3888
|
-
var
|
|
3924
|
+
var _;
|
|
3889
3925
|
const {
|
|
3890
3926
|
container: e,
|
|
3891
3927
|
WebGPUTHREE: t,
|
|
@@ -3911,9 +3947,9 @@ const _e = class _e {
|
|
|
3911
3947
|
const p = new Rs({
|
|
3912
3948
|
width: a,
|
|
3913
3949
|
height: h
|
|
3914
|
-
}),
|
|
3950
|
+
}), y = new mi({}), f = new Ks({
|
|
3915
3951
|
controlsParams: {
|
|
3916
|
-
domElement: (
|
|
3952
|
+
domElement: (_ = o == null ? void 0 : o.domElement) != null ? _ : m.renderer.domElement
|
|
3917
3953
|
}
|
|
3918
3954
|
}), u = new ai({
|
|
3919
3955
|
loaderParams: U({
|
|
@@ -3921,21 +3957,21 @@ const _e = class _e {
|
|
|
3921
3957
|
}, n)
|
|
3922
3958
|
}), g = new hi({
|
|
3923
3959
|
pencil: this
|
|
3924
|
-
}),
|
|
3960
|
+
}), v = new si({
|
|
3925
3961
|
pencil: this
|
|
3926
3962
|
});
|
|
3927
|
-
this.sceneController =
|
|
3963
|
+
this.sceneController = y, this.cameraController = p, this.controlsController = f, this.loaderController = u, this.mListController = g, this.leadController = v;
|
|
3928
3964
|
const l = this.addPage({
|
|
3929
3965
|
sceneOptions: this.options.scene,
|
|
3930
3966
|
cameraOptions: this.options.camera
|
|
3931
3967
|
});
|
|
3932
3968
|
if (this.showPage(l), s) {
|
|
3933
|
-
const
|
|
3969
|
+
const C = new Js({
|
|
3934
3970
|
container: e,
|
|
3935
|
-
sceneController:
|
|
3971
|
+
sceneController: y,
|
|
3936
3972
|
cameraController: p
|
|
3937
3973
|
});
|
|
3938
|
-
|
|
3974
|
+
C.add(y.scene), this.helperController = C, i && C.addViewHelper();
|
|
3939
3975
|
}
|
|
3940
3976
|
e.appendChild(m.renderer.domElement);
|
|
3941
3977
|
}
|
|
@@ -4057,7 +4093,7 @@ const _e = class _e {
|
|
|
4057
4093
|
var s, i, r, o, n, a;
|
|
4058
4094
|
if (!this.camera || !this.scene)
|
|
4059
4095
|
return;
|
|
4060
|
-
this.event.emit("beforeRender"), this.timer.update(),
|
|
4096
|
+
this.event.emit("beforeRender"), this.timer.update(), Oe.update();
|
|
4061
4097
|
const e = this.timer.getDelta(), t = this.timer.getElapsed();
|
|
4062
4098
|
this.controlsController.update(e, t), this.leadController.update(e, t), this.installPlugins.forEach((h) => {
|
|
4063
4099
|
var m;
|
|
@@ -4106,11 +4142,11 @@ const _e = class _e {
|
|
|
4106
4142
|
}
|
|
4107
4143
|
}
|
|
4108
4144
|
dispose() {
|
|
4109
|
-
var e, t, s, i, r, o, n, a, h, m, p,
|
|
4110
|
-
this.handeleResize(1, 1, !1), this.stop(), this.timer.dispose(),
|
|
4111
|
-
var
|
|
4112
|
-
(
|
|
4113
|
-
}), (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(), (n = this.helperController) == null || n.dispose(), (a = this.composerController) == null || a.dispose(), (h = this.rendererController) == null || h.dispose(), (m = this.loaderController) == null || m.dispose(), (p = this.leadController) == null || p.dispose(), (
|
|
4145
|
+
var e, t, s, i, r, o, n, a, h, m, p, y, f, u;
|
|
4146
|
+
this.handeleResize(1, 1, !1), this.stop(), this.timer.dispose(), Oe.removeAll(), this.event.removeAllListeners(), (e = this.resizeObserver) == null || e.unobserve(this.options.container), this.installPlugins.forEach((g) => {
|
|
4147
|
+
var v;
|
|
4148
|
+
(v = g.dispose) == null || v.call(g);
|
|
4149
|
+
}), (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(), (n = this.helperController) == null || n.dispose(), (a = this.composerController) == null || a.dispose(), (h = this.rendererController) == null || h.dispose(), (m = this.loaderController) == null || m.dispose(), (p = this.leadController) == null || p.dispose(), (y = this.mListController) == null || y.dispose(), this.cssRendererController = void 0, this.installPlugins.clear(), (f = this.stats) == null || f.dom.remove(), (u = this.renderer) == null || u.domElement.remove(), this._isDispose = !0;
|
|
4114
4150
|
}
|
|
4115
4151
|
};
|
|
4116
4152
|
_e.options = {
|