gl-draw 0.17.0-beta.40 → 0.17.0-beta.42
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/{objects/node → core/CSSRenderer}/CollisionManager.d.ts +6 -3
- package/dist/core/CSSRenderer/index.d.ts +18 -6
- package/dist/core/Pencil.d.ts +16 -2
- package/dist/index.js +2 -2
- package/dist/index.module.js +525 -345
- package/dist/index.module2.js +72 -56
- package/dist/index2.js +3 -3
- package/dist/objects/index.d.ts +0 -1
- package/dist/objects/index.js +1 -1
- package/dist/objects/index.module.js +583 -724
- package/dist/objects/node/index.d.ts +9 -3
- package/package.json +1 -1
package/dist/index.module.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var Pt = Object.defineProperty, St = Object.defineProperties;
|
|
2
2
|
var At = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var De = Object.getOwnPropertySymbols;
|
|
4
|
-
var Mt = Object.prototype.hasOwnProperty,
|
|
5
|
-
var
|
|
4
|
+
var Mt = Object.prototype.hasOwnProperty, Rt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Ue = (c, e, t) => e in c ? Pt(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t, D = (c, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
Mt.call(e, t) &&
|
|
7
|
+
Mt.call(e, t) && Ue(c, t, e[t]);
|
|
8
8
|
if (De)
|
|
9
9
|
for (var t of De(e))
|
|
10
|
-
|
|
10
|
+
Rt.call(e, t) && Ue(c, t, e[t]);
|
|
11
11
|
return c;
|
|
12
12
|
}, te = (c, e) => St(c, At(e));
|
|
13
13
|
var se = (c, e, t) => new Promise((s, i) => {
|
|
@@ -26,12 +26,12 @@ 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
|
|
30
|
-
import
|
|
29
|
+
import * as Ce from "@tweenjs/tween.js";
|
|
30
|
+
import Dt 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 Ft, RawShaderMaterial as jt, 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
|
|
32
|
+
import { Vector3 as I, PerspectiveCamera as kt, Matrix4 as W, ShaderMaterial as zt, UniformsUtils as Ft, RawShaderMaterial as jt, 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 ke, CameraHelper as $t, PointLightHelper as Gt, DirectionalLightHelper as Xt, SpotLightHelper as qt, HemisphereLightHelper as Qt, Box3Helper as ze, Scene as ct, Group as Oe, Camera as Jt, Loader as dt, FileLoader as Me, 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 Se, I as he } from "./index.module2.js";
|
|
34
|
-
import { EffectComposer as
|
|
34
|
+
import { EffectComposer as Fe } from "three/examples/jsm/postprocessing/EffectComposer";
|
|
35
35
|
import { RenderPass as hs } from "three/examples/jsm/postprocessing/RenderPass";
|
|
36
36
|
import { SSAOPass as cs } from "three/examples/jsm/postprocessing/SSAOPass";
|
|
37
37
|
import { UnrealBloomPass as ds } from "three/examples/jsm/postprocessing/UnrealBloomPass";
|
|
@@ -47,16 +47,16 @@ 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
|
|
59
|
-
import { TransformControls as
|
|
54
|
+
import { DRACOLoader as ys } from "three/examples/jsm/loaders/DRACOLoader";
|
|
55
|
+
import { EXRLoader as vs } from "three/examples/jsm/loaders/EXRLoader";
|
|
56
|
+
import { GLTFLoader as Ne } from "three/examples/jsm/loaders/GLTFLoader";
|
|
57
|
+
import { LottieLoader as Cs } from "three/examples/jsm/loaders/LottieLoader";
|
|
58
|
+
import { a as Os, C as Es, i as bs } from "./isPlainObject.module.js";
|
|
59
|
+
import { TransformControls as Ts } from "three/examples/jsm/controls/TransformControls";
|
|
60
60
|
const M = {
|
|
61
61
|
LEFT: 1,
|
|
62
62
|
RIGHT: 2,
|
|
@@ -94,7 +94,7 @@ 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, Ie = 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
|
}
|
|
@@ -104,7 +104,7 @@ function A(c, e = mt) {
|
|
|
104
104
|
function P(c, e, t = mt) {
|
|
105
105
|
return A(c - e, t);
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function He(c, e) {
|
|
108
108
|
return Math.round(c / e) * e;
|
|
109
109
|
}
|
|
110
110
|
function re(c) {
|
|
@@ -119,32 +119,32 @@ 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 f = e + (h +
|
|
122
|
+
const v = (t.value + o * h) * r;
|
|
123
|
+
t.value = (t.value - o * v) * a;
|
|
124
|
+
let f = e + (h + v) * a;
|
|
125
125
|
return m - c > 0 == f > m && (f = m, t.value = (f - m) / r), f;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function Be(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 (
|
|
133
|
-
const
|
|
134
|
-
f = f /
|
|
135
|
-
}
|
|
136
|
-
m = c.x - f, p = c.y - u,
|
|
137
|
-
const E = (t.x + n * f) * r, x = (t.y + n * u) * r,
|
|
138
|
-
t.x = (t.x - n * E) * h, t.y = (t.y - n * x) * h, t.z = (t.z - n *
|
|
139
|
-
const V =
|
|
140
|
-
return V * wt + le * xt +
|
|
130
|
+
let m = e.x, p = e.y, v = e.z, f = c.x - m, u = c.y - p, g = c.z - v;
|
|
131
|
+
const y = m, l = p, _ = v, O = i * s, C = O * O, T = f * f + u * u + g * g;
|
|
132
|
+
if (T > C) {
|
|
133
|
+
const ve = Math.sqrt(T);
|
|
134
|
+
f = f / ve * O, u = u / ve * O, g = g / ve * O;
|
|
135
|
+
}
|
|
136
|
+
m = c.x - f, p = c.y - u, v = c.z - g;
|
|
137
|
+
const E = (t.x + n * f) * r, x = (t.y + n * u) * r, R = (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 * R) * h, o.x = m + (f + E) * h, o.y = p + (u + x) * h, o.z = v + (g + R) * h;
|
|
139
|
+
const V = y - c.x, le = l - c.y, Tt = _ - c.z, wt = o.x - y, xt = o.y - l, Lt = o.z - _;
|
|
140
|
+
return V * wt + le * xt + Tt * Lt > 0 && (o.x = y, o.y = l, o.z = _, t.x = (o.x - y) / r, t.y = (o.y - l) / r, t.z = (o.z - _) / r), o;
|
|
141
141
|
}
|
|
142
142
|
function Ee(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;
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function be(c, e) {
|
|
148
148
|
return H(c) ? (console.warn(`${e} is not supported in OrthographicCamera`), !0) : !1;
|
|
149
149
|
}
|
|
150
150
|
class ws {
|
|
@@ -212,10 +212,10 @@ class ws {
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
const de = 1 / 8, xs = /Mac/.test(navigator.platform);
|
|
215
|
-
let
|
|
215
|
+
let b, Ve, pe, Te, U, w, L, G, ne, F, j, Z, Ye, Ze, k, ae, X, We, we, Ke, xe, Le, me;
|
|
216
216
|
class J extends ws {
|
|
217
217
|
static install(e) {
|
|
218
|
-
|
|
218
|
+
b = e.THREE, Ve = Object.freeze(new b.Vector3(0, 0, 0)), pe = Object.freeze(new b.Vector3(0, 1, 0)), Te = Object.freeze(new b.Vector3(0, 0, 1)), U = new b.Vector2(), w = new b.Vector3(), L = new b.Vector3(), G = new b.Vector3(), ne = new b.Vector3(), F = new b.Vector3(), j = new b.Vector3(), Z = new b.Vector3(), Ye = new b.Vector3(), Ze = new b.Vector3(), k = new b.Spherical(), ae = new b.Spherical(), X = new b.Box3(), We = new b.Box3(), we = new b.Sphere(), Ke = new b.Quaternion(), xe = new b.Quaternion(), Le = new b.Matrix4(), me = new b.Raycaster();
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
221
221
|
* list all ACTIONs
|
|
@@ -243,56 +243,56 @@ 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
|
|
247
|
-
let
|
|
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 b.Vector3(), this._focalOffsetVelocity = new b.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (l, _, O, C) => {
|
|
247
|
+
let T, E;
|
|
248
248
|
if (Y(this._camera)) {
|
|
249
|
-
const x = w.copy(this._camera.position).sub(this._target),
|
|
250
|
-
|
|
249
|
+
const x = w.copy(this._camera.position).sub(this._target), R = this._camera.getEffectiveFOV() * ie, V = x.length() * Math.tan(R * 0.5);
|
|
250
|
+
T = 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
|
-
|
|
253
|
+
T = 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
|
-
|
|
257
|
-
this._focalOffsetEnd.x +
|
|
256
|
+
C ? (O ? this.setFocalOffset(
|
|
257
|
+
this._focalOffsetEnd.x + T,
|
|
258
258
|
this._focalOffsetEnd.y,
|
|
259
259
|
this._focalOffsetEnd.z,
|
|
260
260
|
!0
|
|
261
|
-
) : this.truck(
|
|
262
|
-
this._focalOffsetEnd.x +
|
|
261
|
+
) : this.truck(T, 0, !0), this.forward(-E, !0)) : O ? this.setFocalOffset(
|
|
262
|
+
this._focalOffsetEnd.x + T,
|
|
263
263
|
this._focalOffsetEnd.y + E,
|
|
264
264
|
this._focalOffsetEnd.z,
|
|
265
265
|
!0
|
|
266
|
-
) : this.truck(
|
|
266
|
+
) : this.truck(T, E, !0);
|
|
267
267
|
}, this._rotateInternal = (l, _) => {
|
|
268
|
-
const
|
|
269
|
-
this.rotate(
|
|
270
|
-
}, this._dollyInternal = (l, _,
|
|
271
|
-
const
|
|
268
|
+
const O = $ * this.azimuthRotateSpeed * l / this._elementRect.height, C = $ * this.polarRotateSpeed * _ / this._elementRect.height;
|
|
269
|
+
this.rotate(O, C, !0);
|
|
270
|
+
}, this._dollyInternal = (l, _, O) => {
|
|
271
|
+
const C = Math.pow(0.95, -l * this.dollySpeed), T = this._sphericalEnd.radius, E = this._sphericalEnd.radius * C, x = z(
|
|
272
272
|
E,
|
|
273
273
|
this.minDistance,
|
|
274
274
|
this.maxDistance
|
|
275
|
-
),
|
|
276
|
-
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(
|
|
277
|
-
}, this._zoomInternal = (l, _,
|
|
278
|
-
const
|
|
279
|
-
this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E -
|
|
280
|
-
}, typeof
|
|
275
|
+
), R = x - E;
|
|
276
|
+
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(R, !0), this._dollyToNoClamp(x, !0)) : this._dollyToNoClamp(x, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? E : x) - T, this._dollyControlCoord.set(_, O)), this._lastDollyDirection = Math.sign(-l);
|
|
277
|
+
}, this._zoomInternal = (l, _, O) => {
|
|
278
|
+
const C = Math.pow(0.95, l * this.dollySpeed), T = this._zoom, E = this._zoom * C;
|
|
279
|
+
this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E - T, this._dollyControlCoord.set(_, O));
|
|
280
|
+
}, typeof b == "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
|
-
), this._camera = e, this._yAxisUpSpace = new
|
|
282
|
+
), this._camera = e, this._yAxisUpSpace = new b.Quaternion().setFromUnitVectors(
|
|
283
283
|
this._camera.up,
|
|
284
284
|
pe
|
|
285
|
-
), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = d.NONE, this._target = new
|
|
285
|
+
), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = d.NONE, this._target = new b.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new b.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new b.Spherical().setFromVector3(
|
|
286
286
|
w.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)
|
|
287
287
|
), this._sphericalEnd = this._spherical.clone(), this._lastDistance = this._spherical.radius, this._zoom = this._camera.zoom, this._zoomEnd = this._zoom, this._lastZoom = this._zoom, this._nearPlaneCorners = [
|
|
288
|
-
new
|
|
289
|
-
new
|
|
290
|
-
new
|
|
291
|
-
new
|
|
292
|
-
], this._updateNearPlaneCorners(), this._boundary = new
|
|
293
|
-
new
|
|
294
|
-
new
|
|
295
|
-
), this._cameraUp0 = this._camera.up.clone(), this._target0 = this._target.clone(), this._position0 = this._camera.position.clone(), this._zoom0 = this._zoom, this._focalOffset0 = this._focalOffset.clone(), this._dollyControlCoord = new
|
|
288
|
+
new b.Vector3(),
|
|
289
|
+
new b.Vector3(),
|
|
290
|
+
new b.Vector3(),
|
|
291
|
+
new b.Vector3()
|
|
292
|
+
], this._updateNearPlaneCorners(), this._boundary = new b.Box3(
|
|
293
|
+
new b.Vector3(-1 / 0, -1 / 0, -1 / 0),
|
|
294
|
+
new b.Vector3(1 / 0, 1 / 0, 1 / 0)
|
|
295
|
+
), this._cameraUp0 = this._camera.up.clone(), this._target0 = this._target.clone(), this._position0 = this._camera.position.clone(), this._zoom0 = this._zoom, this._focalOffset0 = this._focalOffset.clone(), this._dollyControlCoord = new b.Vector2(), this.mouseButtons = {
|
|
296
296
|
left: d.ROTATE,
|
|
297
297
|
middle: d.DOLLY,
|
|
298
298
|
right: d.TRUCK,
|
|
@@ -302,21 +302,21 @@ class J extends ws {
|
|
|
302
302
|
two: Y(this._camera) ? d.TOUCH_DOLLY_TRUCK : H(this._camera) ? d.TOUCH_ZOOM_TRUCK : d.NONE,
|
|
303
303
|
three: d.TOUCH_TRUCK
|
|
304
304
|
};
|
|
305
|
-
const s = new
|
|
305
|
+
const s = new b.Vector2(), i = new b.Vector2(), r = new b.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
|
|
309
|
-
if (
|
|
308
|
+
const C = this._domElement.getBoundingClientRect(), T = (l.clientX - C.left) / (C.right - C.left), E = (l.clientY - C.top) / (C.bottom - C.top);
|
|
309
|
+
if (T < this._interactiveArea.left || T > this._interactiveArea.right || E < this._interactiveArea.top || E > this._interactiveArea.bottom)
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
312
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
313
|
if (_ !== null) {
|
|
314
|
-
const
|
|
315
|
-
|
|
314
|
+
const C = this._findPointerByMouseButton(_);
|
|
315
|
+
C && this._disposePointer(C);
|
|
316
316
|
}
|
|
317
317
|
if ((l.buttons & M.LEFT) === M.LEFT && this._lockedPointer)
|
|
318
318
|
return;
|
|
319
|
-
const
|
|
319
|
+
const O = {
|
|
320
320
|
pointerId: l.pointerId,
|
|
321
321
|
clientX: l.clientX,
|
|
322
322
|
clientY: l.clientY,
|
|
@@ -324,7 +324,7 @@ class J extends ws {
|
|
|
324
324
|
deltaY: 0,
|
|
325
325
|
mouseButton: _
|
|
326
326
|
};
|
|
327
|
-
this._activePointers.push(
|
|
327
|
+
this._activePointers.push(O), 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, v(l);
|
|
339
339
|
}, n = (l) => {
|
|
340
340
|
l.cancelable && l.preventDefault();
|
|
341
|
-
const _ = l.pointerId,
|
|
342
|
-
if (
|
|
343
|
-
if (
|
|
341
|
+
const _ = l.pointerId, O = this._lockedPointer || this._findPointerById(_);
|
|
342
|
+
if (O) {
|
|
343
|
+
if (O.clientX = l.clientX, O.clientY = l.clientY, O.deltaX = l.movementX, O.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;
|
|
@@ -383,15 +383,15 @@ class J extends ws {
|
|
|
383
383
|
const m = (l) => {
|
|
384
384
|
if (!this._domElement || !this._enabled || this.mouseButtons.wheel === d.NONE) return;
|
|
385
385
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
386
|
-
const E = this._domElement.getBoundingClientRect(), x = (l.clientX - E.left) / (E.right - E.left),
|
|
387
|
-
if (x < this._interactiveArea.left || x > this._interactiveArea.right ||
|
|
386
|
+
const E = this._domElement.getBoundingClientRect(), x = (l.clientX - E.left) / (E.right - E.left), R = (l.clientY - E.top) / (E.bottom - E.top);
|
|
387
|
+
if (x < this._interactiveArea.left || x > this._interactiveArea.right || R < this._interactiveArea.top || R > this._interactiveArea.bottom)
|
|
388
388
|
return;
|
|
389
389
|
}
|
|
390
390
|
if (l.preventDefault(), this.dollyToCursor || this.mouseButtons.wheel === d.ROTATE || this.mouseButtons.wheel === d.TRUCK) {
|
|
391
391
|
const E = performance.now();
|
|
392
392
|
h - E < 1e3 && this._getClientRect(this._elementRect), h = E;
|
|
393
393
|
}
|
|
394
|
-
const _ = xs ? -1 : -3,
|
|
394
|
+
const _ = xs ? -1 : -3, O = l.deltaMode === 1 || l.ctrlKey ? l.deltaY / _ : l.deltaY / (_ * 10), C = this.dollyToCursor ? (l.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, T = 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(-O, C, T), this._isUserControllingDolly = !0;
|
|
414
414
|
break;
|
|
415
415
|
}
|
|
416
416
|
case d.ZOOM: {
|
|
417
|
-
this._zoomInternal(-
|
|
417
|
+
this._zoomInternal(-O, C, T), 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 _ = l instanceof PointerEvent ? l.pointerId : 0,
|
|
426
|
-
|
|
425
|
+
const _ = l instanceof PointerEvent ? l.pointerId : 0, O = this._findPointerById(_);
|
|
426
|
+
O && this._disposePointer(O), this._domElement.ownerDocument.removeEventListener(
|
|
427
427
|
"pointermove",
|
|
428
428
|
n,
|
|
429
429
|
{ passive: !1 }
|
|
@@ -435,11 +435,11 @@ class J extends ws {
|
|
|
435
435
|
}
|
|
436
436
|
l.preventDefault();
|
|
437
437
|
}
|
|
438
|
-
},
|
|
438
|
+
}, v = (l) => {
|
|
439
439
|
if (!this._enabled) return;
|
|
440
|
-
if (Ee(this._activePointers,
|
|
441
|
-
const
|
|
442
|
-
r.set(0,
|
|
440
|
+
if (Ee(this._activePointers, U), this._getClientRect(this._elementRect), s.copy(U), i.copy(U), this._activePointers.length >= 2) {
|
|
441
|
+
const O = U.x - this._activePointers[1].clientX, C = U.y - this._activePointers[1].clientY, T = Math.sqrt(O * O + C * C);
|
|
442
|
+
r.set(0, T);
|
|
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);
|
|
445
445
|
}
|
|
@@ -462,29 +462,29 @@ class J extends ws {
|
|
|
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, Ee(this._activePointers,
|
|
466
|
-
const _ = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null,
|
|
467
|
-
if (i.copy(
|
|
468
|
-
const
|
|
465
|
+
this._dragNeedsUpdate = !1, Ee(this._activePointers, U);
|
|
466
|
+
const _ = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, O = _ ? -_.deltaX : i.x - U.x, C = _ ? -_.deltaY : i.y - U.y;
|
|
467
|
+
if (i.copy(U), ((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(O, C), this._isUserControllingRotate = !0), (this._state & d.DOLLY) === d.DOLLY || (this._state & d.ZOOM) === d.ZOOM) {
|
|
468
|
+
const T = 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 *
|
|
471
|
-
|
|
470
|
+
x * C * de,
|
|
471
|
+
T,
|
|
472
472
|
E
|
|
473
473
|
), this._isUserControllingDolly = !0) : (this._zoomInternal(
|
|
474
|
-
x *
|
|
475
|
-
|
|
474
|
+
x * C * de,
|
|
475
|
+
T,
|
|
476
476
|
E
|
|
477
477
|
), this._isUserControllingZoom = !0);
|
|
478
478
|
}
|
|
479
479
|
if ((this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_ZOOM) === d.TOUCH_ZOOM || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_ZOOM_TRUCK) === d.TOUCH_ZOOM_TRUCK || (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._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET || (this._state & d.TOUCH_ZOOM_OFFSET) === d.TOUCH_ZOOM_OFFSET || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) {
|
|
480
|
-
const
|
|
480
|
+
const T = U.x - this._activePointers[1].clientX, E = U.y - this._activePointers[1].clientY, x = Math.sqrt(T * T + E * E), R = r.y - x;
|
|
481
481
|
r.set(0, x);
|
|
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
|
-
(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(
|
|
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(R * de, V, le), this._isUserControllingDolly = !0) : (this._zoomInternal(R * 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(O, C, !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(O, C, !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(O, C, !0, !1), this._isUserControllingOffset = !0), this.dispatchEvent({ type: "control" });
|
|
486
486
|
}, u = () => {
|
|
487
|
-
Ee(this._activePointers,
|
|
487
|
+
Ee(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(
|
|
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
|
+
y
|
|
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), v());
|
|
522
522
|
}, this.unlockPointer = () => {
|
|
523
|
-
var l, _,
|
|
523
|
+
var l, _, O;
|
|
524
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
|
+
), (O = this._domElement) === null || O === void 0 || O.ownerDocument.removeEventListener(
|
|
528
528
|
"pointerlockerror",
|
|
529
|
-
|
|
529
|
+
y
|
|
530
530
|
), this.cancel();
|
|
531
531
|
};
|
|
532
532
|
const g = () => {
|
|
533
533
|
this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement || this.unlockPointer();
|
|
534
|
-
},
|
|
534
|
+
}, y = () => {
|
|
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
|
+
y
|
|
557
557
|
));
|
|
558
558
|
}, this.cancel = () => {
|
|
559
559
|
this._state !== d.NONE && (this._state = d.NONE, this._activePointers.length = 0, u());
|
|
@@ -985,28 +985,28 @@ 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 =
|
|
988
|
+
const m = He(this._sphericalEnd.theta, Ie), p = He(this._sphericalEnd.phi, Ie);
|
|
989
989
|
a.push(this.rotateTo(m, p, t));
|
|
990
|
-
const
|
|
990
|
+
const v = w.setFromSpherical(this._sphericalEnd).normalize(), f = Ke.setFromUnitVectors(v, Te), u = P(Math.abs(v.y), 1);
|
|
991
991
|
u && f.multiply(xe.setFromAxisAngle(pe, m)), f.multiply(this._yAxisUpSpaceInverse);
|
|
992
|
-
const g =
|
|
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(
|
|
994
|
-
const
|
|
992
|
+
const g = We.makeEmpty();
|
|
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, v), u && f.premultiply(xe.invert()), f.premultiply(this._yAxisUpSpace);
|
|
994
|
+
const y = g.getSize(w), l = g.getCenter(L).applyQuaternion(f);
|
|
995
995
|
if (Y(this._camera)) {
|
|
996
996
|
const _ = this.getDistanceToFitBox(
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
997
|
+
y.x,
|
|
998
|
+
y.y,
|
|
999
|
+
y.z,
|
|
1000
1000
|
s
|
|
1001
1001
|
);
|
|
1002
1002
|
a.push(
|
|
1003
1003
|
this.moveTo(l.x, l.y, l.z, t)
|
|
1004
1004
|
), a.push(this.dollyTo(_, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
1005
1005
|
} else if (H(this._camera)) {
|
|
1006
|
-
const _ = this._camera,
|
|
1006
|
+
const _ = this._camera, O = _.right - _.left, C = _.top - _.bottom, T = s ? Math.max(O / y.x, C / y.y) : Math.min(O / y.x, C / y.y);
|
|
1007
1007
|
a.push(
|
|
1008
1008
|
this.moveTo(l.x, l.y, l.z, t)
|
|
1009
|
-
), a.push(this.zoomTo(
|
|
1009
|
+
), a.push(this.zoomTo(T, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
1010
1010
|
}
|
|
1011
1011
|
return Promise.all(a);
|
|
1012
1012
|
}
|
|
@@ -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, v, 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), y = L.set(e, t, s);
|
|
1090
1090
|
k.setFromVector3(
|
|
1091
|
-
|
|
1091
|
+
y.sub(g).applyQuaternion(this._yAxisUpSpace)
|
|
1092
1092
|
);
|
|
1093
|
-
const l = G.set(m, p,
|
|
1093
|
+
const l = G.set(m, p, v), _ = L.set(n, a, h);
|
|
1094
1094
|
ae.setFromVector3(
|
|
1095
1095
|
_.sub(l).applyQuaternion(this._yAxisUpSpace)
|
|
1096
1096
|
), this._targetEnd.copy(g.lerp(l, f));
|
|
1097
|
-
const
|
|
1097
|
+
const O = ae.theta - k.theta, C = ae.phi - k.phi, T = ae.radius - k.radius;
|
|
1098
1098
|
this._sphericalEnd.set(
|
|
1099
|
-
k.radius +
|
|
1100
|
-
k.phi +
|
|
1101
|
-
k.theta +
|
|
1099
|
+
k.radius + T * f,
|
|
1100
|
+
k.phi + C * f,
|
|
1101
|
+
k.theta + O * 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,
|
|
@@ -1224,7 +1224,7 @@ class J extends ws {
|
|
|
1224
1224
|
this._viewport = null;
|
|
1225
1225
|
return;
|
|
1226
1226
|
}
|
|
1227
|
-
this._viewport = this._viewport || new
|
|
1227
|
+
this._viewport = this._viewport || new b.Vector4(), typeof e == "number" ? this._viewport.set(e, t, s, i) : this._viewport.copy(e);
|
|
1228
1228
|
}
|
|
1229
1229
|
/**
|
|
1230
1230
|
* Calculate the distance to fit the box.
|
|
@@ -1235,7 +1235,7 @@ class J extends ws {
|
|
|
1235
1235
|
* @category Methods
|
|
1236
1236
|
*/
|
|
1237
1237
|
getDistanceToFitBox(e, t, s, i = !1) {
|
|
1238
|
-
if (
|
|
1238
|
+
if (be(this._camera, "getDistanceToFitBox"))
|
|
1239
1239
|
return this._spherical.radius;
|
|
1240
1240
|
const r = e / t, o = this._camera.getEffectiveFOV() * ie, n = this._camera.aspect;
|
|
1241
1241
|
return ((i ? r > n : r < n) ? t : e / n) * 0.5 / Math.tan(o * 0.5) + s * 0.5;
|
|
@@ -1247,7 +1247,7 @@ class J extends ws {
|
|
|
1247
1247
|
* @category Methods
|
|
1248
1248
|
*/
|
|
1249
1249
|
getDistanceToFitSphere(e) {
|
|
1250
|
-
if (
|
|
1250
|
+
if (be(this._camera, "getDistanceToFitSphere"))
|
|
1251
1251
|
return this._spherical.radius;
|
|
1252
1252
|
const t = this._camera.getEffectiveFOV() * ie, s = Math.atan(Math.tan(t * 0.5) * this._camera.aspect) * 2, i = 1 < this._camera.aspect ? t : s;
|
|
1253
1253
|
return e / Math.sin(i * 0.5);
|
|
@@ -1259,7 +1259,7 @@ class J extends ws {
|
|
|
1259
1259
|
* @category Methods
|
|
1260
1260
|
*/
|
|
1261
1261
|
getTarget(e, t = !0) {
|
|
1262
|
-
return (e && e.isVector3 ? e : new
|
|
1262
|
+
return (e && e.isVector3 ? e : new b.Vector3()).copy(t ? this._targetEnd : this._target);
|
|
1263
1263
|
}
|
|
1264
1264
|
/**
|
|
1265
1265
|
* Returns the camera position.
|
|
@@ -1268,7 +1268,7 @@ class J extends ws {
|
|
|
1268
1268
|
* @category Methods
|
|
1269
1269
|
*/
|
|
1270
1270
|
getPosition(e, t = !0) {
|
|
1271
|
-
return (e && e.isVector3 ? e : new
|
|
1271
|
+
return (e && e.isVector3 ? e : new b.Vector3()).setFromSpherical(t ? this._sphericalEnd : this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t ? this._targetEnd : this._target);
|
|
1272
1272
|
}
|
|
1273
1273
|
/**
|
|
1274
1274
|
* Returns the spherical coordinates of the orbit.
|
|
@@ -1277,7 +1277,7 @@ class J extends ws {
|
|
|
1277
1277
|
* @category Methods
|
|
1278
1278
|
*/
|
|
1279
1279
|
getSpherical(e, t = !0) {
|
|
1280
|
-
return (e || new
|
|
1280
|
+
return (e || new b.Spherical()).copy(t ? this._sphericalEnd : this._spherical);
|
|
1281
1281
|
}
|
|
1282
1282
|
/**
|
|
1283
1283
|
* Returns the focal offset, which is how much the camera appears to be translated in screen parallel coordinates.
|
|
@@ -1286,7 +1286,7 @@ class J extends ws {
|
|
|
1286
1286
|
* @category Methods
|
|
1287
1287
|
*/
|
|
1288
1288
|
getFocalOffset(e, t = !0) {
|
|
1289
|
-
return (e && e.isVector3 ? e : new
|
|
1289
|
+
return (e && e.isVector3 ? e : new b.Vector3()).copy(
|
|
1290
1290
|
t ? this._focalOffsetEnd : this._focalOffset
|
|
1291
1291
|
);
|
|
1292
1292
|
}
|
|
@@ -1368,7 +1368,7 @@ class J extends ws {
|
|
|
1368
1368
|
* @category Methods
|
|
1369
1369
|
*/
|
|
1370
1370
|
update(e) {
|
|
1371
|
-
const t = this._sphericalEnd.theta - this._spherical.theta, s = this._sphericalEnd.phi - this._spherical.phi, i = this._sphericalEnd.radius - this._spherical.radius, r =
|
|
1371
|
+
const t = this._sphericalEnd.theta - this._spherical.theta, s = this._sphericalEnd.phi - this._spherical.phi, i = this._sphericalEnd.radius - this._spherical.radius, r = Ye.subVectors(this._targetEnd, this._target), o = Ze.subVectors(
|
|
1372
1372
|
this._focalOffsetEnd,
|
|
1373
1373
|
this._focalOffset
|
|
1374
1374
|
), n = this._zoomEnd - this._zoom;
|
|
@@ -1415,7 +1415,7 @@ class J extends ws {
|
|
|
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;
|
|
1418
|
-
|
|
1418
|
+
Be(
|
|
1419
1419
|
this._target,
|
|
1420
1420
|
this._targetEnd,
|
|
1421
1421
|
this._targetVelocity,
|
|
@@ -1429,7 +1429,7 @@ class J extends ws {
|
|
|
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;
|
|
1432
|
-
|
|
1432
|
+
Be(
|
|
1433
1433
|
this._focalOffset,
|
|
1434
1434
|
this._focalOffsetEnd,
|
|
1435
1435
|
this._focalOffsetVelocity,
|
|
@@ -1454,34 +1454,34 @@ 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, v = this._camera, f = this._getCameraDirection(ne), u = w.copy(f).cross(v.up).normalize();
|
|
1458
1458
|
u.lengthSq() === 0 && (u.x = 1);
|
|
1459
|
-
const g = L.crossVectors(u, f),
|
|
1459
|
+
const g = L.crossVectors(u, f), y = this._sphericalEnd.radius * Math.tan(v.getEffectiveFOV() * ie * 0.5), _ = (this._sphericalEnd.radius - p - this._sphericalEnd.radius) / this._sphericalEnd.radius, O = G.copy(this._targetEnd).add(
|
|
1460
1460
|
u.multiplyScalar(
|
|
1461
|
-
this._dollyControlCoord.x *
|
|
1461
|
+
this._dollyControlCoord.x * y * v.aspect
|
|
1462
1462
|
)
|
|
1463
1463
|
).add(
|
|
1464
|
-
g.multiplyScalar(this._dollyControlCoord.y *
|
|
1465
|
-
),
|
|
1466
|
-
if (this.infinityDolly && (
|
|
1464
|
+
g.multiplyScalar(this._dollyControlCoord.y * y)
|
|
1465
|
+
), C = w.copy(this._targetEnd).lerp(O, _), T = this._lastDollyDirection === K.IN && this._spherical.radius <= this.minDistance, E = this._lastDollyDirection === K.OUT && this.maxDistance <= this._spherical.radius;
|
|
1466
|
+
if (this.infinityDolly && (T || E)) {
|
|
1467
1467
|
this._sphericalEnd.radius -= p, this._spherical.radius -= p;
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1468
|
+
const R = L.copy(f).multiplyScalar(-p);
|
|
1469
|
+
C.add(R);
|
|
1470
1470
|
}
|
|
1471
|
-
this._boundary.clampPoint(
|
|
1472
|
-
const x = L.subVectors(
|
|
1473
|
-
this._targetEnd.copy(
|
|
1471
|
+
this._boundary.clampPoint(C, C);
|
|
1472
|
+
const x = L.subVectors(C, this._targetEnd);
|
|
1473
|
+
this._targetEnd.copy(C), 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, v = this._camera, f = w.set(
|
|
1476
1476
|
this._dollyControlCoord.x,
|
|
1477
1477
|
this._dollyControlCoord.y,
|
|
1478
|
-
(
|
|
1479
|
-
).unproject(
|
|
1480
|
-
|
|
1478
|
+
(v.near + v.far) / (v.near - v.far)
|
|
1479
|
+
).unproject(v), u = L.set(0, 0, -1).applyQuaternion(v.quaternion), g = G.copy(f).add(u.multiplyScalar(-f.dot(v.up))), l = -(this._zoom - p - this._zoom) / this._zoom, _ = this._getCameraDirection(ne), O = this._targetEnd.dot(_), C = w.copy(this._targetEnd).lerp(g, l), T = C.dot(_), E = _.multiplyScalar(
|
|
1480
|
+
T - O
|
|
1481
1481
|
);
|
|
1482
|
-
|
|
1483
|
-
const x = L.subVectors(
|
|
1484
|
-
this._targetEnd.copy(
|
|
1482
|
+
C.sub(E), this._boundary.clampPoint(C, C);
|
|
1483
|
+
const x = L.subVectors(C, this._targetEnd);
|
|
1484
|
+
this._targetEnd.copy(C), 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;
|
|
@@ -1614,10 +1614,10 @@ class J extends ws {
|
|
|
1614
1614
|
// lateUpdate
|
|
1615
1615
|
_collisionTest() {
|
|
1616
1616
|
let e = 1 / 0;
|
|
1617
|
-
if (!(this.colliderMeshes.length >= 1) ||
|
|
1617
|
+
if (!(this.colliderMeshes.length >= 1) || be(this._camera, "_collisionTest"))
|
|
1618
1618
|
return e;
|
|
1619
1619
|
const s = this._getTargetDirection(ne);
|
|
1620
|
-
Le.lookAt(
|
|
1620
|
+
Le.lookAt(Ve, s, this._camera.up);
|
|
1621
1621
|
for (let i = 0; i < 4; i++) {
|
|
1622
1622
|
const r = L.copy(this._nearPlaneCorners[i]);
|
|
1623
1623
|
r.applyMatrix4(Le);
|
|
@@ -1689,7 +1689,7 @@ class J extends ws {
|
|
|
1689
1689
|
".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."
|
|
1690
1690
|
);
|
|
1691
1691
|
}
|
|
1692
|
-
static createBoundingSphere(e, t = new
|
|
1692
|
+
static createBoundingSphere(e, t = new b.Sphere()) {
|
|
1693
1693
|
const s = t, i = s.center;
|
|
1694
1694
|
X.makeEmpty(), e.traverseVisible((o) => {
|
|
1695
1695
|
o.isMesh && X.expandByObject(o);
|
|
@@ -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, v = m.count; p < v; 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 Re = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null, $e = 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) {
|
|
@@ -1724,13 +1724,13 @@ var ut = Number.isNaN || function(e) {
|
|
|
1724
1724
|
function S() {
|
|
1725
1725
|
S.init.call(this);
|
|
1726
1726
|
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1727
|
+
Re.exports = S;
|
|
1728
|
+
Re.exports.once = Ms;
|
|
1729
1729
|
S.EventEmitter = S;
|
|
1730
1730
|
S.prototype._events = void 0;
|
|
1731
1731
|
S.prototype._eventsCount = 0;
|
|
1732
1732
|
S.prototype._maxListeners = void 0;
|
|
1733
|
-
var
|
|
1733
|
+
var Ge = 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);
|
|
@@ -1738,12 +1738,12 @@ function ge(c) {
|
|
|
1738
1738
|
Object.defineProperty(S, "defaultMaxListeners", {
|
|
1739
1739
|
enumerable: !0,
|
|
1740
1740
|
get: function() {
|
|
1741
|
-
return
|
|
1741
|
+
return Ge;
|
|
1742
1742
|
},
|
|
1743
1743
|
set: function(c) {
|
|
1744
1744
|
if (typeof c != "number" || c < 0 || ut(c))
|
|
1745
1745
|
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + c + ".");
|
|
1746
|
-
|
|
1746
|
+
Ge = c;
|
|
1747
1747
|
}
|
|
1748
1748
|
});
|
|
1749
1749
|
S.init = function() {
|
|
@@ -1778,10 +1778,10 @@ S.prototype.emit = function(e) {
|
|
|
1778
1778
|
if (a === void 0)
|
|
1779
1779
|
return !1;
|
|
1780
1780
|
if (typeof a == "function")
|
|
1781
|
-
|
|
1781
|
+
$e(a, this, t);
|
|
1782
1782
|
else
|
|
1783
|
-
for (var h = a.length, m =
|
|
1784
|
-
|
|
1783
|
+
for (var h = a.length, m = Ct(a, h), s = 0; s < h; ++s)
|
|
1784
|
+
$e(m[s], this, t);
|
|
1785
1785
|
return !0;
|
|
1786
1786
|
};
|
|
1787
1787
|
function _t(c, e, t, s) {
|
|
@@ -1860,24 +1860,24 @@ S.prototype.removeAllListeners = function(e) {
|
|
|
1860
1860
|
this.removeListener(e, t[i]);
|
|
1861
1861
|
return this;
|
|
1862
1862
|
};
|
|
1863
|
-
function
|
|
1863
|
+
function yt(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 ? As(i) :
|
|
1868
|
+
return i === void 0 ? [] : typeof i == "function" ? t ? [i.listener || i] : [i] : t ? As(i) : Ct(i, i.length);
|
|
1869
1869
|
}
|
|
1870
1870
|
S.prototype.listeners = function(e) {
|
|
1871
|
-
return
|
|
1871
|
+
return yt(this, e, !0);
|
|
1872
1872
|
};
|
|
1873
1873
|
S.prototype.rawListeners = function(e) {
|
|
1874
|
-
return
|
|
1874
|
+
return yt(this, e, !1);
|
|
1875
1875
|
};
|
|
1876
1876
|
S.listenerCount = function(c, e) {
|
|
1877
|
-
return typeof c.listenerCount == "function" ? c.listenerCount(e) :
|
|
1877
|
+
return typeof c.listenerCount == "function" ? c.listenerCount(e) : vt.call(c, e);
|
|
1878
1878
|
};
|
|
1879
|
-
S.prototype.listenerCount =
|
|
1880
|
-
function
|
|
1879
|
+
S.prototype.listenerCount = vt;
|
|
1880
|
+
function vt(c) {
|
|
1881
1881
|
var e = this._events;
|
|
1882
1882
|
if (e !== void 0) {
|
|
1883
1883
|
var t = e[c];
|
|
@@ -1891,7 +1891,7 @@ function yt(c) {
|
|
|
1891
1891
|
S.prototype.eventNames = function() {
|
|
1892
1892
|
return this._eventsCount > 0 ? ue(this._events) : [];
|
|
1893
1893
|
};
|
|
1894
|
-
function
|
|
1894
|
+
function Ct(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;
|
|
@@ -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
|
+
Ot(c, e, r, { once: !0 }), e !== "error" && Rs(c, i, { once: !0 });
|
|
1918
1918
|
});
|
|
1919
1919
|
}
|
|
1920
|
-
function
|
|
1921
|
-
typeof c.on == "function" &&
|
|
1920
|
+
function Rs(c, e, t) {
|
|
1921
|
+
typeof c.on == "function" && Ot(c, "error", e, t);
|
|
1922
1922
|
}
|
|
1923
|
-
function
|
|
1923
|
+
function Ot(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 Ct(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 ye = Re.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 ye.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();
|
|
@@ -1997,20 +1997,20 @@ class ee {
|
|
|
1997
1997
|
}), this.removePage(0), this.controllerMap.clear(), this.event.removeAllListeners(), this.activeControllerSet.clear();
|
|
1998
1998
|
}
|
|
1999
1999
|
}
|
|
2000
|
-
const
|
|
2000
|
+
const bt = {
|
|
2001
2001
|
fov: 45,
|
|
2002
2002
|
near: 1,
|
|
2003
2003
|
far: 1e3,
|
|
2004
2004
|
up: new I(0, 1, 0)
|
|
2005
2005
|
};
|
|
2006
|
-
class
|
|
2006
|
+
class Ds extends ee {
|
|
2007
2007
|
constructor(e) {
|
|
2008
2008
|
super(), this.width = 0, this.height = 0, this.width = e.width, this.height = e.height;
|
|
2009
2009
|
}
|
|
2010
2010
|
get camera() {
|
|
2011
2011
|
return this.controller;
|
|
2012
2012
|
}
|
|
2013
|
-
addPerspectiveCamera(e =
|
|
2013
|
+
addPerspectiveCamera(e = bt, t) {
|
|
2014
2014
|
const { fov: s, far: i, near: r, up: o, aspect: n } = e, a = n != null ? n : this.width / this.height, h = new kt(s, a, r, i);
|
|
2015
2015
|
return h.up = o, this.addController(h, t);
|
|
2016
2016
|
}
|
|
@@ -2222,7 +2222,7 @@ class zs extends ms {
|
|
|
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
2228
|
const Fs = new Nt({ color: "black" }), js = new ot({
|
|
@@ -2241,7 +2241,7 @@ const Fs = new Nt({ color: "black" }), js = new ot({
|
|
|
2241
2241
|
color: "black",
|
|
2242
2242
|
sizeAttenuation: !1,
|
|
2243
2243
|
lineWidth: 0
|
|
2244
|
-
}),
|
|
2244
|
+
}), Xe = new It(0), Vs = {
|
|
2245
2245
|
kernelRadius: 8,
|
|
2246
2246
|
minDistance: 5e-3,
|
|
2247
2247
|
maxDistance: 0.1
|
|
@@ -2271,8 +2271,8 @@ class Ws {
|
|
|
2271
2271
|
samples: Math.min(n, a),
|
|
2272
2272
|
type: Vt
|
|
2273
2273
|
}
|
|
2274
|
-
), p = new
|
|
2275
|
-
p.setSize(
|
|
2274
|
+
), p = new Fe(o, m), v = this.getSize();
|
|
2275
|
+
p.setSize(v.width, v.height);
|
|
2276
2276
|
const f = new hs(
|
|
2277
2277
|
s.scene,
|
|
2278
2278
|
i.camera
|
|
@@ -2308,7 +2308,7 @@ class Ws {
|
|
|
2308
2308
|
s
|
|
2309
2309
|
);
|
|
2310
2310
|
this.bloomPass = n;
|
|
2311
|
-
const a = new
|
|
2311
|
+
const a = new Fe(t);
|
|
2312
2312
|
a.renderToScreen = !1, a.addPass(this.renderPass), a.addPass(n), this.bloomComposer = a;
|
|
2313
2313
|
const h = Us(a);
|
|
2314
2314
|
h.uniforms.bloomAlphaType.value = o, this.bloomComposer = a, this.finalComposer.addPass(h), this.mixPass = h, this.bloomLayer.set(as);
|
|
@@ -2352,13 +2352,13 @@ class Ws {
|
|
|
2352
2352
|
this.bloomVisible[i.uuid] = i.visible, i.visible = !1;
|
|
2353
2353
|
});
|
|
2354
2354
|
const s = this.scene.background;
|
|
2355
|
-
this.scene.userData._backgroundOriginal = s, this.scene.background =
|
|
2355
|
+
this.scene.userData._backgroundOriginal = s, this.scene.background = Xe;
|
|
2356
2356
|
}
|
|
2357
2357
|
restoreNonBloomed() {
|
|
2358
2358
|
if (this.scene.traverse((e) => {
|
|
2359
2359
|
const t = e;
|
|
2360
2360
|
this.bloomMaterials[t.uuid] ? (t.material = this.bloomMaterials[t.uuid], delete this.bloomMaterials[t.uuid]) : this.bloomVisible[t.uuid] !== void 0 && (t.visible = this.bloomVisible[t.uuid], delete this.bloomVisible[t.uuid]);
|
|
2361
|
-
}), this.scene.background ===
|
|
2361
|
+
}), this.scene.background === Xe) {
|
|
2362
2362
|
const e = this.scene.userData._backgroundOriginal;
|
|
2363
2363
|
e && (this.scene.background = e, delete this.scene.userData._backgroundOriginal);
|
|
2364
2364
|
}
|
|
@@ -2375,7 +2375,7 @@ class Ws {
|
|
|
2375
2375
|
if (this.finalComposerRender(), this.pipViewportState) {
|
|
2376
2376
|
e.setPageActive(31), e.setAspect(
|
|
2377
2377
|
this.pipViewportState.width / this.pipViewportState.height
|
|
2378
|
-
), t.setViewport(te(
|
|
2378
|
+
), t.setViewport(te(D({}, this.pipViewportState), {
|
|
2379
2379
|
scissor: !0,
|
|
2380
2380
|
scissorTest: !0
|
|
2381
2381
|
})), this.finalComposerRender(), e.setPageActive(s.activeIndex);
|
|
@@ -2442,7 +2442,7 @@ class Ks extends ee {
|
|
|
2442
2442
|
super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e * Yt.DEG2RAD);
|
|
2443
2443
|
}
|
|
2444
2444
|
}
|
|
2445
|
-
const q = new I(),
|
|
2445
|
+
const q = new I(), qe = new W(), Qe = new W(), Je = new I(), et = new I();
|
|
2446
2446
|
class $s {
|
|
2447
2447
|
/**
|
|
2448
2448
|
* Constructs a new CSS2D renderer.
|
|
@@ -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(),
|
|
2464
|
+
u.matrixWorldAutoUpdate === !0 && u.updateMatrixWorld(), g.parent === null && g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(), qe.copy(g.matrixWorldInverse), Qe.multiplyMatrices(g.projectionMatrix, qe), 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, y = u.children.length; g < y; g++)
|
|
2471
2471
|
h(u.children[g]);
|
|
2472
2472
|
}
|
|
2473
|
-
function m(u, g,
|
|
2473
|
+
function m(u, g, y) {
|
|
2474
2474
|
if (u.visible === !1) {
|
|
2475
2475
|
h(u);
|
|
2476
2476
|
return;
|
|
2477
2477
|
}
|
|
2478
2478
|
if (u.isCSS2DObject) {
|
|
2479
|
-
q.setFromMatrixPosition(u.matrixWorld), q.applyMatrix4(
|
|
2480
|
-
const l = q.z >= -1 && q.z <= 1 && u.layers.test(
|
|
2481
|
-
_.style.display = l === !0 ? "" : "none", l === !0 && (u.onBeforeRender(t, g,
|
|
2482
|
-
const
|
|
2483
|
-
distanceToCameraSquared: p(
|
|
2479
|
+
q.setFromMatrixPosition(u.matrixWorld), q.applyMatrix4(Qe);
|
|
2480
|
+
const l = q.z >= -1 && q.z <= 1 && u.layers.test(y.layers) === !0, _ = u.element;
|
|
2481
|
+
_.style.display = l === !0 ? "" : "none", l === !0 && (u.onBeforeRender(t, g, y), _.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, y));
|
|
2482
|
+
const O = {
|
|
2483
|
+
distanceToCameraSquared: p(y, u)
|
|
2484
2484
|
};
|
|
2485
|
-
n.objects.set(u,
|
|
2485
|
+
n.objects.set(u, O);
|
|
2486
2486
|
}
|
|
2487
2487
|
for (let l = 0, _ = u.children.length; l < _; l++)
|
|
2488
|
-
m(u.children[l], g,
|
|
2488
|
+
m(u.children[l], g, y);
|
|
2489
2489
|
}
|
|
2490
2490
|
function p(u, g) {
|
|
2491
|
-
return
|
|
2491
|
+
return Je.setFromMatrixPosition(u.matrixWorld), et.setFromMatrixPosition(g.matrixWorld), Je.distanceToSquared(et);
|
|
2492
2492
|
}
|
|
2493
|
-
function
|
|
2493
|
+
function v(u) {
|
|
2494
2494
|
const g = [];
|
|
2495
|
-
return u.traverseVisible(function(
|
|
2496
|
-
|
|
2495
|
+
return u.traverseVisible(function(y) {
|
|
2496
|
+
y.isCSS2DObject && g.push(y);
|
|
2497
2497
|
}), g;
|
|
2498
2498
|
}
|
|
2499
2499
|
function f(u) {
|
|
2500
|
-
const g =
|
|
2500
|
+
const g = v(u).sort(function(l, _) {
|
|
2501
2501
|
if (l.renderOrder !== _.renderOrder)
|
|
2502
2502
|
return _.renderOrder - l.renderOrder;
|
|
2503
|
-
const
|
|
2504
|
-
return
|
|
2505
|
-
}),
|
|
2503
|
+
const O = n.objects.get(l).distanceToCameraSquared, C = n.objects.get(_).distanceToCameraSquared;
|
|
2504
|
+
return O - C;
|
|
2505
|
+
}), y = g.length;
|
|
2506
2506
|
for (let l = 0, _ = g.length; l < _; l++)
|
|
2507
|
-
g[l].element.style.zIndex =
|
|
2507
|
+
g[l].element.style.zIndex = y - l;
|
|
2508
2508
|
}
|
|
2509
2509
|
}
|
|
2510
2510
|
}
|
|
2511
|
-
const
|
|
2511
|
+
const tt = new I(), Gs = new at(), st = new I(), N = new W(), Xs = new W();
|
|
2512
2512
|
class qs {
|
|
2513
2513
|
/**
|
|
2514
2514
|
* Constructs a new CSS3D renderer.
|
|
@@ -2531,67 +2531,247 @@ class qs {
|
|
|
2531
2531
|
width: s,
|
|
2532
2532
|
height: i
|
|
2533
2533
|
};
|
|
2534
|
-
}, this.render = function(
|
|
2534
|
+
}, this.render = function(y, l) {
|
|
2535
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 = "",
|
|
2537
|
-
let
|
|
2538
|
-
l.isOrthographicCamera && (
|
|
2539
|
-
const
|
|
2540
|
-
n.camera.style !==
|
|
2541
|
-
}, this.setSize = function(
|
|
2542
|
-
s =
|
|
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 = "", y.matrixWorldAutoUpdate === !0 && y.updateMatrixWorld(), l.parent === null && l.matrixWorldAutoUpdate === !0 && l.updateMatrixWorld();
|
|
2537
|
+
let O, C;
|
|
2538
|
+
l.isOrthographicCamera && (O = -(l.right + l.left) / 2, C = (l.top + l.bottom) / 2);
|
|
2539
|
+
const T = l.view && l.view.enabled ? l.view.height / l.view.fullHeight : 1, E = l.isOrthographicCamera ? `scale( ${T} )scale(` + _ + ")translate(" + p(O) + "px," + p(C) + "px)" + v(l.matrixWorldInverse) : `scale( ${T} )translateZ(` + _ + "px)" + v(l.matrixWorldInverse), R = (l.isPerspectiveCamera ? "perspective(" + _ + "px) " : "") + E + "translate(" + r + "px," + o + "px)";
|
|
2540
|
+
n.camera.style !== R && (m.style.transform = R, n.camera.style = R), g(y, y, l);
|
|
2541
|
+
}, this.setSize = function(y, l) {
|
|
2542
|
+
s = y, i = l, r = s / 2, o = i / 2, a.style.width = y + "px", a.style.height = l + "px", h.style.width = y + "px", h.style.height = l + "px", m.style.width = y + "px", m.style.height = l + "px";
|
|
2543
2543
|
};
|
|
2544
|
-
function p(
|
|
2545
|
-
return Math.abs(
|
|
2544
|
+
function p(y) {
|
|
2545
|
+
return Math.abs(y) < 1e-10 ? 0 : y;
|
|
2546
2546
|
}
|
|
2547
|
-
function y
|
|
2548
|
-
const l =
|
|
2547
|
+
function v(y) {
|
|
2548
|
+
const l = y.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 f(
|
|
2552
|
-
const l =
|
|
2551
|
+
function f(y) {
|
|
2552
|
+
const l = y.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(y) {
|
|
2556
|
+
y.isCSS3DObject && (y.element.style.display = "none");
|
|
2557
|
+
for (let l = 0, _ = y.children.length; l < _; l++)
|
|
2558
|
+
u(y.children[l]);
|
|
2559
2559
|
}
|
|
2560
|
-
function g(
|
|
2561
|
-
if (
|
|
2562
|
-
u(
|
|
2560
|
+
function g(y, l, _, O) {
|
|
2561
|
+
if (y.visible === !1) {
|
|
2562
|
+
u(y);
|
|
2563
2563
|
return;
|
|
2564
2564
|
}
|
|
2565
|
-
if (
|
|
2566
|
-
const
|
|
2567
|
-
if (
|
|
2568
|
-
|
|
2565
|
+
if (y.isCSS3DObject) {
|
|
2566
|
+
const C = y.layers.test(_.layers) === !0, T = y.element;
|
|
2567
|
+
if (T.style.display = C === !0 ? "" : "none", C === !0) {
|
|
2568
|
+
y.onBeforeRender(t, l, _);
|
|
2569
2569
|
let E;
|
|
2570
|
-
|
|
2571
|
-
const x = n.objects.get(
|
|
2570
|
+
y.isCSS3DSprite ? (N.copy(_.matrixWorldInverse), N.transpose(), y.rotation2D !== 0 && N.multiply(Xs.makeRotationZ(y.rotation2D)), y.matrixWorld.decompose(tt, Gs, st), N.setPosition(tt), N.scale(st), N.elements[3] = 0, N.elements[7] = 0, N.elements[11] = 0, N.elements[15] = 1, E = f(N)) : E = f(y.matrixWorld);
|
|
2571
|
+
const x = n.objects.get(y);
|
|
2572
2572
|
if (x === void 0 || x.style !== E) {
|
|
2573
|
-
|
|
2574
|
-
const
|
|
2575
|
-
n.objects.set(
|
|
2573
|
+
T.style.transform = E;
|
|
2574
|
+
const R = { style: E };
|
|
2575
|
+
n.objects.set(y, R);
|
|
2576
2576
|
}
|
|
2577
|
-
|
|
2577
|
+
T.parentNode !== m && m.appendChild(T), y.onAfterRender(t, l, _);
|
|
2578
2578
|
}
|
|
2579
2579
|
}
|
|
2580
|
-
for (let
|
|
2581
|
-
g(
|
|
2580
|
+
for (let C = 0, T = y.children.length; C < T; C++)
|
|
2581
|
+
g(y.children[C], l, _);
|
|
2582
2582
|
}
|
|
2583
2583
|
}
|
|
2584
2584
|
}
|
|
2585
|
-
|
|
2585
|
+
class Qs {
|
|
2586
|
+
constructor(e = {}) {
|
|
2587
|
+
this.labels = /* @__PURE__ */ new Map(), this.lastUpdateTime = 0, this.isUpdating = !1, this.options = D({
|
|
2588
|
+
padding: 2,
|
|
2589
|
+
enabled: !1,
|
|
2590
|
+
throttleTime: 16,
|
|
2591
|
+
// ~60fps
|
|
2592
|
+
viewportMargin: 50
|
|
2593
|
+
}, e);
|
|
2594
|
+
}
|
|
2595
|
+
/**
|
|
2596
|
+
* 添加标签到碰撞检测系统
|
|
2597
|
+
* @param node Node 实例
|
|
2598
|
+
*/
|
|
2599
|
+
add(e, t = {}) {
|
|
2600
|
+
var s;
|
|
2601
|
+
this.options.enabled || console.warn("collision.enabled is false, please enable it before adding nodes."), this.labels.set(e, {
|
|
2602
|
+
node: e,
|
|
2603
|
+
priority: (s = t.priority) != null ? s : 0,
|
|
2604
|
+
visible: !0
|
|
2605
|
+
});
|
|
2606
|
+
}
|
|
2607
|
+
/**
|
|
2608
|
+
* 移除标签
|
|
2609
|
+
*/
|
|
2610
|
+
remove(e) {
|
|
2611
|
+
this.labels.delete(e);
|
|
2612
|
+
}
|
|
2613
|
+
/**
|
|
2614
|
+
* 更新标签优先级
|
|
2615
|
+
*/
|
|
2616
|
+
setPriority(e, t) {
|
|
2617
|
+
const s = this.labels.get(e);
|
|
2618
|
+
s && (s.priority = t);
|
|
2619
|
+
}
|
|
2620
|
+
/**
|
|
2621
|
+
* 批量添加标签
|
|
2622
|
+
*/
|
|
2623
|
+
addBatch(e, t) {
|
|
2624
|
+
e.forEach((s, i) => {
|
|
2625
|
+
this.add(s, {
|
|
2626
|
+
priority: t ? t(s, i) : 0
|
|
2627
|
+
});
|
|
2628
|
+
});
|
|
2629
|
+
}
|
|
2630
|
+
/**
|
|
2631
|
+
* 启用/禁用碰撞检测
|
|
2632
|
+
*/
|
|
2633
|
+
setEnabled(e) {
|
|
2634
|
+
this.options.enabled = e, e || this.labels.forEach((t) => {
|
|
2635
|
+
this.setNodeVisibility(t.node, !0), t.visible = !0;
|
|
2636
|
+
});
|
|
2637
|
+
}
|
|
2638
|
+
/**
|
|
2639
|
+
* 更新碰撞检测(在渲染循环中调用)
|
|
2640
|
+
*/
|
|
2641
|
+
update(e) {
|
|
2642
|
+
if (!this.options.enabled) return;
|
|
2643
|
+
const t = performance.now();
|
|
2644
|
+
t - this.lastUpdateTime < this.options.throttleTime || (this.lastUpdateTime = t, this.camera = e, !this.isUpdating && (this.isUpdating = !0, this.animationFrameId = requestAnimationFrame(() => {
|
|
2645
|
+
this.performCollisionDetection(), this.isUpdating = !1;
|
|
2646
|
+
})));
|
|
2647
|
+
}
|
|
2648
|
+
/**
|
|
2649
|
+
* 强制立即更新
|
|
2650
|
+
*/
|
|
2651
|
+
forceUpdate() {
|
|
2652
|
+
this.camera && this.performCollisionDetection();
|
|
2653
|
+
}
|
|
2654
|
+
performCollisionDetection() {
|
|
2655
|
+
const { padding: e, viewportMargin: t } = this.options, s = window.innerWidth, i = window.innerHeight, r = [];
|
|
2656
|
+
this.labels.forEach((n) => {
|
|
2657
|
+
const a = n.node.element;
|
|
2658
|
+
if (!a) return;
|
|
2659
|
+
const h = a.firstElementChild;
|
|
2660
|
+
if (!h) return;
|
|
2661
|
+
const m = h.style.opacity === "0";
|
|
2662
|
+
m && (h.style.visibility = "hidden", h.style.opacity = "1");
|
|
2663
|
+
const p = h.getBoundingClientRect();
|
|
2664
|
+
if (m && (h.style.opacity = "0", h.style.visibility = ""), p.width === 0 || p.height === 0) return;
|
|
2665
|
+
p.right >= -t && p.left <= s + t && p.bottom >= -t && p.top <= i + t ? (n.bounds = p, r.push(n)) : (this.setNodeVisibility(n.node, !1), n.visible = !1);
|
|
2666
|
+
}), r.sort((n, a) => a.priority - n.priority);
|
|
2667
|
+
const o = [];
|
|
2668
|
+
for (const n of r) {
|
|
2669
|
+
if (!n.bounds) continue;
|
|
2670
|
+
this.checkCollision(
|
|
2671
|
+
n.bounds,
|
|
2672
|
+
o,
|
|
2673
|
+
e
|
|
2674
|
+
) ? (this.setNodeVisibility(n.node, !1), n.visible = !1) : (this.setNodeVisibility(n.node, !0), n.visible = !0, o.push(n.bounds));
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
/**
|
|
2678
|
+
* 检测矩形是否与已占用区域碰撞
|
|
2679
|
+
*/
|
|
2680
|
+
checkCollision(e, t, s) {
|
|
2681
|
+
for (const i of t)
|
|
2682
|
+
if (this.rectsIntersect(e, i, s))
|
|
2683
|
+
return !0;
|
|
2684
|
+
return !1;
|
|
2685
|
+
}
|
|
2686
|
+
/**
|
|
2687
|
+
* 检测两个矩形是否相交(包含 padding)
|
|
2688
|
+
*/
|
|
2689
|
+
rectsIntersect(e, t, s) {
|
|
2690
|
+
return !(e.right + s < t.left || e.left - s > t.right || e.bottom + s < t.top || e.top - s > t.bottom);
|
|
2691
|
+
}
|
|
2692
|
+
/**
|
|
2693
|
+
* 设置节点可见性(操作子元素)
|
|
2694
|
+
*/
|
|
2695
|
+
setNodeVisibility(e, t) {
|
|
2696
|
+
const s = e.element;
|
|
2697
|
+
if (!s) return;
|
|
2698
|
+
const i = s.firstElementChild;
|
|
2699
|
+
i && (t ? i.style.opacity = "1" : i.style.opacity = "0");
|
|
2700
|
+
}
|
|
2701
|
+
/**
|
|
2702
|
+
* 获取当前可见的标签数量
|
|
2703
|
+
*/
|
|
2704
|
+
getVisibleCount() {
|
|
2705
|
+
let e = 0;
|
|
2706
|
+
return this.labels.forEach((t) => {
|
|
2707
|
+
t.visible && e++;
|
|
2708
|
+
}), e;
|
|
2709
|
+
}
|
|
2710
|
+
/**
|
|
2711
|
+
* 获取所有标签数量
|
|
2712
|
+
*/
|
|
2713
|
+
getTotalCount() {
|
|
2714
|
+
return this.labels.size;
|
|
2715
|
+
}
|
|
2716
|
+
/**
|
|
2717
|
+
* 调试执行碰撞检测(带详细日志)
|
|
2718
|
+
*/
|
|
2719
|
+
debugRun() {
|
|
2720
|
+
const { padding: e, viewportMargin: t } = this.options, s = window.innerWidth, i = window.innerHeight;
|
|
2721
|
+
console.log("=== CollisionManager debugRun ==="), console.log("padding:", e, "viewportMargin:", t);
|
|
2722
|
+
const r = [];
|
|
2723
|
+
this.labels.forEach((n) => {
|
|
2724
|
+
const a = n.node.element;
|
|
2725
|
+
if (!a) {
|
|
2726
|
+
console.log("Skipping: wrapper is null");
|
|
2727
|
+
return;
|
|
2728
|
+
}
|
|
2729
|
+
const h = a.firstElementChild;
|
|
2730
|
+
if (!h) {
|
|
2731
|
+
console.log("Skipping: child element is null");
|
|
2732
|
+
return;
|
|
2733
|
+
}
|
|
2734
|
+
const m = h.style.opacity === "0";
|
|
2735
|
+
m && (h.style.visibility = "hidden", h.style.opacity = "1");
|
|
2736
|
+
const p = h.getBoundingClientRect();
|
|
2737
|
+
if (m && (h.style.opacity = "0", h.style.visibility = ""), p.width === 0 || p.height === 0) {
|
|
2738
|
+
console.log("Skipping: rect is 0", p);
|
|
2739
|
+
return;
|
|
2740
|
+
}
|
|
2741
|
+
const v = p.right >= -t && p.left <= s + t && p.bottom >= -t && p.top <= i + t;
|
|
2742
|
+
console.log(`Entry priority=${n.priority}, inViewport=${v}`), v ? (n.bounds = p, r.push(n)) : (this.setNodeVisibility(n.node, !1), n.visible = !1);
|
|
2743
|
+
}), console.log("Entries in viewport:", r.length), r.sort((n, a) => a.priority - n.priority), console.log("Sorted entries:", r.map((n) => n.priority));
|
|
2744
|
+
const o = [];
|
|
2745
|
+
for (const n of r) {
|
|
2746
|
+
if (!n.bounds) continue;
|
|
2747
|
+
const a = this.checkCollision(n.bounds, o, e);
|
|
2748
|
+
console.log(`Processing priority=${n.priority}, hasCollision=${a}, occupiedRects.length=${o.length}`), a ? (this.setNodeVisibility(n.node, !1), n.visible = !1) : (this.setNodeVisibility(n.node, !0), n.visible = !0, o.push(n.bounds));
|
|
2749
|
+
}
|
|
2750
|
+
console.log("Final visible count:", this.getVisibleCount());
|
|
2751
|
+
}
|
|
2752
|
+
/**
|
|
2753
|
+
* 清空所有标签
|
|
2754
|
+
*/
|
|
2755
|
+
clear() {
|
|
2756
|
+
this.labels.clear();
|
|
2757
|
+
}
|
|
2758
|
+
/**
|
|
2759
|
+
* 销毁管理器
|
|
2760
|
+
*/
|
|
2761
|
+
dispose() {
|
|
2762
|
+
this.animationFrameId && cancelAnimationFrame(this.animationFrameId), this.labels.clear();
|
|
2763
|
+
}
|
|
2764
|
+
}
|
|
2765
|
+
const Ae = {
|
|
2586
2766
|
zIndex: "auto"
|
|
2587
2767
|
};
|
|
2588
|
-
class
|
|
2589
|
-
constructor(e) {
|
|
2590
|
-
this.container = e;
|
|
2768
|
+
class Js {
|
|
2769
|
+
constructor(e, t) {
|
|
2770
|
+
this.container = e, this.collisionManager = new Qs(t == null ? void 0 : t.collision);
|
|
2591
2771
|
}
|
|
2592
2772
|
addRenderer(e, t) {
|
|
2593
|
-
const s = t.container || this.container,
|
|
2594
|
-
|
|
2773
|
+
const s = D(D({}, Ae), t), i = s.container || this.container, r = i.offsetWidth, o = i.offsetHeight, n = e === "css2d" ? new $s() : new qs();
|
|
2774
|
+
n.domElement.style.position = "absolute", n.domElement.style.top = "0", n.domElement.style.pointerEvents = "none", n.domElement.style.zIndex = s.zIndex, n.setSize(r, o), i.appendChild(n.domElement), e === "css2d" ? this.css2Drenderer = n : e === "css3d" && (this.css3Drenderer = n);
|
|
2595
2775
|
}
|
|
2596
2776
|
setSize(e, t) {
|
|
2597
2777
|
var s, i;
|
|
@@ -2599,14 +2779,14 @@ class Qs {
|
|
|
2599
2779
|
}
|
|
2600
2780
|
render(e, t) {
|
|
2601
2781
|
var s, i;
|
|
2602
|
-
(s = this.css2Drenderer) == null || s.render(e, t), (i = this.css3Drenderer) == null || i.render(e, t);
|
|
2782
|
+
(s = this.css2Drenderer) == null || s.render(e, t), (i = this.css3Drenderer) == null || i.render(e, t), this.collisionManager.update(t);
|
|
2603
2783
|
}
|
|
2604
2784
|
dispose() {
|
|
2605
2785
|
var e, t;
|
|
2606
|
-
(e = this.css2Drenderer) == null || e.domElement.remove(), (t = this.css3Drenderer) == null || t.domElement.remove(), this.css2Drenderer = void 0, this.css3Drenderer = void 0;
|
|
2786
|
+
(e = this.css2Drenderer) == null || e.domElement.remove(), (t = this.css3Drenderer) == null || t.domElement.remove(), this.css2Drenderer = void 0, this.css3Drenderer = void 0, this.collisionManager.dispose();
|
|
2607
2787
|
}
|
|
2608
2788
|
}
|
|
2609
|
-
class
|
|
2789
|
+
class ei {
|
|
2610
2790
|
constructor(e) {
|
|
2611
2791
|
this.helpers = {}, this.options = e;
|
|
2612
2792
|
}
|
|
@@ -2615,7 +2795,7 @@ class Js {
|
|
|
2615
2795
|
let i = this.helpers[t];
|
|
2616
2796
|
if (i === void 0) {
|
|
2617
2797
|
if (e.isScene)
|
|
2618
|
-
i = new
|
|
2798
|
+
i = new ke(100);
|
|
2619
2799
|
else if (e.isCamera)
|
|
2620
2800
|
i = new $t(e);
|
|
2621
2801
|
else if (e.isPointLight)
|
|
@@ -2631,7 +2811,7 @@ class Js {
|
|
|
2631
2811
|
else {
|
|
2632
2812
|
const r = new lt();
|
|
2633
2813
|
if (r.setFromObject(e, !0), r.isEmpty() === !1) {
|
|
2634
|
-
i = new
|
|
2814
|
+
i = new ze(r);
|
|
2635
2815
|
const o = i.material;
|
|
2636
2816
|
o.userData.object = e, o.userData.lastMatrixWorld = e.matrixWorld.clone(), o.depthTest = !1, o.transparent = !0;
|
|
2637
2817
|
} else
|
|
@@ -2663,7 +2843,7 @@ class Js {
|
|
|
2663
2843
|
}
|
|
2664
2844
|
removeAllExcludeScene() {
|
|
2665
2845
|
Object.keys(this.helpers).forEach((e) => {
|
|
2666
|
-
this.helpers[e] instanceof
|
|
2846
|
+
this.helpers[e] instanceof ke || this.remove({
|
|
2667
2847
|
uuid: e
|
|
2668
2848
|
});
|
|
2669
2849
|
});
|
|
@@ -2672,7 +2852,7 @@ class Js {
|
|
|
2672
2852
|
var r, o;
|
|
2673
2853
|
const { cameraController: i } = this.options;
|
|
2674
2854
|
Object.values(this.helpers).forEach((n) => {
|
|
2675
|
-
if (n.update && n.update(), n instanceof
|
|
2855
|
+
if (n.update && n.update(), n instanceof ze) {
|
|
2676
2856
|
const a = n.material, { object: h, lastMatrixWorld: m } = a.userData;
|
|
2677
2857
|
h && !h.matrixWorld.equals(
|
|
2678
2858
|
m || h.matrixWorld
|
|
@@ -2701,7 +2881,7 @@ function Pe(c) {
|
|
|
2701
2881
|
}));
|
|
2702
2882
|
};
|
|
2703
2883
|
}
|
|
2704
|
-
class
|
|
2884
|
+
class ti {
|
|
2705
2885
|
constructor(e) {
|
|
2706
2886
|
var t;
|
|
2707
2887
|
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 = {
|
|
@@ -2711,13 +2891,13 @@ class ei {
|
|
|
2711
2891
|
}
|
|
2712
2892
|
addPickListener(e) {
|
|
2713
2893
|
const t = /* @__PURE__ */ new Set(["move", "enter", "leave", "enterOnStop"]), s = /* @__PURE__ */ new Set(["down", "downOutside", "click"]), i = (r) => {
|
|
2714
|
-
var
|
|
2894
|
+
var v;
|
|
2715
2895
|
if (!this.enabled)
|
|
2716
2896
|
return;
|
|
2717
2897
|
r.preventDefault();
|
|
2718
2898
|
const o = e === "move" ? t : s, n = [];
|
|
2719
2899
|
if (this.pickFunctionsMap.forEach((f) => {
|
|
2720
|
-
o.has(f.type) && n.push(te(
|
|
2900
|
+
o.has(f.type) && n.push(te(D({}, f), {
|
|
2721
2901
|
objArr: f.objArr instanceof Function ? f.objArr() : f.objArr
|
|
2722
2902
|
}));
|
|
2723
2903
|
}), n.length === 0) return;
|
|
@@ -2731,7 +2911,7 @@ class ei {
|
|
|
2731
2911
|
g.has(f.type) || g.set(f.type, []), g.get(f.type).push(f.cb);
|
|
2732
2912
|
}
|
|
2733
2913
|
if (a.size === 0) return;
|
|
2734
|
-
const h = [...a.keys()].map((f) => f.object3d), m = (
|
|
2914
|
+
const h = [...a.keys()].map((f) => f.object3d), m = (v = this.pencil.pick(r, h, !1)) == null ? void 0 : v.intersects;
|
|
2735
2915
|
if (!m || m.length === 0)
|
|
2736
2916
|
e === "down" ? this.handleDownOutside(r) : e === "move" && this.handleLeaveEvents(r);
|
|
2737
2917
|
else {
|
|
@@ -2804,10 +2984,10 @@ class ei {
|
|
|
2804
2984
|
});
|
|
2805
2985
|
const m = a.get("click");
|
|
2806
2986
|
if (m) {
|
|
2807
|
-
const p = (
|
|
2808
|
-
|
|
2987
|
+
const p = (v) => {
|
|
2988
|
+
v.preventDefault();
|
|
2809
2989
|
const f = 5;
|
|
2810
|
-
if (!r && Math.abs(
|
|
2990
|
+
if (!r && Math.abs(v.clientX - e.clientX) <= f && Math.abs(v.clientY - e.clientY) <= f)
|
|
2811
2991
|
for (const u of m)
|
|
2812
2992
|
u({
|
|
2813
2993
|
baseObject: n,
|
|
@@ -2979,18 +3159,18 @@ class ei {
|
|
|
2979
3159
|
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();
|
|
2980
3160
|
}
|
|
2981
3161
|
}
|
|
2982
|
-
class
|
|
3162
|
+
class si extends ti {
|
|
2983
3163
|
constructor(e, t) {
|
|
2984
3164
|
super(e), this.objMap = /* @__PURE__ */ new Map(), this.objects = /* @__PURE__ */ new Map(), this.objectsPm = /* @__PURE__ */ new Map(), this.objectWrapChindIdMap = /* @__PURE__ */ new Map(), this.objectNamesToFactories = /* @__PURE__ */ new Map(), this.mList = t.mList, this.scene = this.createBaseObject(t.scene || new ct(), {
|
|
2985
3165
|
key: "@Scene",
|
|
2986
3166
|
name: "场景",
|
|
2987
3167
|
mList: !1
|
|
2988
|
-
}), this.group = this.createBaseObject(new
|
|
3168
|
+
}), this.group = this.createBaseObject(new Oe(), {
|
|
2989
3169
|
key: "@Group",
|
|
2990
3170
|
name: "物体组",
|
|
2991
3171
|
target: this.scene,
|
|
2992
3172
|
mList: !1
|
|
2993
|
-
}), this.prefabGroup = this.createBaseObject(new
|
|
3173
|
+
}), this.prefabGroup = this.createBaseObject(new Oe(), {
|
|
2994
3174
|
key: "@PrefabGroup",
|
|
2995
3175
|
name: "预制组",
|
|
2996
3176
|
target: this.scene,
|
|
@@ -3001,10 +3181,10 @@ class ti extends ei {
|
|
|
3001
3181
|
return this.objectsPm.values();
|
|
3002
3182
|
}
|
|
3003
3183
|
createBaseObject(e, t = {}) {
|
|
3004
|
-
const s =
|
|
3184
|
+
const s = D({
|
|
3005
3185
|
mList: !0
|
|
3006
3186
|
}, t);
|
|
3007
|
-
e instanceof
|
|
3187
|
+
e instanceof Oe && (e.raycast = (r, o) => r.intersectObjects(e.children, !0, o));
|
|
3008
3188
|
const i = new ls();
|
|
3009
3189
|
if (i.object3d = e, i.pencil = this.pencil, i.lead = this, i.mList = this.mList, s.key && (i.key = s.key), !s.key && s.target)
|
|
3010
3190
|
if (s.target.key === "@Scene" && e instanceof Jt)
|
|
@@ -3048,12 +3228,12 @@ class ti extends ei {
|
|
|
3048
3228
|
}
|
|
3049
3229
|
draw(e, t, s) {
|
|
3050
3230
|
return se(this, null, function* () {
|
|
3051
|
-
var p,
|
|
3231
|
+
var p, v, f;
|
|
3052
3232
|
const i = this.objectNamesToFactories.get(String(e));
|
|
3053
3233
|
if (!i)
|
|
3054
3234
|
throw new Error(`Unrecognized factory: ${String(e)}`);
|
|
3055
3235
|
t || (t = {}), t.target === void 0 && (t.target = s);
|
|
3056
|
-
const r = t.target, o = (p = t.onTop) != null ? p : 0, n = (
|
|
3236
|
+
const r = t.target, o = (p = t.onTop) != null ? p : 0, n = (v = t.prefab) != null ? v : !1, a = (f = t.create) != null ? f : !0, h = new i().create(t);
|
|
3057
3237
|
let m;
|
|
3058
3238
|
if (r === null)
|
|
3059
3239
|
m = null;
|
|
@@ -3161,7 +3341,7 @@ class ti extends ei {
|
|
|
3161
3341
|
}), this.objects.clear(), this.objectsPm.clear(), this.objMap.clear(), this.objectWrapChindIdMap.clear(), this.objectNamesToFactories.clear();
|
|
3162
3342
|
}
|
|
3163
3343
|
}
|
|
3164
|
-
class
|
|
3344
|
+
class ii extends ee {
|
|
3165
3345
|
get lead() {
|
|
3166
3346
|
return this.controller;
|
|
3167
3347
|
}
|
|
@@ -3169,7 +3349,7 @@ class si extends ee {
|
|
|
3169
3349
|
super(), this.options = e;
|
|
3170
3350
|
}
|
|
3171
3351
|
addLead(e, t, s) {
|
|
3172
|
-
const { pencil: i } = this.options, r = new
|
|
3352
|
+
const { pencil: i } = this.options, r = new si(i, {
|
|
3173
3353
|
scene: e,
|
|
3174
3354
|
mList: t
|
|
3175
3355
|
});
|
|
@@ -3191,12 +3371,12 @@ class si extends ee {
|
|
|
3191
3371
|
});
|
|
3192
3372
|
}
|
|
3193
3373
|
}
|
|
3194
|
-
class
|
|
3374
|
+
class ri extends dt {
|
|
3195
3375
|
constructor(e) {
|
|
3196
3376
|
super(e);
|
|
3197
3377
|
}
|
|
3198
3378
|
load(e, t, s, i) {
|
|
3199
|
-
const r = new
|
|
3379
|
+
const r = new Me(this.manager);
|
|
3200
3380
|
r.setResponseType("blob"), r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
|
|
3201
3381
|
e,
|
|
3202
3382
|
(o) => {
|
|
@@ -3222,19 +3402,19 @@ class it extends dt {
|
|
|
3222
3402
|
load(e, t, s, i) {
|
|
3223
3403
|
let r, o;
|
|
3224
3404
|
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();
|
|
3225
|
-
const n = new
|
|
3405
|
+
const n = new Me(this.manager);
|
|
3226
3406
|
return n.setResponseType("blob"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
|
|
3227
3407
|
e,
|
|
3228
3408
|
(a) => {
|
|
3229
3409
|
let h = a;
|
|
3230
3410
|
const m = e.split(".").pop(), p = this.options.type === "image" ? `image/${m || "png"}` : `video/${m || "mp4"}`;
|
|
3231
3411
|
h = h.slice(0, a.size, p);
|
|
3232
|
-
const
|
|
3412
|
+
const v = () => {
|
|
3233
3413
|
o.removeEventListener("load", f, !1), o.removeEventListener("error", u, !1);
|
|
3234
3414
|
}, f = () => {
|
|
3235
|
-
|
|
3236
|
-
}, u = (
|
|
3237
|
-
|
|
3415
|
+
v(), r.needsUpdate = !0, t && t(r);
|
|
3416
|
+
}, u = (y) => {
|
|
3417
|
+
v(), i && i(y), this.manager.itemError(e), this.manager.itemEnd(e);
|
|
3238
3418
|
};
|
|
3239
3419
|
o.addEventListener("load", f, !1), o.addEventListener("error", u, !1);
|
|
3240
3420
|
const g = window.URL.createObjectURL(h);
|
|
@@ -3245,7 +3425,7 @@ class it extends dt {
|
|
|
3245
3425
|
), r;
|
|
3246
3426
|
}
|
|
3247
3427
|
}
|
|
3248
|
-
const
|
|
3428
|
+
const oi = {
|
|
3249
3429
|
images: ["png", "jpg", "jpeg", "ico", "webp", "avif"],
|
|
3250
3430
|
media: ["mp4", "webm", "ogg"],
|
|
3251
3431
|
gltf: ["gltf", "glb"],
|
|
@@ -3254,9 +3434,9 @@ const ri = {
|
|
|
3254
3434
|
exr: ["exr"],
|
|
3255
3435
|
lottie: ["lottie.json"]
|
|
3256
3436
|
};
|
|
3257
|
-
class
|
|
3437
|
+
class ni {
|
|
3258
3438
|
constructor(e) {
|
|
3259
|
-
this.loadObj = [], this.delLoadArr = [], this.assets = /* @__PURE__ */ new Map(), this.event = new
|
|
3439
|
+
this.loadObj = [], this.delLoadArr = [], this.assets = /* @__PURE__ */ new Map(), this.event = new ye.EventEmitter(), this.options = D({
|
|
3260
3440
|
simpleTexture4deleted: !1,
|
|
3261
3441
|
prefix: ""
|
|
3262
3442
|
}, e), this.loadingManager = new ts(
|
|
@@ -3297,7 +3477,7 @@ class oi {
|
|
|
3297
3477
|
if (e.endsWith("json.gzip") || e.endsWith("json.gz"))
|
|
3298
3478
|
return "gzipJson";
|
|
3299
3479
|
} else return;
|
|
3300
|
-
for (const [i, r] of Object.entries(
|
|
3480
|
+
for (const [i, r] of Object.entries(oi))
|
|
3301
3481
|
if (r.includes(t))
|
|
3302
3482
|
return i;
|
|
3303
3483
|
}
|
|
@@ -3307,21 +3487,21 @@ class oi {
|
|
|
3307
3487
|
if (e === "media")
|
|
3308
3488
|
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;
|
|
3309
3489
|
if (e === "gltf" && (t != null && t.dracoPath))
|
|
3310
|
-
return this.dracoGltfLoader || (this.dracoGltfLoader = new
|
|
3490
|
+
return this.dracoGltfLoader || (this.dracoGltfLoader = new Ne(this.loadingManager), this.dracoLoader = new ys(), 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;
|
|
3311
3491
|
if (e === "gltf")
|
|
3312
|
-
return this.gltfLoader || (this.gltfLoader = new
|
|
3492
|
+
return this.gltfLoader || (this.gltfLoader = new Ne(this.loadingManager), this.options.prefix && this.gltfLoader.setPath(this.options.prefix)), this.gltfLoader;
|
|
3313
3493
|
if (e === "lottie")
|
|
3314
|
-
return this.lottieLoader || (this.lottieLoader = new
|
|
3494
|
+
return this.lottieLoader || (this.lottieLoader = new Cs(this.loadingManager), this.options.prefix && this.lottieLoader.setPath(this.options.prefix)), this.lottieLoader;
|
|
3315
3495
|
if (e === "gzipJson")
|
|
3316
|
-
return this.gzipJsonLoader || (this.gzipJsonLoader = new
|
|
3496
|
+
return this.gzipJsonLoader || (this.gzipJsonLoader = new ri(this.loadingManager), this.options.prefix && this.gzipJsonLoader.setPath(this.options.prefix)), this.gzipJsonLoader;
|
|
3317
3497
|
if (e === "json")
|
|
3318
|
-
return this.jsonLoader || (this.jsonLoader = new
|
|
3498
|
+
return this.jsonLoader || (this.jsonLoader = new Me(this.loadingManager), this.jsonLoader.setResponseType("json"), this.options.prefix && this.jsonLoader.setPath(this.options.prefix)), this.jsonLoader;
|
|
3319
3499
|
if (e === "exr")
|
|
3320
|
-
return this.exrLoader || (this.exrLoader = new
|
|
3500
|
+
return this.exrLoader || (this.exrLoader = new vs(this.loadingManager), this.options.prefix && this.exrLoader.setPath(this.options.prefix)), this.exrLoader;
|
|
3321
3501
|
}
|
|
3322
3502
|
add(e, t) {
|
|
3323
3503
|
typeof e == "string" && (e = [e]), e.forEach((s) => {
|
|
3324
|
-
const i =
|
|
3504
|
+
const i = D({
|
|
3325
3505
|
src: s
|
|
3326
3506
|
}, t);
|
|
3327
3507
|
this.loadObj.push(i);
|
|
@@ -3406,10 +3586,10 @@ class oi {
|
|
|
3406
3586
|
this.assets.clear(), (e = this.dracoLoader) == null || e.dispose(), this.event.removeAllListeners(), this.delLoadArr.length = 0, this.loadObj.length = 0;
|
|
3407
3587
|
}
|
|
3408
3588
|
}
|
|
3409
|
-
const
|
|
3589
|
+
const ai = {
|
|
3410
3590
|
prefix: ""
|
|
3411
3591
|
};
|
|
3412
|
-
class
|
|
3592
|
+
class li extends ee {
|
|
3413
3593
|
get loader() {
|
|
3414
3594
|
return this.controller;
|
|
3415
3595
|
}
|
|
@@ -3417,7 +3597,7 @@ class ai extends ee {
|
|
|
3417
3597
|
super(), this.options = e;
|
|
3418
3598
|
}
|
|
3419
3599
|
addLoader(e, t) {
|
|
3420
|
-
const { loaderParams: s } = this.options, i = new
|
|
3600
|
+
const { loaderParams: s } = this.options, i = new ni(te(D({}, s), {
|
|
3421
3601
|
scene: e
|
|
3422
3602
|
}));
|
|
3423
3603
|
return this.addController(i, t);
|
|
@@ -3428,7 +3608,7 @@ class ai extends ee {
|
|
|
3428
3608
|
});
|
|
3429
3609
|
}
|
|
3430
3610
|
}
|
|
3431
|
-
class
|
|
3611
|
+
class hi {
|
|
3432
3612
|
constructor(e) {
|
|
3433
3613
|
this.materials = /* @__PURE__ */ new Map(), this.fixBaseObjects = /* @__PURE__ */ new Map(), this.materialBaseObjectMap = /* @__PURE__ */ new Map(), this.pencil = e;
|
|
3434
3614
|
}
|
|
@@ -3537,8 +3717,8 @@ class li {
|
|
|
3537
3717
|
if (typeof h == "string" && !Number.isNaN(Number(h))) {
|
|
3538
3718
|
const p = Number(h);
|
|
3539
3719
|
if (p >= 0 && p < a.length) {
|
|
3540
|
-
const
|
|
3541
|
-
return this.rmBaseObjectMap(e,
|
|
3720
|
+
const v = a[p];
|
|
3721
|
+
return this.rmBaseObjectMap(e, v), a[p] = m, m && (this.applyColorSpaceToMaterials(m), this.addBaseObjectMap(e)), !0;
|
|
3542
3722
|
}
|
|
3543
3723
|
}
|
|
3544
3724
|
return a[h] = m, !0;
|
|
@@ -3607,7 +3787,7 @@ class li {
|
|
|
3607
3787
|
});
|
|
3608
3788
|
}
|
|
3609
3789
|
applyColorSpaceToMaterials(e) {
|
|
3610
|
-
|
|
3790
|
+
Os({ material: e });
|
|
3611
3791
|
}
|
|
3612
3792
|
material2array(e) {
|
|
3613
3793
|
return Array.isArray(e) ? e : [e];
|
|
@@ -3655,7 +3835,7 @@ class li {
|
|
|
3655
3835
|
e.track([...this.materials.values()]), e.dispose(), this.materials.clear(), this.fixBaseObjects.clear(), this.materialBaseObjectMap.clear();
|
|
3656
3836
|
}
|
|
3657
3837
|
}
|
|
3658
|
-
class
|
|
3838
|
+
class ci extends ee {
|
|
3659
3839
|
get mList() {
|
|
3660
3840
|
return this.controller;
|
|
3661
3841
|
}
|
|
@@ -3663,7 +3843,7 @@ class hi extends ee {
|
|
|
3663
3843
|
super(), this.options = e;
|
|
3664
3844
|
}
|
|
3665
3845
|
addMList(e, t) {
|
|
3666
|
-
const { pencil: s } = this.options, i = new
|
|
3846
|
+
const { pencil: s } = this.options, i = new hi(s);
|
|
3667
3847
|
return this.addController(i, t);
|
|
3668
3848
|
}
|
|
3669
3849
|
removePage(e) {
|
|
@@ -3672,7 +3852,7 @@ class hi extends ee {
|
|
|
3672
3852
|
});
|
|
3673
3853
|
}
|
|
3674
3854
|
}
|
|
3675
|
-
const
|
|
3855
|
+
const di = {
|
|
3676
3856
|
antialias: !1,
|
|
3677
3857
|
devicePixelRatio: window.devicePixelRatio,
|
|
3678
3858
|
powerPreference: "high-performance",
|
|
@@ -3684,7 +3864,7 @@ const ci = {
|
|
|
3684
3864
|
stencil: !1,
|
|
3685
3865
|
depth: !1
|
|
3686
3866
|
};
|
|
3687
|
-
class
|
|
3867
|
+
class pi {
|
|
3688
3868
|
constructor(e) {
|
|
3689
3869
|
this.options = e;
|
|
3690
3870
|
const { width: t, height: s, rendererParams: i } = e, {
|
|
@@ -3695,7 +3875,7 @@ class di {
|
|
|
3695
3875
|
toneMappingExposure: h,
|
|
3696
3876
|
outputColorSpace: m,
|
|
3697
3877
|
logarithmicDepthBuffer: p,
|
|
3698
|
-
preserveDrawingBuffer:
|
|
3878
|
+
preserveDrawingBuffer: v,
|
|
3699
3879
|
stencil: f,
|
|
3700
3880
|
depth: u
|
|
3701
3881
|
} = i, g = new is({
|
|
@@ -3703,7 +3883,7 @@ class di {
|
|
|
3703
3883
|
antialias: n,
|
|
3704
3884
|
powerPreference: a,
|
|
3705
3885
|
logarithmicDepthBuffer: p,
|
|
3706
|
-
preserveDrawingBuffer:
|
|
3886
|
+
preserveDrawingBuffer: v,
|
|
3707
3887
|
stencil: f,
|
|
3708
3888
|
depth: u
|
|
3709
3889
|
});
|
|
@@ -3728,10 +3908,10 @@ class di {
|
|
|
3728
3908
|
this.setSize(0, 0), (e = this.renderer) == null || e.clear(), (t = this.renderer) == null || t.dispose(), (s = this.renderer) == null || s.forceContextLoss();
|
|
3729
3909
|
}
|
|
3730
3910
|
}
|
|
3731
|
-
const
|
|
3911
|
+
const mi = {
|
|
3732
3912
|
background: null
|
|
3733
3913
|
};
|
|
3734
|
-
class
|
|
3914
|
+
class ui extends ee {
|
|
3735
3915
|
get scene() {
|
|
3736
3916
|
return this.controller;
|
|
3737
3917
|
}
|
|
@@ -3754,10 +3934,10 @@ class mi extends ee {
|
|
|
3754
3934
|
});
|
|
3755
3935
|
}
|
|
3756
3936
|
}
|
|
3757
|
-
class
|
|
3937
|
+
class fi {
|
|
3758
3938
|
constructor(e) {
|
|
3759
|
-
this.event = new
|
|
3760
|
-
const { renderer: t, scene: s, camera: i } = e, r = new
|
|
3939
|
+
this.event = new ye.EventEmitter();
|
|
3940
|
+
const { renderer: t, scene: s, camera: i } = e, r = new Ts(
|
|
3761
3941
|
i,
|
|
3762
3942
|
t.domElement
|
|
3763
3943
|
);
|
|
@@ -3823,11 +4003,11 @@ class ui {
|
|
|
3823
4003
|
this.event.removeAllListeners(), (e = this.controls) == null || e.dispose();
|
|
3824
4004
|
}
|
|
3825
4005
|
}
|
|
3826
|
-
const
|
|
4006
|
+
const _i = {
|
|
3827
4007
|
antialias: !0,
|
|
3828
4008
|
devicePixelRatio: window.devicePixelRatio
|
|
3829
4009
|
};
|
|
3830
|
-
class
|
|
4010
|
+
class gi {
|
|
3831
4011
|
constructor(e) {
|
|
3832
4012
|
this.options = e;
|
|
3833
4013
|
const { width: t, height: s, rendererParams: i, renderer: r } = e, { devicePixelRatio: o, antialias: n } = i, a = new r({
|
|
@@ -3849,8 +4029,8 @@ class _i {
|
|
|
3849
4029
|
const _e = class _e {
|
|
3850
4030
|
constructor(e) {
|
|
3851
4031
|
var r, o;
|
|
3852
|
-
this.raycaster = new ht(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new I(), this._cameraTarget = new I(), this.event = new
|
|
3853
|
-
isMergeableObject:
|
|
4032
|
+
this.raycaster = new ht(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new I(), this._cameraTarget = new I(), this.event = new ye.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 = Dt(_e.options, e, {
|
|
4033
|
+
isMergeableObject: bs
|
|
3854
4034
|
}), this.userSetDprCache = this.options.renderer.devicePixelRatio;
|
|
3855
4035
|
const {
|
|
3856
4036
|
container: t,
|
|
@@ -3899,7 +4079,7 @@ const _e = class _e {
|
|
|
3899
4079
|
return this.mListController.mList;
|
|
3900
4080
|
}
|
|
3901
4081
|
tweenUpdateRaf() {
|
|
3902
|
-
|
|
4082
|
+
Ce.update(), this.TweenRaf = requestAnimationFrame(this.tweenUpdateRaf.bind(this));
|
|
3903
4083
|
}
|
|
3904
4084
|
use(e, ...t) {
|
|
3905
4085
|
this.installPlugins.has(e.pluginName) ? console.log("plugin already installed") : typeof e.install == "function" && (e.install(this, ...t), this.installPlugins.set(e.pluginName, e));
|
|
@@ -3935,48 +4115,48 @@ const _e = class _e {
|
|
|
3935
4115
|
renderer: r,
|
|
3936
4116
|
controls: o,
|
|
3937
4117
|
loader: n
|
|
3938
|
-
} = this.options, { width: a, height: h } = this.getSize(), m = t ? new
|
|
4118
|
+
} = this.options, { width: a, height: h } = this.getSize(), m = t ? new gi({
|
|
3939
4119
|
width: a,
|
|
3940
4120
|
height: h,
|
|
3941
4121
|
//@ts-ignore
|
|
3942
4122
|
renderer: this.options.WebGPURenderer,
|
|
3943
|
-
rendererParams:
|
|
3944
|
-
}) : new
|
|
4123
|
+
rendererParams: _i
|
|
4124
|
+
}) : new pi({
|
|
3945
4125
|
width: a,
|
|
3946
4126
|
height: h,
|
|
3947
|
-
rendererParams: te(
|
|
4127
|
+
rendererParams: te(D({}, r), {
|
|
3948
4128
|
antialias: !1
|
|
3949
4129
|
})
|
|
3950
4130
|
});
|
|
3951
4131
|
this.rendererController = m;
|
|
3952
|
-
const p = new
|
|
4132
|
+
const p = new Ds({
|
|
3953
4133
|
width: a,
|
|
3954
4134
|
height: h
|
|
3955
|
-
}),
|
|
4135
|
+
}), v = new ui({}), f = new Ks({
|
|
3956
4136
|
controlsParams: {
|
|
3957
4137
|
domElement: (_ = o == null ? void 0 : o.domElement) != null ? _ : m.renderer.domElement
|
|
3958
4138
|
}
|
|
3959
|
-
}), u = new
|
|
3960
|
-
loaderParams:
|
|
4139
|
+
}), u = new li({
|
|
4140
|
+
loaderParams: D({
|
|
3961
4141
|
anisotropy: this.maxAnisotropy
|
|
3962
4142
|
}, n)
|
|
3963
|
-
}), g = new
|
|
4143
|
+
}), g = new ci({
|
|
3964
4144
|
pencil: this
|
|
3965
|
-
}),
|
|
4145
|
+
}), y = new ii({
|
|
3966
4146
|
pencil: this
|
|
3967
4147
|
});
|
|
3968
|
-
this.sceneController =
|
|
4148
|
+
this.sceneController = v, this.cameraController = p, this.controlsController = f, this.loaderController = u, this.mListController = g, this.leadController = y;
|
|
3969
4149
|
const l = this.addPage({
|
|
3970
4150
|
sceneOptions: this.options.scene,
|
|
3971
4151
|
cameraOptions: this.options.camera
|
|
3972
4152
|
});
|
|
3973
4153
|
if (this.showPage(l), s) {
|
|
3974
|
-
const
|
|
4154
|
+
const O = new ei({
|
|
3975
4155
|
container: e,
|
|
3976
|
-
sceneController:
|
|
4156
|
+
sceneController: v,
|
|
3977
4157
|
cameraController: p
|
|
3978
4158
|
});
|
|
3979
|
-
|
|
4159
|
+
O.add(v.scene), this.helperController = O, i && O.addViewHelper();
|
|
3980
4160
|
}
|
|
3981
4161
|
e.appendChild(m.renderer.domElement);
|
|
3982
4162
|
}
|
|
@@ -3993,7 +4173,7 @@ const _e = class _e {
|
|
|
3993
4173
|
cameraController: this.cameraController,
|
|
3994
4174
|
composerParams: r
|
|
3995
4175
|
});
|
|
3996
|
-
this.composerController = o, e && o.addBloomPass(
|
|
4176
|
+
this.composerController = o, e && o.addBloomPass(D({}, t)), s && o.addSSAOPass(D({}, i)), o.addOutputPass();
|
|
3997
4177
|
}
|
|
3998
4178
|
initCSSRenderer() {
|
|
3999
4179
|
const {
|
|
@@ -4004,12 +4184,12 @@ const _e = class _e {
|
|
|
4004
4184
|
css3DRendererParams: r
|
|
4005
4185
|
} = this.options;
|
|
4006
4186
|
if (t || s) {
|
|
4007
|
-
const o = new
|
|
4187
|
+
const o = new Js(e, i);
|
|
4008
4188
|
t && o.addRenderer("css2d", i), s && o.addRenderer("css3d", r), this.cssRendererController = o;
|
|
4009
4189
|
}
|
|
4010
4190
|
}
|
|
4011
4191
|
initTransformControls() {
|
|
4012
|
-
const e = new
|
|
4192
|
+
const e = new fi({
|
|
4013
4193
|
camera: this.camera,
|
|
4014
4194
|
renderer: this.renderer,
|
|
4015
4195
|
scene: this.scene
|
|
@@ -4098,7 +4278,7 @@ const _e = class _e {
|
|
|
4098
4278
|
var s, i, r, o, n, a;
|
|
4099
4279
|
if (!this.camera || !this.scene)
|
|
4100
4280
|
return;
|
|
4101
|
-
this.event.emit("beforeRender"), this.timer.update(),
|
|
4281
|
+
this.event.emit("beforeRender"), this.timer.update(), Ce.update();
|
|
4102
4282
|
const e = this.timer.getDelta(), t = this.timer.getElapsed();
|
|
4103
4283
|
this.controlsController.update(e, t), this.leadController.update(e, t), this.installPlugins.forEach((h) => {
|
|
4104
4284
|
var m;
|
|
@@ -4147,11 +4327,11 @@ const _e = class _e {
|
|
|
4147
4327
|
}
|
|
4148
4328
|
}
|
|
4149
4329
|
dispose() {
|
|
4150
|
-
var e, t, s, i, r, o, n, a, h, m, p,
|
|
4151
|
-
this.handeleResize(1, 1, !1), this.stop(), this.timer.dispose(),
|
|
4152
|
-
var
|
|
4153
|
-
(
|
|
4154
|
-
}), (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(), (
|
|
4330
|
+
var e, t, s, i, r, o, n, a, h, m, p, v, f, u;
|
|
4331
|
+
this.handeleResize(1, 1, !1), this.stop(), this.timer.dispose(), Ce.removeAll(), this.event.removeAllListeners(), (e = this.resizeObserver) == null || e.unobserve(this.options.container), this.installPlugins.forEach((g) => {
|
|
4332
|
+
var y;
|
|
4333
|
+
(y = g.dispose) == null || y.call(g);
|
|
4334
|
+
}), (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(), (v = this.mListController) == null || v.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;
|
|
4155
4335
|
}
|
|
4156
4336
|
};
|
|
4157
4337
|
_e.options = {
|
|
@@ -4160,26 +4340,26 @@ _e.options = {
|
|
|
4160
4340
|
viewHelper: he,
|
|
4161
4341
|
controls: !0,
|
|
4162
4342
|
transformControls: he,
|
|
4163
|
-
renderer:
|
|
4343
|
+
renderer: di,
|
|
4164
4344
|
composer: Zs,
|
|
4165
|
-
scene:
|
|
4166
|
-
camera:
|
|
4345
|
+
scene: mi,
|
|
4346
|
+
camera: bt,
|
|
4167
4347
|
bloom: !1,
|
|
4168
4348
|
bloomParams: Ys,
|
|
4169
4349
|
ssao: !1,
|
|
4170
|
-
loader:
|
|
4350
|
+
loader: ai,
|
|
4171
4351
|
ssaoParams: Vs,
|
|
4172
4352
|
css2DRenderer: !1,
|
|
4173
|
-
css2DRendererParams:
|
|
4353
|
+
css2DRendererParams: D({}, Ae),
|
|
4174
4354
|
css3DRenderer: !1,
|
|
4175
|
-
css3DRendererParams:
|
|
4355
|
+
css3DRendererParams: D({}, Ae)
|
|
4176
4356
|
};
|
|
4177
4357
|
let rt = _e;
|
|
4178
|
-
const
|
|
4358
|
+
const qi = J.ACTION;
|
|
4179
4359
|
export {
|
|
4180
4360
|
ls as BaseObject,
|
|
4181
4361
|
rt as Pencil,
|
|
4182
4362
|
Se as ResourceTracker,
|
|
4183
|
-
|
|
4363
|
+
qi as cameraControlsAction,
|
|
4184
4364
|
rt as default
|
|
4185
4365
|
};
|