gl-draw 0.17.0-beta.22 → 0.17.0-beta.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/Lead/Pick.d.ts +20 -2
- package/dist/core/Pencil.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.module.js +210 -157
- package/dist/index.module2.js +4 -4
- package/dist/index2.js +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +41 -41
- package/package.json +1 -1
package/dist/index.module.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var Pt = Object.defineProperty, At = Object.defineProperties;
|
|
2
2
|
var St = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
3
|
+
var Me = Object.getOwnPropertySymbols;
|
|
4
4
|
var Mt = Object.prototype.hasOwnProperty, Dt = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var
|
|
5
|
+
var De = (c, e, t) => e in c ? Pt(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t, U = (c, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
Mt.call(e, t) &&
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
10
|
-
Dt.call(e, t) &&
|
|
7
|
+
Mt.call(e, t) && De(c, t, e[t]);
|
|
8
|
+
if (Me)
|
|
9
|
+
for (var t of Me(e))
|
|
10
|
+
Dt.call(e, t) && De(c, t, e[t]);
|
|
11
11
|
return c;
|
|
12
12
|
}, te = (c, e) => At(c, St(e));
|
|
13
13
|
var se = (c, e, t) => new Promise((s, i) => {
|
|
@@ -29,9 +29,9 @@ var se = (c, e, t) => new Promise((s, i) => {
|
|
|
29
29
|
import * as Ce from "@tweenjs/tween.js";
|
|
30
30
|
import Rt from "deepmerge";
|
|
31
31
|
import Ut from "stats-gl";
|
|
32
|
-
import { Vector3 as
|
|
33
|
-
import { M as pt, B as as, a as ls, R as
|
|
34
|
-
import { EffectComposer as
|
|
32
|
+
import { Vector3 as I, PerspectiveCamera as kt, Matrix4 as W, ShaderMaterial as zt, UniformsUtils as Ft, RawShaderMaterial as Nt, MeshBasicMaterial as jt, PointsMaterial as ot, SpriteMaterial as nt, Color as It, Layers as Ht, Vector2 as B, WebGLRenderTarget as Bt, HalfFloatType as Vt, MathUtils as Yt, Vector4 as Zt, Quaternion as at, Spherical as Wt, Box3 as lt, Sphere as Kt, Raycaster as ht, AxesHelper as Re, CameraHelper as $t, PointLightHelper as Gt, DirectionalLightHelper as Xt, SpotLightHelper as qt, HemisphereLightHelper as Qt, Box3Helper as Ue, Scene as ct, Group as ke, Camera as Jt, Loader as dt, FileLoader as Ae, 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
|
+
import { M as pt, B as as, a as ls, R as Pe, I as he } from "./index.module2.js";
|
|
34
|
+
import { EffectComposer as ze } 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 Fe } 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
54
|
import { DRACOLoader as ys } from "three/examples/jsm/loaders/DRACOLoader";
|
|
55
55
|
import { EXRLoader as vs } from "three/examples/jsm/loaders/EXRLoader";
|
|
56
|
-
import { GLTFLoader as
|
|
56
|
+
import { GLTFLoader as Ne } from "three/examples/jsm/loaders/GLTFLoader";
|
|
57
57
|
import { LottieLoader as Cs } from "three/examples/jsm/loaders/LottieLoader";
|
|
58
58
|
import { a as Os, C as Es, i as Ts } from "./isPlainObject.module.js";
|
|
59
|
-
import { TransformControls as
|
|
59
|
+
import { TransformControls as bs } from "three/examples/jsm/controls/TransformControls";
|
|
60
60
|
const M = {
|
|
61
61
|
LEFT: 1,
|
|
62
62
|
RIGHT: 2,
|
|
@@ -91,10 +91,10 @@ const M = {
|
|
|
91
91
|
function Y(c) {
|
|
92
92
|
return c.isPerspectiveCamera;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function H(c) {
|
|
95
95
|
return c.isOrthographicCamera;
|
|
96
96
|
}
|
|
97
|
-
const $ = Math.PI * 2,
|
|
97
|
+
const $ = Math.PI * 2, je = 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
|
}
|
|
@@ -128,16 +128,16 @@ function He(c, e, t, s, i = 1 / 0, r, o) {
|
|
|
128
128
|
s = Math.max(1e-4, s);
|
|
129
129
|
const n = 2 / s, a = n * r, h = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
|
|
130
130
|
let m = e.x, p = e.y, v = e.z, _ = c.x - m, u = c.y - p, g = c.z - v;
|
|
131
|
-
const y = m, l = p, f = v, O = i * s, C = O * O,
|
|
132
|
-
if (
|
|
133
|
-
const ve = Math.sqrt(
|
|
131
|
+
const y = m, l = p, f = v, O = i * s, C = O * O, b = _ * _ + u * u + g * g;
|
|
132
|
+
if (b > C) {
|
|
133
|
+
const ve = Math.sqrt(b);
|
|
134
134
|
_ = _ / ve * O, u = u / ve * O, g = g / ve * O;
|
|
135
135
|
}
|
|
136
136
|
m = c.x - _, p = c.y - u, v = c.z - g;
|
|
137
137
|
const E = (t.x + n * _) * r, x = (t.y + n * u) * r, D = (t.z + n * g) * r;
|
|
138
138
|
t.x = (t.x - n * E) * h, t.y = (t.y - n * x) * h, t.z = (t.z - n * D) * h, o.x = m + (_ + E) * h, o.y = p + (u + x) * h, o.z = v + (g + D) * h;
|
|
139
|
-
const V = y - c.x, le = l - c.y,
|
|
140
|
-
return V *
|
|
139
|
+
const V = y - c.x, le = l - c.y, bt = f - c.z, wt = o.x - y, xt = o.y - l, Lt = o.z - f;
|
|
140
|
+
return V * wt + le * xt + bt * Lt > 0 && (o.x = y, o.y = l, o.z = f, t.x = (o.x - y) / r, t.y = (o.y - l) / r, t.z = (o.z - f) / r), o;
|
|
141
141
|
}
|
|
142
142
|
function Oe(c, e) {
|
|
143
143
|
e.set(0, 0), c.forEach((t) => {
|
|
@@ -145,9 +145,9 @@ function Oe(c, e) {
|
|
|
145
145
|
}), e.x /= c.length, e.y /= c.length;
|
|
146
146
|
}
|
|
147
147
|
function Ee(c, e) {
|
|
148
|
-
return
|
|
148
|
+
return H(c) ? (console.warn(`${e} is not supported in OrthographicCamera`), !0) : !1;
|
|
149
149
|
}
|
|
150
|
-
class
|
|
150
|
+
class ws {
|
|
151
151
|
constructor() {
|
|
152
152
|
this._listeners = {};
|
|
153
153
|
}
|
|
@@ -212,10 +212,10 @@ class bs {
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
const de = 1 / 8, xs = /Mac/.test(navigator.platform);
|
|
215
|
-
let T,
|
|
216
|
-
class J extends
|
|
215
|
+
let T, Be, pe, Te, R, w, L, G, ne, F, N, Z, Ve, Ye, k, ae, X, Ze, be, We, we, xe, me;
|
|
216
|
+
class J extends ws {
|
|
217
217
|
static install(e) {
|
|
218
|
-
T = e.THREE,
|
|
218
|
+
T = e.THREE, Be = Object.freeze(new T.Vector3(0, 0, 0)), pe = Object.freeze(new T.Vector3(0, 1, 0)), Te = Object.freeze(new T.Vector3(0, 0, 1)), R = new T.Vector2(), w = new T.Vector3(), L = new T.Vector3(), G = new T.Vector3(), ne = new T.Vector3(), F = new T.Vector3(), N = new T.Vector3(), Z = new T.Vector3(), Ve = new T.Vector3(), Ye = new T.Vector3(), k = new T.Spherical(), ae = new T.Spherical(), X = new T.Box3(), Ze = new T.Box3(), be = new T.Sphere(), We = new T.Quaternion(), we = new T.Quaternion(), xe = new T.Matrix4(), me = new T.Raycaster();
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
221
221
|
* list all ACTIONs
|
|
@@ -244,46 +244,46 @@ class J extends bs {
|
|
|
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
246
|
}, this._enabled = !0, this._state = d.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = K.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new T.Vector3(), this._focalOffsetVelocity = new T.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (l, f, O, C) => {
|
|
247
|
-
let
|
|
247
|
+
let b, E;
|
|
248
248
|
if (Y(this._camera)) {
|
|
249
|
-
const x =
|
|
250
|
-
|
|
251
|
-
} else if (
|
|
249
|
+
const x = w.copy(this._camera.position).sub(this._target), D = this._camera.getEffectiveFOV() * ie, V = x.length() * Math.tan(D * 0.5);
|
|
250
|
+
b = this.truckSpeed * l * V / this._elementRect.height, E = this.truckSpeed * f * V / this._elementRect.height;
|
|
251
|
+
} else if (H(this._camera)) {
|
|
252
252
|
const x = this._camera;
|
|
253
|
-
|
|
253
|
+
b = this.truckSpeed * l * (x.right - x.left) / x.zoom / this._elementRect.width, E = this.truckSpeed * f * (x.top - x.bottom) / x.zoom / this._elementRect.height;
|
|
254
254
|
} else
|
|
255
255
|
return;
|
|
256
256
|
C ? (O ? this.setFocalOffset(
|
|
257
|
-
this._focalOffsetEnd.x +
|
|
257
|
+
this._focalOffsetEnd.x + b,
|
|
258
258
|
this._focalOffsetEnd.y,
|
|
259
259
|
this._focalOffsetEnd.z,
|
|
260
260
|
!0
|
|
261
|
-
) : this.truck(
|
|
262
|
-
this._focalOffsetEnd.x +
|
|
261
|
+
) : this.truck(b, 0, !0), this.forward(-E, !0)) : O ? this.setFocalOffset(
|
|
262
|
+
this._focalOffsetEnd.x + b,
|
|
263
263
|
this._focalOffsetEnd.y + E,
|
|
264
264
|
this._focalOffsetEnd.z,
|
|
265
265
|
!0
|
|
266
|
-
) : this.truck(
|
|
266
|
+
) : this.truck(b, E, !0);
|
|
267
267
|
}, this._rotateInternal = (l, f) => {
|
|
268
268
|
const O = $ * this.azimuthRotateSpeed * l / this._elementRect.height, C = $ * this.polarRotateSpeed * f / this._elementRect.height;
|
|
269
269
|
this.rotate(O, C, !0);
|
|
270
270
|
}, this._dollyInternal = (l, f, O) => {
|
|
271
|
-
const C = Math.pow(0.95, -l * this.dollySpeed),
|
|
271
|
+
const C = Math.pow(0.95, -l * this.dollySpeed), b = this._sphericalEnd.radius, E = this._sphericalEnd.radius * C, x = z(
|
|
272
272
|
E,
|
|
273
273
|
this.minDistance,
|
|
274
274
|
this.maxDistance
|
|
275
275
|
), D = x - E;
|
|
276
|
-
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(D, !0), this._dollyToNoClamp(x, !0)) : this._dollyToNoClamp(x, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? E : x) -
|
|
276
|
+
this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(E, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(D, !0), this._dollyToNoClamp(x, !0)) : this._dollyToNoClamp(x, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? E : x) - b, this._dollyControlCoord.set(f, O)), this._lastDollyDirection = Math.sign(-l);
|
|
277
277
|
}, this._zoomInternal = (l, f, O) => {
|
|
278
|
-
const C = Math.pow(0.95, l * this.dollySpeed),
|
|
279
|
-
this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E -
|
|
278
|
+
const C = Math.pow(0.95, l * this.dollySpeed), b = this._zoom, E = this._zoom * C;
|
|
279
|
+
this.zoomTo(E, !0), this.dollyToCursor && (this._changedZoom += E - b, this._dollyControlCoord.set(f, O));
|
|
280
280
|
}, typeof T == "undefined" && console.error(
|
|
281
281
|
"camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."
|
|
282
282
|
), this._camera = e, this._yAxisUpSpace = new T.Quaternion().setFromUnitVectors(
|
|
283
283
|
this._camera.up,
|
|
284
284
|
pe
|
|
285
285
|
), this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert(), this._state = d.NONE, this._target = new T.Vector3(), this._targetEnd = this._target.clone(), this._focalOffset = new T.Vector3(), this._focalOffsetEnd = this._focalOffset.clone(), this._spherical = new T.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
288
|
new T.Vector3(),
|
|
289
289
|
new T.Vector3(),
|
|
@@ -296,17 +296,17 @@ class J extends bs {
|
|
|
296
296
|
left: d.ROTATE,
|
|
297
297
|
middle: d.DOLLY,
|
|
298
298
|
right: d.TRUCK,
|
|
299
|
-
wheel: Y(this._camera) ? d.DOLLY :
|
|
299
|
+
wheel: Y(this._camera) ? d.DOLLY : H(this._camera) ? d.ZOOM : d.NONE
|
|
300
300
|
}, this.touches = {
|
|
301
301
|
one: d.TOUCH_ROTATE,
|
|
302
|
-
two: Y(this._camera) ? d.TOUCH_DOLLY_TRUCK :
|
|
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
305
|
const s = new T.Vector2(), i = new T.Vector2(), r = new T.Vector2(), o = (l) => {
|
|
306
306
|
if (!this._enabled || !this._domElement) return;
|
|
307
307
|
if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
|
|
308
|
-
const C = this._domElement.getBoundingClientRect(),
|
|
309
|
-
if (
|
|
308
|
+
const C = this._domElement.getBoundingClientRect(), b = (l.clientX - C.left) / (C.right - C.left), E = (l.clientY - C.top) / (C.bottom - C.top);
|
|
309
|
+
if (b < this._interactiveArea.left || b > this._interactiveArea.right || E < this._interactiveArea.top || E > this._interactiveArea.bottom)
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
312
312
|
const f = 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;
|
|
@@ -391,7 +391,7 @@ class J extends bs {
|
|
|
391
391
|
const E = performance.now();
|
|
392
392
|
h - E < 1e3 && this._getClientRect(this._elementRect), h = E;
|
|
393
393
|
}
|
|
394
|
-
const f = xs ? -1 : -3, O = l.deltaMode === 1 || l.ctrlKey ? l.deltaY / f : l.deltaY / (f * 10), C = this.dollyToCursor ? (l.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0,
|
|
394
|
+
const f = xs ? -1 : -3, O = l.deltaMode === 1 || l.ctrlKey ? l.deltaY / f : l.deltaY / (f * 10), C = this.dollyToCursor ? (l.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, b = this.dollyToCursor ? (l.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
|
|
395
395
|
switch (this.mouseButtons.wheel) {
|
|
396
396
|
case d.ROTATE: {
|
|
397
397
|
this._rotateInternal(l.deltaX, l.deltaY), this._isUserControllingRotate = !0;
|
|
@@ -410,11 +410,11 @@ class J extends bs {
|
|
|
410
410
|
break;
|
|
411
411
|
}
|
|
412
412
|
case d.DOLLY: {
|
|
413
|
-
this._dollyInternal(-O, C,
|
|
413
|
+
this._dollyInternal(-O, C, b), this._isUserControllingDolly = !0;
|
|
414
414
|
break;
|
|
415
415
|
}
|
|
416
416
|
case d.ZOOM: {
|
|
417
|
-
this._zoomInternal(-O, C,
|
|
417
|
+
this._zoomInternal(-O, C, b), this._isUserControllingZoom = !0;
|
|
418
418
|
break;
|
|
419
419
|
}
|
|
420
420
|
}
|
|
@@ -438,8 +438,8 @@ class J extends bs {
|
|
|
438
438
|
}, v = (l) => {
|
|
439
439
|
if (!this._enabled) return;
|
|
440
440
|
if (Oe(this._activePointers, R), this._getClientRect(this._elementRect), s.copy(R), i.copy(R), this._activePointers.length >= 2) {
|
|
441
|
-
const O = R.x - this._activePointers[1].clientX, C = R.y - this._activePointers[1].clientY,
|
|
442
|
-
r.set(0,
|
|
441
|
+
const O = R.x - this._activePointers[1].clientX, C = R.y - this._activePointers[1].clientY, b = Math.sqrt(O * O + C * C);
|
|
442
|
+
r.set(0, b);
|
|
443
443
|
const E = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, x = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
|
|
444
444
|
i.set(E, x);
|
|
445
445
|
}
|
|
@@ -465,19 +465,19 @@ class J extends bs {
|
|
|
465
465
|
this._dragNeedsUpdate = !1, Oe(this._activePointers, R);
|
|
466
466
|
const f = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, O = f ? -f.deltaX : i.x - R.x, C = f ? -f.deltaY : i.y - R.y;
|
|
467
467
|
if (i.copy(R), ((this._state & d.ROTATE) === d.ROTATE || (this._state & d.TOUCH_ROTATE) === d.TOUCH_ROTATE || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_ZOOM_ROTATE) === d.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(O, C), this._isUserControllingRotate = !0), (this._state & d.DOLLY) === d.DOLLY || (this._state & d.ZOOM) === d.ZOOM) {
|
|
468
|
-
const
|
|
468
|
+
const b = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, E = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, x = this.dollyDragInverted ? -1 : 1;
|
|
469
469
|
(this._state & d.DOLLY) === d.DOLLY ? (this._dollyInternal(
|
|
470
470
|
x * C * de,
|
|
471
|
-
|
|
471
|
+
b,
|
|
472
472
|
E
|
|
473
473
|
), this._isUserControllingDolly = !0) : (this._zoomInternal(
|
|
474
474
|
x * C * de,
|
|
475
|
-
|
|
475
|
+
b,
|
|
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 b = R.x - this._activePointers[1].clientX, E = R.y - this._activePointers[1].clientY, x = Math.sqrt(b * b + E * E), D = 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
483
|
(this._state & d.TOUCH_DOLLY) === d.TOUCH_DOLLY || (this._state & d.TOUCH_DOLLY_ROTATE) === d.TOUCH_DOLLY_ROTATE || (this._state & d.TOUCH_DOLLY_TRUCK) === d.TOUCH_DOLLY_TRUCK || (this._state & d.TOUCH_DOLLY_SCREEN_PAN) === d.TOUCH_DOLLY_SCREEN_PAN || (this._state & d.TOUCH_DOLLY_OFFSET) === d.TOUCH_DOLLY_OFFSET ? (this._dollyInternal(D * de, V, le), this._isUserControllingDolly = !0) : (this._zoomInternal(D * de, V, le), this._isUserControllingZoom = !0);
|
|
@@ -900,7 +900,7 @@ class J extends bs {
|
|
|
900
900
|
*/
|
|
901
901
|
truck(e, t, s = !1) {
|
|
902
902
|
this._camera.updateMatrix(), F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), F.multiplyScalar(e), N.multiplyScalar(-t);
|
|
903
|
-
const i =
|
|
903
|
+
const i = w.copy(F).add(N), r = L.copy(this._targetEnd).add(i);
|
|
904
904
|
return this.moveTo(r.x, r.y, r.z, s);
|
|
905
905
|
}
|
|
906
906
|
/**
|
|
@@ -910,8 +910,8 @@ class J extends bs {
|
|
|
910
910
|
* @category Methods
|
|
911
911
|
*/
|
|
912
912
|
forward(e, t = !1) {
|
|
913
|
-
|
|
914
|
-
const s = L.copy(this._targetEnd).add(
|
|
913
|
+
w.setFromMatrixColumn(this._camera.matrix, 0), w.crossVectors(this._camera.up, w), w.multiplyScalar(e);
|
|
914
|
+
const s = L.copy(this._targetEnd).add(w);
|
|
915
915
|
return this.moveTo(s.x, s.y, s.z, t);
|
|
916
916
|
}
|
|
917
917
|
/**
|
|
@@ -921,10 +921,10 @@ class J extends bs {
|
|
|
921
921
|
* @category Methods
|
|
922
922
|
*/
|
|
923
923
|
elevate(e, t = !1) {
|
|
924
|
-
return
|
|
925
|
-
this._targetEnd.x +
|
|
926
|
-
this._targetEnd.y +
|
|
927
|
-
this._targetEnd.z +
|
|
924
|
+
return w.copy(this._camera.up).multiplyScalar(e), this.moveTo(
|
|
925
|
+
this._targetEnd.x + w.x,
|
|
926
|
+
this._targetEnd.y + w.y,
|
|
927
|
+
this._targetEnd.z + w.z,
|
|
928
928
|
t
|
|
929
929
|
);
|
|
930
930
|
}
|
|
@@ -938,7 +938,7 @@ class J extends bs {
|
|
|
938
938
|
*/
|
|
939
939
|
moveTo(e, t, s, i = !1) {
|
|
940
940
|
this._isUserControllingTruck = !1;
|
|
941
|
-
const r =
|
|
941
|
+
const r = w.set(e, t, s).sub(this._targetEnd);
|
|
942
942
|
this._encloseToBoundary(this._targetEnd, r, this.boundaryFriction), this._needsUpdate = !0, i || this._target.copy(this._targetEnd);
|
|
943
943
|
const o = !i || 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);
|
|
944
944
|
return this._createOnRestPromise(o);
|
|
@@ -953,7 +953,7 @@ class J extends bs {
|
|
|
953
953
|
* @category Methods
|
|
954
954
|
*/
|
|
955
955
|
lookInDirectionOf(e, t, s, i = !1) {
|
|
956
|
-
const n =
|
|
956
|
+
const n = w.set(e, t, s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);
|
|
957
957
|
return this.setPosition(
|
|
958
958
|
n.x,
|
|
959
959
|
n.y,
|
|
@@ -985,13 +985,13 @@ class J extends bs {
|
|
|
985
985
|
h.isEmpty() && (console.warn(
|
|
986
986
|
"camera-controls: fitTo() cannot be used with an empty box. Aborting"
|
|
987
987
|
), Promise.resolve());
|
|
988
|
-
const m = Ie(this._sphericalEnd.theta,
|
|
988
|
+
const m = Ie(this._sphericalEnd.theta, je), p = Ie(this._sphericalEnd.phi, je);
|
|
989
989
|
a.push(this.rotateTo(m, p, t));
|
|
990
|
-
const v =
|
|
991
|
-
u && _.multiply(
|
|
992
|
-
const g =
|
|
993
|
-
L.copy(h.min).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setX(h.max.x).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setY(h.max.y).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setZ(h.min.z).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setZ(h.max.z).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setY(h.min.y).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setX(h.min.x).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).applyQuaternion(_), g.expandByPoint(L), g.min.x -= i, g.min.y -= o, g.max.x += r, g.max.y += n, _.setFromUnitVectors(Te, v), u && _.premultiply(
|
|
994
|
-
const y = g.getSize(
|
|
990
|
+
const v = w.setFromSpherical(this._sphericalEnd).normalize(), _ = We.setFromUnitVectors(v, Te), u = P(Math.abs(v.y), 1);
|
|
991
|
+
u && _.multiply(we.setFromAxisAngle(pe, m)), _.multiply(this._yAxisUpSpaceInverse);
|
|
992
|
+
const g = Ze.makeEmpty();
|
|
993
|
+
L.copy(h.min).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setX(h.max.x).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setY(h.max.y).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setZ(h.min.z).applyQuaternion(_), g.expandByPoint(L), L.copy(h.min).setZ(h.max.z).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setY(h.min.y).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).setX(h.min.x).applyQuaternion(_), g.expandByPoint(L), L.copy(h.max).applyQuaternion(_), g.expandByPoint(L), g.min.x -= i, g.min.y -= o, g.max.x += r, g.max.y += n, _.setFromUnitVectors(Te, v), u && _.premultiply(we.invert()), _.premultiply(this._yAxisUpSpace);
|
|
994
|
+
const y = g.getSize(w), l = g.getCenter(L).applyQuaternion(_);
|
|
995
995
|
if (Y(this._camera)) {
|
|
996
996
|
const f = this.getDistanceToFitBox(
|
|
997
997
|
y.x,
|
|
@@ -1002,11 +1002,11 @@ class J extends bs {
|
|
|
1002
1002
|
a.push(
|
|
1003
1003
|
this.moveTo(l.x, l.y, l.z, t)
|
|
1004
1004
|
), a.push(this.dollyTo(f, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
1005
|
-
} else if (
|
|
1006
|
-
const f = this._camera, O = f.right - f.left, C = f.top - f.bottom,
|
|
1005
|
+
} else if (H(this._camera)) {
|
|
1006
|
+
const f = this._camera, O = f.right - f.left, C = f.top - f.bottom, b = 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(b, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
1010
1010
|
}
|
|
1011
1011
|
return Promise.all(a);
|
|
1012
1012
|
}
|
|
@@ -1017,7 +1017,7 @@ class J extends bs {
|
|
|
1017
1017
|
* @category Methods
|
|
1018
1018
|
*/
|
|
1019
1019
|
fitToSphere(e, t) {
|
|
1020
|
-
const s = [], r = "isObject3D" in e ? J.createBoundingSphere(e,
|
|
1020
|
+
const s = [], r = "isObject3D" in e ? J.createBoundingSphere(e, be) : be.copy(e);
|
|
1021
1021
|
if (s.push(
|
|
1022
1022
|
this.moveTo(
|
|
1023
1023
|
r.center.x,
|
|
@@ -1028,7 +1028,7 @@ class J extends bs {
|
|
|
1028
1028
|
), Y(this._camera)) {
|
|
1029
1029
|
const o = this.getDistanceToFitSphere(r.radius);
|
|
1030
1030
|
s.push(this.dollyTo(o, t));
|
|
1031
|
-
} else if (
|
|
1031
|
+
} else if (H(this._camera)) {
|
|
1032
1032
|
const o = this._camera.right - this._camera.left, n = this._camera.top - this._camera.bottom, a = 2 * r.radius, h = Math.min(o / a, n / a);
|
|
1033
1033
|
s.push(this.zoomTo(h, t));
|
|
1034
1034
|
}
|
|
@@ -1047,7 +1047,7 @@ class J extends bs {
|
|
|
1047
1047
|
*/
|
|
1048
1048
|
setLookAt(e, t, s, i, r, o, n = !1) {
|
|
1049
1049
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
|
|
1050
|
-
const a = L.set(i, r, o), h =
|
|
1050
|
+
const a = L.set(i, r, o), h = w.set(e, t, s);
|
|
1051
1051
|
this._targetEnd.copy(a), this._sphericalEnd.setFromVector3(
|
|
1052
1052
|
h.sub(a).applyQuaternion(this._yAxisUpSpace)
|
|
1053
1053
|
), this.normalizeRotations(), this._needsUpdate = !0, n || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
@@ -1086,7 +1086,7 @@ class J extends bs {
|
|
|
1086
1086
|
*/
|
|
1087
1087
|
lerpLookAt(e, t, s, i, r, o, n, a, h, m, p, v, _, u = !1) {
|
|
1088
1088
|
this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = K.NONE, this._changedDolly = 0;
|
|
1089
|
-
const g =
|
|
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
|
);
|
|
@@ -1094,9 +1094,9 @@ class J extends bs {
|
|
|
1094
1094
|
ae.setFromVector3(
|
|
1095
1095
|
f.sub(l).applyQuaternion(this._yAxisUpSpace)
|
|
1096
1096
|
), this._targetEnd.copy(g.lerp(l, _));
|
|
1097
|
-
const O = ae.theta - k.theta, C = ae.phi - k.phi,
|
|
1097
|
+
const O = ae.theta - k.theta, C = ae.phi - k.phi, b = ae.radius - k.radius;
|
|
1098
1098
|
this._sphericalEnd.set(
|
|
1099
|
-
k.radius +
|
|
1099
|
+
k.radius + b * _,
|
|
1100
1100
|
k.phi + C * _,
|
|
1101
1101
|
k.theta + O * _
|
|
1102
1102
|
), this.normalizeRotations(), this._needsUpdate = !0, u || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
|
|
@@ -1145,7 +1145,7 @@ class J extends bs {
|
|
|
1145
1145
|
* @category Methods
|
|
1146
1146
|
*/
|
|
1147
1147
|
setTarget(e, t, s, i = !1) {
|
|
1148
|
-
const r = this.getPosition(
|
|
1148
|
+
const r = this.getPosition(w), o = this.setLookAt(
|
|
1149
1149
|
r.x,
|
|
1150
1150
|
r.y,
|
|
1151
1151
|
r.z,
|
|
@@ -1195,8 +1195,8 @@ class J extends bs {
|
|
|
1195
1195
|
*/
|
|
1196
1196
|
setOrbitPoint(e, t, s) {
|
|
1197
1197
|
this._camera.updateMatrixWorld(), F.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), N.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Z.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
|
|
1198
|
-
const i =
|
|
1199
|
-
F.multiplyScalar(o.x), N.multiplyScalar(o.y), Z.multiplyScalar(o.z),
|
|
1198
|
+
const i = w.set(e, t, s), r = i.distanceTo(this._camera.position), o = i.sub(this._camera.position);
|
|
1199
|
+
F.multiplyScalar(o.x), N.multiplyScalar(o.y), Z.multiplyScalar(o.z), w.copy(F).add(N).add(Z), w.z = w.z + r, this.dollyTo(r, !1), this.setFocalOffset(-w.x, w.y, -w.z, !1), this.moveTo(e, t, s, !1);
|
|
1200
1200
|
}
|
|
1201
1201
|
/**
|
|
1202
1202
|
* Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
|
|
@@ -1311,7 +1311,7 @@ class J extends bs {
|
|
|
1311
1311
|
reset(e = !1) {
|
|
1312
1312
|
if (!P(this._camera.up.x, this._cameraUp0.x) || !P(this._camera.up.y, this._cameraUp0.y) || !P(this._camera.up.z, this._cameraUp0.z)) {
|
|
1313
1313
|
this._camera.up.copy(this._cameraUp0);
|
|
1314
|
-
const s = this.getPosition(
|
|
1314
|
+
const s = this.getPosition(w);
|
|
1315
1315
|
this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
|
|
1316
1316
|
}
|
|
1317
1317
|
const t = [
|
|
@@ -1355,9 +1355,9 @@ class J extends bs {
|
|
|
1355
1355
|
* @category Methods
|
|
1356
1356
|
*/
|
|
1357
1357
|
applyCameraUp() {
|
|
1358
|
-
const e =
|
|
1358
|
+
const e = w.subVectors(this._target, this._camera.position).normalize(), t = L.crossVectors(e, this._camera.up);
|
|
1359
1359
|
this._camera.up.crossVectors(t, e).normalize(), this._camera.updateMatrixWorld();
|
|
1360
|
-
const s = this.getPosition(
|
|
1360
|
+
const s = this.getPosition(w);
|
|
1361
1361
|
this.updateCameraUp(), this.setPosition(s.x, s.y, s.z);
|
|
1362
1362
|
}
|
|
1363
1363
|
/**
|
|
@@ -1368,7 +1368,7 @@ class J extends bs {
|
|
|
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 = Ve.subVectors(this._targetEnd, this._target), o = Ye.subVectors(
|
|
1372
1372
|
this._focalOffsetEnd,
|
|
1373
1373
|
this._focalOffset
|
|
1374
1374
|
), n = this._zoomEnd - this._zoom;
|
|
@@ -1454,7 +1454,7 @@ class J extends bs {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
if (this.dollyToCursor) {
|
|
1456
1456
|
if (Y(this._camera) && this._changedDolly !== 0) {
|
|
1457
|
-
const p = this._spherical.radius - this._lastDistance, v = this._camera, _ = this._getCameraDirection(ne), u =
|
|
1457
|
+
const p = this._spherical.radius - this._lastDistance, v = this._camera, _ = this._getCameraDirection(ne), u = w.copy(_).cross(v.up).normalize();
|
|
1458
1458
|
u.lengthSq() === 0 && (u.x = 1);
|
|
1459
1459
|
const g = L.crossVectors(u, _), y = this._sphericalEnd.radius * Math.tan(v.getEffectiveFOV() * ie * 0.5), f = (this._sphericalEnd.radius - p - this._sphericalEnd.radius) / this._sphericalEnd.radius, O = G.copy(this._targetEnd).add(
|
|
1460
1460
|
u.multiplyScalar(
|
|
@@ -1462,8 +1462,8 @@ class J extends bs {
|
|
|
1462
1462
|
)
|
|
1463
1463
|
).add(
|
|
1464
1464
|
g.multiplyScalar(this._dollyControlCoord.y * y)
|
|
1465
|
-
), C =
|
|
1466
|
-
if (this.infinityDolly && (
|
|
1465
|
+
), C = w.copy(this._targetEnd).lerp(O, f), b = this._lastDollyDirection === K.IN && this._spherical.radius <= this.minDistance, E = this._lastDollyDirection === K.OUT && this.maxDistance <= this._spherical.radius;
|
|
1466
|
+
if (this.infinityDolly && (b || E)) {
|
|
1467
1467
|
this._sphericalEnd.radius -= p, this._spherical.radius -= p;
|
|
1468
1468
|
const D = L.copy(_).multiplyScalar(-p);
|
|
1469
1469
|
C.add(D);
|
|
@@ -1471,13 +1471,13 @@ class J extends bs {
|
|
|
1471
1471
|
this._boundary.clampPoint(C, C);
|
|
1472
1472
|
const x = L.subVectors(C, this._targetEnd);
|
|
1473
1473
|
this._targetEnd.copy(C), this._target.add(x), this._changedDolly -= p, S(this._changedDolly) && (this._changedDolly = 0);
|
|
1474
|
-
} else if (
|
|
1475
|
-
const p = this._zoom - this._lastZoom, v = this._camera, _ =
|
|
1474
|
+
} else if (H(this._camera) && this._changedZoom !== 0) {
|
|
1475
|
+
const p = this._zoom - this._lastZoom, v = this._camera, _ = w.set(
|
|
1476
1476
|
this._dollyControlCoord.x,
|
|
1477
1477
|
this._dollyControlCoord.y,
|
|
1478
1478
|
(v.near + v.far) / (v.near - v.far)
|
|
1479
|
-
).unproject(v), u = L.set(0, 0, -1).applyQuaternion(v.quaternion), g = G.copy(_).add(u.multiplyScalar(-_.dot(v.up))), l = -(this._zoom - p - this._zoom) / this._zoom, f = this._getCameraDirection(ne), O = this._targetEnd.dot(f), C =
|
|
1480
|
-
|
|
1479
|
+
).unproject(v), u = L.set(0, 0, -1).applyQuaternion(v.quaternion), g = G.copy(_).add(u.multiplyScalar(-_.dot(v.up))), l = -(this._zoom - p - this._zoom) / this._zoom, f = this._getCameraDirection(ne), O = this._targetEnd.dot(f), C = w.copy(this._targetEnd).lerp(g, l), b = C.dot(f), E = f.multiplyScalar(
|
|
1480
|
+
b - O
|
|
1481
1481
|
);
|
|
1482
1482
|
C.sub(E), this._boundary.clampPoint(C, C);
|
|
1483
1483
|
const x = L.subVectors(C, this._targetEnd);
|
|
@@ -1486,9 +1486,9 @@ class J extends bs {
|
|
|
1486
1486
|
}
|
|
1487
1487
|
this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
|
|
1488
1488
|
const a = this._collisionTest();
|
|
1489
|
-
this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!S(this._focalOffset.x) || !S(this._focalOffset.y) || !S(this._focalOffset.z)) && (F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), Z.setFromMatrixColumn(this._camera.matrix, 2), F.multiplyScalar(this._focalOffset.x), N.multiplyScalar(-this._focalOffset.y), Z.multiplyScalar(this._focalOffset.z),
|
|
1489
|
+
this._spherical.radius = Math.min(this._spherical.radius, a), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!S(this._focalOffset.x) || !S(this._focalOffset.y) || !S(this._focalOffset.z)) && (F.setFromMatrixColumn(this._camera.matrix, 0), N.setFromMatrixColumn(this._camera.matrix, 1), Z.setFromMatrixColumn(this._camera.matrix, 2), F.multiplyScalar(this._focalOffset.x), N.multiplyScalar(-this._focalOffset.y), Z.multiplyScalar(this._focalOffset.z), w.copy(F).add(N).add(Z), this._camera.position.add(w), this._camera.updateMatrixWorld()), this._boundaryEnclosesCamera && this._encloseToBoundary(
|
|
1490
1490
|
this._camera.position.copy(this._target),
|
|
1491
|
-
|
|
1491
|
+
w.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),
|
|
1492
1492
|
1
|
|
1493
1493
|
);
|
|
1494
1494
|
const m = this._needsUpdate;
|
|
@@ -1515,7 +1515,7 @@ class J extends bs {
|
|
|
1515
1515
|
truckSpeed: this.truckSpeed,
|
|
1516
1516
|
dollyToCursor: this.dollyToCursor,
|
|
1517
1517
|
target: this._targetEnd.toArray(),
|
|
1518
|
-
position:
|
|
1518
|
+
position: w.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),
|
|
1519
1519
|
zoom: this._zoomEnd,
|
|
1520
1520
|
focalOffset: this._focalOffsetEnd.toArray(),
|
|
1521
1521
|
target0: this._target0.toArray(),
|
|
@@ -1533,7 +1533,7 @@ class J extends bs {
|
|
|
1533
1533
|
fromJSON(e, t = !1) {
|
|
1534
1534
|
const s = JSON.parse(e);
|
|
1535
1535
|
this.enabled = s.enabled, this.minDistance = s.minDistance, this.maxDistance = oe(s.maxDistance), this.minZoom = s.minZoom, this.maxZoom = oe(s.maxZoom), this.minPolarAngle = s.minPolarAngle, this.maxPolarAngle = oe(s.maxPolarAngle), this.minAzimuthAngle = oe(s.minAzimuthAngle), this.maxAzimuthAngle = oe(s.maxAzimuthAngle), this.smoothTime = s.smoothTime, this.draggingSmoothTime = s.draggingSmoothTime, this.dollySpeed = s.dollySpeed, this.truckSpeed = s.truckSpeed, this.dollyToCursor = s.dollyToCursor, this._target0.fromArray(s.target0), this._position0.fromArray(s.position0), this._zoom0 = s.zoom0, this._focalOffset0.fromArray(s.focalOffset0), this.moveTo(s.target[0], s.target[1], s.target[2], t), k.setFromVector3(
|
|
1536
|
-
|
|
1536
|
+
w.fromArray(s.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)
|
|
1537
1537
|
), this.rotateTo(k.theta, k.phi, t), this.dollyTo(k.radius, t), this.zoomTo(s.zoom, t), this.setFocalOffset(
|
|
1538
1538
|
s.focalOffset[0],
|
|
1539
1539
|
s.focalOffset[1],
|
|
@@ -1606,7 +1606,7 @@ class J extends bs {
|
|
|
1606
1606
|
if (Y(this._camera)) {
|
|
1607
1607
|
const e = this._camera, t = e.near, s = e.getEffectiveFOV() * ie, i = Math.tan(s * 0.5) * t, r = i * e.aspect;
|
|
1608
1608
|
this._nearPlaneCorners[0].set(-r, -i, 0), this._nearPlaneCorners[1].set(r, -i, 0), this._nearPlaneCorners[2].set(r, i, 0), this._nearPlaneCorners[3].set(-r, i, 0);
|
|
1609
|
-
} else if (
|
|
1609
|
+
} else if (H(this._camera)) {
|
|
1610
1610
|
const e = this._camera, t = 1 / e.zoom, s = e.left * t, i = e.right * t, r = e.top * t, o = e.bottom * t;
|
|
1611
1611
|
this._nearPlaneCorners[0].set(s, r, 0), this._nearPlaneCorners[1].set(i, r, 0), this._nearPlaneCorners[2].set(i, o, 0), this._nearPlaneCorners[3].set(s, o, 0);
|
|
1612
1612
|
}
|
|
@@ -1617,7 +1617,7 @@ class J extends bs {
|
|
|
1617
1617
|
if (!(this.colliderMeshes.length >= 1) || Ee(this._camera, "_collisionTest"))
|
|
1618
1618
|
return e;
|
|
1619
1619
|
const s = this._getTargetDirection(ne);
|
|
1620
|
-
xe.lookAt(
|
|
1620
|
+
xe.lookAt(Be, 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(xe);
|
|
@@ -1703,11 +1703,11 @@ class J extends bs {
|
|
|
1703
1703
|
a.applyMatrix4(n.matrixWorld);
|
|
1704
1704
|
const m = a.attributes.position;
|
|
1705
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 Se = { exports: {} }, Q = typeof Reflect == "object" ? Reflect : null, Ke = Q && typeof Q.apply == "function" ? Q.apply : function(e, t, s) {
|
|
1711
1711
|
return Function.prototype.apply.call(e, t, s);
|
|
1712
1712
|
}, ue;
|
|
1713
1713
|
Q && typeof Q.ownKeys == "function" ? ue = Q.ownKeys : Object.getOwnPropertySymbols ? ue = function(e) {
|
|
@@ -1724,13 +1724,13 @@ var ut = Number.isNaN || function(e) {
|
|
|
1724
1724
|
function A() {
|
|
1725
1725
|
A.init.call(this);
|
|
1726
1726
|
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1727
|
+
Se.exports = A;
|
|
1728
|
+
Se.exports.once = Ms;
|
|
1729
1729
|
A.EventEmitter = A;
|
|
1730
1730
|
A.prototype._events = void 0;
|
|
1731
1731
|
A.prototype._eventsCount = 0;
|
|
1732
1732
|
A.prototype._maxListeners = void 0;
|
|
1733
|
-
var
|
|
1733
|
+
var $e = 10;
|
|
1734
1734
|
function ge(c) {
|
|
1735
1735
|
if (typeof c != "function")
|
|
1736
1736
|
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof c);
|
|
@@ -1738,12 +1738,12 @@ function ge(c) {
|
|
|
1738
1738
|
Object.defineProperty(A, "defaultMaxListeners", {
|
|
1739
1739
|
enumerable: !0,
|
|
1740
1740
|
get: function() {
|
|
1741
|
-
return
|
|
1741
|
+
return $e;
|
|
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
|
+
$e = c;
|
|
1747
1747
|
}
|
|
1748
1748
|
});
|
|
1749
1749
|
A.init = function() {
|
|
@@ -1778,10 +1778,10 @@ A.prototype.emit = function(e) {
|
|
|
1778
1778
|
if (a === void 0)
|
|
1779
1779
|
return !1;
|
|
1780
1780
|
if (typeof a == "function")
|
|
1781
|
-
|
|
1781
|
+
Ke(a, this, t);
|
|
1782
1782
|
else
|
|
1783
1783
|
for (var h = a.length, m = Ct(a, h), s = 0; s < h; ++s)
|
|
1784
|
-
|
|
1784
|
+
Ke(m[s], this, t);
|
|
1785
1785
|
return !0;
|
|
1786
1786
|
};
|
|
1787
1787
|
function _t(c, e, t, s) {
|
|
@@ -1930,7 +1930,7 @@ function Ot(c, e, t, s) {
|
|
|
1930
1930
|
else
|
|
1931
1931
|
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof c);
|
|
1932
1932
|
}
|
|
1933
|
-
var ye =
|
|
1933
|
+
var ye = Se.exports;
|
|
1934
1934
|
let Et = class {
|
|
1935
1935
|
constructor() {
|
|
1936
1936
|
this.mask = 1;
|
|
@@ -2001,7 +2001,7 @@ const Tt = {
|
|
|
2001
2001
|
fov: 45,
|
|
2002
2002
|
near: 1,
|
|
2003
2003
|
far: 1e3,
|
|
2004
|
-
up: new
|
|
2004
|
+
up: new I(0, 1, 0)
|
|
2005
2005
|
};
|
|
2006
2006
|
class Rs extends ee {
|
|
2007
2007
|
constructor(e) {
|
|
@@ -2222,26 +2222,26 @@ 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 Fe(this.material) : this._fsQuad && (this._fsQuad = new Fe(this.material));
|
|
2226
2226
|
}
|
|
2227
2227
|
}
|
|
2228
|
-
const Fs = new
|
|
2228
|
+
const Fs = new jt({ color: "black" }), Ns = new ot({
|
|
2229
2229
|
color: "black",
|
|
2230
2230
|
sizeAttenuation: !1
|
|
2231
|
-
}),
|
|
2231
|
+
}), js = new ot({
|
|
2232
2232
|
color: "black",
|
|
2233
2233
|
sizeAttenuation: !0
|
|
2234
|
-
}),
|
|
2234
|
+
}), Is = new nt({
|
|
2235
2235
|
color: "black",
|
|
2236
2236
|
sizeAttenuation: !0
|
|
2237
|
-
}),
|
|
2237
|
+
}), Hs = new nt({
|
|
2238
2238
|
color: "black",
|
|
2239
2239
|
sizeAttenuation: !1
|
|
2240
2240
|
}), Bs = new pt({
|
|
2241
2241
|
color: "black",
|
|
2242
2242
|
sizeAttenuation: !1,
|
|
2243
2243
|
lineWidth: 0
|
|
2244
|
-
}),
|
|
2244
|
+
}), Ge = new It(0), Vs = {
|
|
2245
2245
|
kernelRadius: 8,
|
|
2246
2246
|
minDistance: 5e-3,
|
|
2247
2247
|
maxDistance: 0.1
|
|
@@ -2256,7 +2256,7 @@ const Fs = new It({ color: "black" }), Ns = new ot({
|
|
|
2256
2256
|
};
|
|
2257
2257
|
class Ws {
|
|
2258
2258
|
constructor(e) {
|
|
2259
|
-
this.bloomComposerActive = !1, this.active = !0, this.bloomSelection = /* @__PURE__ */ new Set(), this.bloomLayer = new
|
|
2259
|
+
this.bloomComposerActive = !1, this.active = !0, this.bloomSelection = /* @__PURE__ */ new Set(), this.bloomLayer = new Ht(), this.bloomMaterials = {}, this.bloomVisible = {}, this.bloomComposerRenderIng = !1, this.pipViewportState = null, this.options = e;
|
|
2260
2260
|
const {
|
|
2261
2261
|
rendererController: t,
|
|
2262
2262
|
sceneController: s,
|
|
@@ -2271,7 +2271,7 @@ class Ws {
|
|
|
2271
2271
|
samples: Math.min(n, a),
|
|
2272
2272
|
type: Vt
|
|
2273
2273
|
}
|
|
2274
|
-
), p = new
|
|
2274
|
+
), p = new ze(o, m), v = this.getSize();
|
|
2275
2275
|
p.setSize(v.width, v.height);
|
|
2276
2276
|
const _ = new hs(
|
|
2277
2277
|
s.scene,
|
|
@@ -2308,7 +2308,7 @@ class Ws {
|
|
|
2308
2308
|
s
|
|
2309
2309
|
);
|
|
2310
2310
|
this.bloomPass = n;
|
|
2311
|
-
const a = new
|
|
2311
|
+
const a = new ze(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);
|
|
@@ -2345,20 +2345,20 @@ class Ws {
|
|
|
2345
2345
|
e.push(o);
|
|
2346
2346
|
return;
|
|
2347
2347
|
}
|
|
2348
|
-
this.bloomMaterials[o.uuid] = o.material, n.isSprite ? n.material.sizeAttenuation ? n.material =
|
|
2348
|
+
this.bloomMaterials[o.uuid] = o.material, n.isSprite ? n.material.sizeAttenuation ? n.material = Is : n.material = Hs : o.material instanceof pt ? o.material = Bs : a.isPoints ? a.material.sizeAttenuation ? a.material = js : a.material = Ns : o.material = Fs;
|
|
2349
2349
|
}
|
|
2350
2350
|
});
|
|
2351
2351
|
}), e.forEach((i) => {
|
|
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 = Ge;
|
|
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 === Ge) {
|
|
2362
2362
|
const e = this.scene.userData._backgroundOriginal;
|
|
2363
2363
|
e && (this.scene.background = e, delete this.scene.userData._backgroundOriginal);
|
|
2364
2364
|
}
|
|
@@ -2400,7 +2400,7 @@ class Ks extends ee {
|
|
|
2400
2400
|
super(), this.autoRotateSpeed = 0, this.options = e;
|
|
2401
2401
|
const t = {
|
|
2402
2402
|
Vector2: B,
|
|
2403
|
-
Vector3:
|
|
2403
|
+
Vector3: I,
|
|
2404
2404
|
Vector4: Zt,
|
|
2405
2405
|
Quaternion: at,
|
|
2406
2406
|
Matrix4: W,
|
|
@@ -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
|
|
2445
|
+
const q = new I(), Xe = new W(), qe = new W(), Qe = new I(), Je = new I();
|
|
2446
2446
|
class $s {
|
|
2447
2447
|
/**
|
|
2448
2448
|
* Constructs a new CSS2D renderer.
|
|
@@ -2461,7 +2461,7 @@ 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(), Xe.copy(g.matrixWorldInverse), qe.multiplyMatrices(g.projectionMatrix, Xe), m(u, u, g), this.sortObjects && _(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
|
};
|
|
@@ -2476,7 +2476,7 @@ class $s {
|
|
|
2476
2476
|
return;
|
|
2477
2477
|
}
|
|
2478
2478
|
if (u.isCSS2DObject) {
|
|
2479
|
-
q.setFromMatrixPosition(u.matrixWorld), q.applyMatrix4(
|
|
2479
|
+
q.setFromMatrixPosition(u.matrixWorld), q.applyMatrix4(qe);
|
|
2480
2480
|
const l = q.z >= -1 && q.z <= 1 && u.layers.test(y.layers) === !0, f = u.element;
|
|
2481
2481
|
f.style.display = l === !0 ? "" : "none", l === !0 && (u.onBeforeRender(t, g, y), f.style.transform = "translate(" + -100 * u.center.x + "%," + -100 * u.center.y + "%)translate(" + (q.x * r + r) + "px," + (-q.y * o + o) + "px)", f.parentNode !== a && a.appendChild(f), u.onAfterRender(t, g, y));
|
|
2482
2482
|
const O = {
|
|
@@ -2488,7 +2488,7 @@ class $s {
|
|
|
2488
2488
|
m(u.children[l], g, y);
|
|
2489
2489
|
}
|
|
2490
2490
|
function p(u, g) {
|
|
2491
|
-
return
|
|
2491
|
+
return Qe.setFromMatrixPosition(u.matrixWorld), Je.setFromMatrixPosition(g.matrixWorld), Qe.distanceToSquared(Je);
|
|
2492
2492
|
}
|
|
2493
2493
|
function v(u) {
|
|
2494
2494
|
const g = [];
|
|
@@ -2508,7 +2508,7 @@ class $s {
|
|
|
2508
2508
|
}
|
|
2509
2509
|
}
|
|
2510
2510
|
}
|
|
2511
|
-
const
|
|
2511
|
+
const et = new I(), Gs = new at(), tt = new I(), j = new W(), Xs = new W();
|
|
2512
2512
|
class qs {
|
|
2513
2513
|
/**
|
|
2514
2514
|
* Constructs a new CSS3D renderer.
|
|
@@ -2536,7 +2536,7 @@ class qs {
|
|
|
2536
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
2537
|
let O, C;
|
|
2538
2538
|
l.isOrthographicCamera && (O = -(l.right + l.left) / 2, C = (l.top + l.bottom) / 2);
|
|
2539
|
-
const
|
|
2539
|
+
const b = l.view && l.view.enabled ? l.view.height / l.view.fullHeight : 1, E = l.isOrthographicCamera ? `scale( ${b} )scale(` + f + ")translate(" + p(O) + "px," + p(C) + "px)" + v(l.matrixWorldInverse) : `scale( ${b} )translateZ(` + f + "px)" + v(l.matrixWorldInverse), D = (l.isPerspectiveCamera ? "perspective(" + f + "px) " : "") + E + "translate(" + r + "px," + o + "px)";
|
|
2540
2540
|
n.camera.style !== D && (m.style.transform = D, n.camera.style = D), g(y, y, l);
|
|
2541
2541
|
}, this.setSize = function(y, l) {
|
|
2542
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";
|
|
@@ -2563,26 +2563,26 @@ class qs {
|
|
|
2563
2563
|
return;
|
|
2564
2564
|
}
|
|
2565
2565
|
if (y.isCSS3DObject) {
|
|
2566
|
-
const C = y.layers.test(f.layers) === !0,
|
|
2567
|
-
if (
|
|
2566
|
+
const C = y.layers.test(f.layers) === !0, b = y.element;
|
|
2567
|
+
if (b.style.display = C === !0 ? "" : "none", C === !0) {
|
|
2568
2568
|
y.onBeforeRender(t, l, f);
|
|
2569
2569
|
let E;
|
|
2570
|
-
y.isCSS3DSprite ? (
|
|
2570
|
+
y.isCSS3DSprite ? (j.copy(f.matrixWorldInverse), j.transpose(), y.rotation2D !== 0 && j.multiply(Xs.makeRotationZ(y.rotation2D)), y.matrixWorld.decompose(et, Gs, tt), j.setPosition(et), j.scale(tt), j.elements[3] = 0, j.elements[7] = 0, j.elements[11] = 0, j.elements[15] = 1, E = _(j)) : E = _(y.matrixWorld);
|
|
2571
2571
|
const x = n.objects.get(y);
|
|
2572
2572
|
if (x === void 0 || x.style !== E) {
|
|
2573
|
-
|
|
2573
|
+
b.style.transform = E;
|
|
2574
2574
|
const D = { style: E };
|
|
2575
2575
|
n.objects.set(y, D);
|
|
2576
2576
|
}
|
|
2577
|
-
|
|
2577
|
+
b.parentNode !== m && m.appendChild(b), y.onAfterRender(t, l, f);
|
|
2578
2578
|
}
|
|
2579
2579
|
}
|
|
2580
|
-
for (let C = 0,
|
|
2580
|
+
for (let C = 0, b = y.children.length; C < b; C++)
|
|
2581
2581
|
g(y.children[C], l, f);
|
|
2582
2582
|
}
|
|
2583
2583
|
}
|
|
2584
2584
|
}
|
|
2585
|
-
const
|
|
2585
|
+
const st = {
|
|
2586
2586
|
zIndex: "auto"
|
|
2587
2587
|
};
|
|
2588
2588
|
class Qs {
|
|
@@ -2615,7 +2615,7 @@ class Js {
|
|
|
2615
2615
|
let i = this.helpers[t];
|
|
2616
2616
|
if (i === void 0) {
|
|
2617
2617
|
if (e.isScene)
|
|
2618
|
-
i = new
|
|
2618
|
+
i = new Re(100);
|
|
2619
2619
|
else if (e.isCamera)
|
|
2620
2620
|
i = new $t(e);
|
|
2621
2621
|
else if (e.isPointLight)
|
|
@@ -2631,7 +2631,7 @@ class Js {
|
|
|
2631
2631
|
else {
|
|
2632
2632
|
const r = new lt();
|
|
2633
2633
|
if (r.setFromObject(e, !0), r.isEmpty() === !1) {
|
|
2634
|
-
i = new
|
|
2634
|
+
i = new Ue(r);
|
|
2635
2635
|
const o = i.material;
|
|
2636
2636
|
o.userData.object = e, o.depthTest = !1, o.transparent = !0;
|
|
2637
2637
|
} else
|
|
@@ -2663,7 +2663,7 @@ class Js {
|
|
|
2663
2663
|
}
|
|
2664
2664
|
removeAllExcludeScene() {
|
|
2665
2665
|
Object.keys(this.helpers).forEach((e) => {
|
|
2666
|
-
this.helpers[e] instanceof
|
|
2666
|
+
this.helpers[e] instanceof Re || this.remove({
|
|
2667
2667
|
uuid: e
|
|
2668
2668
|
});
|
|
2669
2669
|
});
|
|
@@ -2672,7 +2672,7 @@ class Js {
|
|
|
2672
2672
|
var r, o;
|
|
2673
2673
|
const { cameraController: i } = this.options;
|
|
2674
2674
|
Object.values(this.helpers).forEach((n) => {
|
|
2675
|
-
if (n.update && n.update(), n instanceof
|
|
2675
|
+
if (n.update && n.update(), n instanceof Ue) {
|
|
2676
2676
|
const a = n.material, { object: h } = a.userData;
|
|
2677
2677
|
h && n.box.setFromObject(h, !0);
|
|
2678
2678
|
}
|
|
@@ -2691,9 +2691,9 @@ class Js {
|
|
|
2691
2691
|
this.helpers = {}, (e = this.viewHelper) == null || e.dispose();
|
|
2692
2692
|
}
|
|
2693
2693
|
}
|
|
2694
|
-
function
|
|
2694
|
+
function Le(c) {
|
|
2695
2695
|
let e = !1, t = [];
|
|
2696
|
-
return
|
|
2696
|
+
return (...s) => {
|
|
2697
2697
|
t = s, e || (e = !0, requestAnimationFrame(() => {
|
|
2698
2698
|
e = !1, c(...t);
|
|
2699
2699
|
}));
|
|
@@ -2705,7 +2705,7 @@ class ei {
|
|
|
2705
2705
|
this.enabled = !0, this.pickFunctionsMap = /* @__PURE__ */ new Map(), this.pickNodeFunctionsMap = /* @__PURE__ */ new Map(), this.pickFunctionsMapIndex = -1, this.pickNodeFunctionsMapIndex = -1, this.activeObjects = /* @__PURE__ */ new Set(), this.activeObject = null, this.prevActiveObjects = /* @__PURE__ */ new Set(), this.objCallbackMap = /* @__PURE__ */ new Map(), this.pickListener = {
|
|
2706
2706
|
move: !1,
|
|
2707
2707
|
down: !1
|
|
2708
|
-
}, this.pencil = e, this.domElement = ((t = e.options.controls) == null ? void 0 : t.domElement) || e.options.container;
|
|
2708
|
+
}, this.cursorObjects = /* @__PURE__ */ new Map(), this.cursorListenerAdded = !1, this.pencil = e, this.domElement = ((t = e.options.controls) == null ? void 0 : t.domElement) || e.options.container;
|
|
2709
2709
|
}
|
|
2710
2710
|
addPickListener(e) {
|
|
2711
2711
|
const t = /* @__PURE__ */ new Set(["move", "enter", "leave"]), s = /* @__PURE__ */ new Set(["down", "downOutside", "click"]), i = (r) => {
|
|
@@ -2741,7 +2741,7 @@ class ei {
|
|
|
2741
2741
|
};
|
|
2742
2742
|
this.domElement.addEventListener(
|
|
2743
2743
|
`pointer${e}`,
|
|
2744
|
-
|
|
2744
|
+
Le(i),
|
|
2745
2745
|
{ passive: !1 }
|
|
2746
2746
|
);
|
|
2747
2747
|
}
|
|
@@ -2839,6 +2839,59 @@ class ei {
|
|
|
2839
2839
|
});
|
|
2840
2840
|
});
|
|
2841
2841
|
}
|
|
2842
|
+
/** 重置鼠标样式 */
|
|
2843
|
+
resetCursor() {
|
|
2844
|
+
this.domElement.style.cursor = "";
|
|
2845
|
+
}
|
|
2846
|
+
/** 添加 cursor 检测监听器 */
|
|
2847
|
+
addCursorListener() {
|
|
2848
|
+
if (this.cursorListenerAdded) return;
|
|
2849
|
+
this.cursorListenerAdded = !0;
|
|
2850
|
+
const e = (t) => {
|
|
2851
|
+
var o;
|
|
2852
|
+
if (!this.enabled)
|
|
2853
|
+
return;
|
|
2854
|
+
this.cursorObjects.size === 0 && this.resetCursor();
|
|
2855
|
+
const s = [...this.cursorObjects.keys()].filter((n) => n.object3d && n.visibleWithAncestors).map((n) => n.object3d);
|
|
2856
|
+
if (s.length === 0) {
|
|
2857
|
+
this.resetCursor();
|
|
2858
|
+
return;
|
|
2859
|
+
}
|
|
2860
|
+
const i = this.pencil.pick(t, s, !0);
|
|
2861
|
+
if (!((o = i == null ? void 0 : i.intersects) != null && o.length)) {
|
|
2862
|
+
this.resetCursor();
|
|
2863
|
+
return;
|
|
2864
|
+
}
|
|
2865
|
+
let r = i.intersects[0].object;
|
|
2866
|
+
for (; r; ) {
|
|
2867
|
+
const n = this.pencil.lead.objMap.get(r);
|
|
2868
|
+
if (n && this.cursorObjects.has(n)) {
|
|
2869
|
+
this.domElement.style.cursor = this.cursorObjects.get(n);
|
|
2870
|
+
return;
|
|
2871
|
+
}
|
|
2872
|
+
r = r.parent;
|
|
2873
|
+
}
|
|
2874
|
+
this.resetCursor();
|
|
2875
|
+
};
|
|
2876
|
+
this.domElement.addEventListener("pointermove", Le(e), {
|
|
2877
|
+
passive: !0
|
|
2878
|
+
});
|
|
2879
|
+
}
|
|
2880
|
+
/**
|
|
2881
|
+
* 启用物体的 cursor 检测
|
|
2882
|
+
* @param obj 要检测的 BaseObject
|
|
2883
|
+
* @param cursor 鼠标样式,默认 'pointer'
|
|
2884
|
+
*/
|
|
2885
|
+
enableCursor(e, t = "pointer") {
|
|
2886
|
+
this.cursorObjects.set(e, t), this.addCursorListener();
|
|
2887
|
+
}
|
|
2888
|
+
/**
|
|
2889
|
+
* 禁用物体的 cursor 检测
|
|
2890
|
+
* @param obj 要移除的 BaseObject
|
|
2891
|
+
*/
|
|
2892
|
+
disableCursor(e) {
|
|
2893
|
+
this.cursorObjects.delete(e);
|
|
2894
|
+
}
|
|
2842
2895
|
handlePick(e, t, s) {
|
|
2843
2896
|
let i = t;
|
|
2844
2897
|
i === "mousemove" ? i = "move" : i === "mouseenter" ? i = "enter" : i === "mouseleave" && (i = "leave"), this.pickFunctionsMapIndex += 1;
|
|
@@ -2866,7 +2919,7 @@ class ei {
|
|
|
2866
2919
|
mouseEvent: p
|
|
2867
2920
|
}));
|
|
2868
2921
|
}, m = `pointer${t}`;
|
|
2869
|
-
a.element.addEventListener(m,
|
|
2922
|
+
a.element.addEventListener(m, Le(h), !1), o.push({ arr: a, type: m, listener: h });
|
|
2870
2923
|
}
|
|
2871
2924
|
return this.pickNodeFunctionsMap.set(i, o), i;
|
|
2872
2925
|
}
|
|
@@ -2883,7 +2936,7 @@ class ei {
|
|
|
2883
2936
|
}
|
|
2884
2937
|
}
|
|
2885
2938
|
dispose() {
|
|
2886
|
-
this.pickFunctionsMap.clear(), this.pickNodeFunctionsMap.clear(), this.activeObjects.clear(), this.prevActiveObjects.clear(), this.objCallbackMap.clear();
|
|
2939
|
+
this.pickFunctionsMap.clear(), this.pickNodeFunctionsMap.clear(), this.activeObjects.clear(), this.prevActiveObjects.clear(), this.objCallbackMap.clear(), this.cursorObjects.clear();
|
|
2887
2940
|
}
|
|
2888
2941
|
}
|
|
2889
2942
|
class ti extends ei {
|
|
@@ -2892,12 +2945,12 @@ class ti extends ei {
|
|
|
2892
2945
|
key: "@Scene",
|
|
2893
2946
|
name: "场景",
|
|
2894
2947
|
mList: !1
|
|
2895
|
-
}), this.group = this.createBaseObject(new
|
|
2948
|
+
}), this.group = this.createBaseObject(new ke(), {
|
|
2896
2949
|
key: "@Group",
|
|
2897
2950
|
name: "物体组",
|
|
2898
2951
|
target: this.scene,
|
|
2899
2952
|
mList: !1
|
|
2900
|
-
}), this.prefabGroup = this.createBaseObject(new
|
|
2953
|
+
}), this.prefabGroup = this.createBaseObject(new ke(), {
|
|
2901
2954
|
key: "@PrefabGroup",
|
|
2902
2955
|
name: "预制组",
|
|
2903
2956
|
target: this.scene,
|
|
@@ -3101,7 +3154,7 @@ class ii extends dt {
|
|
|
3101
3154
|
super(e);
|
|
3102
3155
|
}
|
|
3103
3156
|
load(e, t, s, i) {
|
|
3104
|
-
const r = new
|
|
3157
|
+
const r = new Ae(this.manager);
|
|
3105
3158
|
r.setResponseType("blob"), r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
|
|
3106
3159
|
e,
|
|
3107
3160
|
(o) => {
|
|
@@ -3127,7 +3180,7 @@ class it extends dt {
|
|
|
3127
3180
|
load(e, t, s, i) {
|
|
3128
3181
|
let r, o;
|
|
3129
3182
|
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();
|
|
3130
|
-
const n = new
|
|
3183
|
+
const n = new Ae(this.manager);
|
|
3131
3184
|
return n.setResponseType("blob"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
|
|
3132
3185
|
e,
|
|
3133
3186
|
(a) => {
|
|
@@ -3212,15 +3265,15 @@ class oi {
|
|
|
3212
3265
|
if (e === "media")
|
|
3213
3266
|
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;
|
|
3214
3267
|
if (e === "gltf" && (t != null && t.dracoPath))
|
|
3215
|
-
return this.dracoGltfLoader || (this.dracoGltfLoader = new
|
|
3268
|
+
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;
|
|
3216
3269
|
if (e === "gltf")
|
|
3217
|
-
return this.gltfLoader || (this.gltfLoader = new
|
|
3270
|
+
return this.gltfLoader || (this.gltfLoader = new Ne(this.loadingManager), this.options.prefix && this.gltfLoader.setPath(this.options.prefix)), this.gltfLoader;
|
|
3218
3271
|
if (e === "lottie")
|
|
3219
3272
|
return this.lottieLoader || (this.lottieLoader = new Cs(this.loadingManager), this.options.prefix && this.lottieLoader.setPath(this.options.prefix)), this.lottieLoader;
|
|
3220
3273
|
if (e === "gzipJson")
|
|
3221
3274
|
return this.gzipJsonLoader || (this.gzipJsonLoader = new ii(this.loadingManager), this.options.prefix && this.gzipJsonLoader.setPath(this.options.prefix)), this.gzipJsonLoader;
|
|
3222
3275
|
if (e === "json")
|
|
3223
|
-
return this.jsonLoader || (this.jsonLoader = new
|
|
3276
|
+
return this.jsonLoader || (this.jsonLoader = new Ae(this.loadingManager), this.jsonLoader.setResponseType("json"), this.options.prefix && this.jsonLoader.setPath(this.options.prefix)), this.jsonLoader;
|
|
3224
3277
|
if (e === "exr")
|
|
3225
3278
|
return this.exrLoader || (this.exrLoader = new vs(this.loadingManager), this.options.prefix && this.exrLoader.setPath(this.options.prefix)), this.exrLoader;
|
|
3226
3279
|
}
|
|
@@ -3419,7 +3472,7 @@ class li {
|
|
|
3419
3472
|
}
|
|
3420
3473
|
disposeMaterial(e) {
|
|
3421
3474
|
if (!e) return;
|
|
3422
|
-
const t = new
|
|
3475
|
+
const t = new Pe();
|
|
3423
3476
|
t.track(Array.isArray(e) ? e : [e]), t.dispose();
|
|
3424
3477
|
}
|
|
3425
3478
|
remove(e) {
|
|
@@ -3556,7 +3609,7 @@ class li {
|
|
|
3556
3609
|
});
|
|
3557
3610
|
}
|
|
3558
3611
|
dispose() {
|
|
3559
|
-
const e = new
|
|
3612
|
+
const e = new Pe();
|
|
3560
3613
|
e.track([...this.materials.values()]), e.dispose(), this.materials.clear(), this.fixBaseObjects.clear(), this.materialBaseObjectMap.clear();
|
|
3561
3614
|
}
|
|
3562
3615
|
}
|
|
@@ -3649,7 +3702,7 @@ class mi extends ee {
|
|
|
3649
3702
|
}
|
|
3650
3703
|
removePage(e) {
|
|
3651
3704
|
super.removePage(e, (t) => {
|
|
3652
|
-
const s = new
|
|
3705
|
+
const s = new Pe();
|
|
3653
3706
|
s.track(t), s.dispose();
|
|
3654
3707
|
});
|
|
3655
3708
|
}
|
|
@@ -3662,7 +3715,7 @@ class mi extends ee {
|
|
|
3662
3715
|
class ui {
|
|
3663
3716
|
constructor(e) {
|
|
3664
3717
|
this.event = new ye.EventEmitter();
|
|
3665
|
-
const { renderer: t, scene: s, camera: i } = e, r = new
|
|
3718
|
+
const { renderer: t, scene: s, camera: i } = e, r = new bs(
|
|
3666
3719
|
i,
|
|
3667
3720
|
t.domElement
|
|
3668
3721
|
);
|
|
@@ -3754,7 +3807,7 @@ class _i {
|
|
|
3754
3807
|
const _e = class _e {
|
|
3755
3808
|
constructor(e) {
|
|
3756
3809
|
var r, o;
|
|
3757
|
-
this.raycaster = new ht(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new
|
|
3810
|
+
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 = Rt(_e.options, e, {
|
|
3758
3811
|
isMergeableObject: Ts
|
|
3759
3812
|
}), this.userSetDprCache = this.options.renderer.devicePixelRatio;
|
|
3760
3813
|
const {
|
|
@@ -4075,16 +4128,16 @@ _e.options = {
|
|
|
4075
4128
|
loader: ni,
|
|
4076
4129
|
ssaoParams: Vs,
|
|
4077
4130
|
css2DRenderer: !1,
|
|
4078
|
-
css2DRendererParams: U({},
|
|
4131
|
+
css2DRendererParams: U({}, st),
|
|
4079
4132
|
css3DRenderer: !1,
|
|
4080
|
-
css3DRendererParams: U({},
|
|
4133
|
+
css3DRendererParams: U({}, st)
|
|
4081
4134
|
};
|
|
4082
4135
|
let rt = _e;
|
|
4083
4136
|
const Xi = J.ACTION;
|
|
4084
4137
|
export {
|
|
4085
4138
|
ls as BaseObject,
|
|
4086
4139
|
rt as Pencil,
|
|
4087
|
-
|
|
4140
|
+
Pe as ResourceTracker,
|
|
4088
4141
|
Xi as cameraControlsAction,
|
|
4089
4142
|
rt as default
|
|
4090
4143
|
};
|