gl-draw 0.15.13 → 0.15.15
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/constants.d.ts +1 -0
- package/dist/core/Lead/Lead.d.ts +1 -0
- package/dist/index.js +3 -3
- package/dist/index.module.js +78 -73
- package/dist/index.module2.js +132 -130
- package/dist/index2.js +4 -4
- package/dist/objects/index.module.js +28 -28
- package/package.json +1 -1
package/dist/index.module.js
CHANGED
|
@@ -26,13 +26,13 @@ var se = (h, 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(h, e)).next());
|
|
28
28
|
});
|
|
29
|
-
import { WebGLRenderer as Ut, Vector3 as
|
|
29
|
+
import { WebGLRenderer as Ut, Vector3 as I, PerspectiveCamera as zt, Matrix4 as W, Scene as nt, AxesHelper as De, CameraHelper as kt, PointLightHelper as Ft, DirectionalLightHelper as Nt, SpotLightHelper as jt, HemisphereLightHelper as It, Box3 as at, Box3Helper as Ue, MathUtils as Ht, Vector2 as B, Vector4 as Bt, Quaternion as lt, Spherical as Vt, Sphere as Yt, Raycaster as ht, REVISION as Zt, Object3D as Wt, UniformsUtils as Kt, RawShaderMaterial as $t, ShaderMaterial as Gt, MeshBasicMaterial as Xt, PointsMaterial as ct, SpriteMaterial as dt, Layers as qt, WebGLRenderTarget as Qt, HalfFloatType as Jt, Loader as mt, Texture as ue, VideoTexture as pt, FileLoader as Ae, LoadingManager as es, DataTexture as ts, Group as ze } from "three";
|
|
30
30
|
import { Timer as ss } from "three/examples/jsm/misc/Timer";
|
|
31
31
|
import * as Ce from "@tweenjs/tween.js";
|
|
32
32
|
import is from "deepmerge";
|
|
33
33
|
import rs from "stats-gl";
|
|
34
34
|
import { C as os, c as ns, i as as } from "./isPlainObject.module.js";
|
|
35
|
-
import { R as Pe, M as ft, B as ls } from "./index.module2.js";
|
|
35
|
+
import { R as Pe, M as ft, B as Oe, a as ls, I as he } from "./index.module2.js";
|
|
36
36
|
import { RectAreaLightHelper as hs } from "three/examples/jsm/helpers/RectAreaLightHelper";
|
|
37
37
|
import { ViewHelper as cs } from "three/examples/jsm/helpers/ViewHelper";
|
|
38
38
|
import { TransformControls as ds } from "three/examples/jsm/controls/TransformControls";
|
|
@@ -92,10 +92,10 @@ const M = {
|
|
|
92
92
|
function Y(h) {
|
|
93
93
|
return h.isPerspectiveCamera;
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function H(h) {
|
|
96
96
|
return h.isOrthographicCamera;
|
|
97
97
|
}
|
|
98
|
-
const $ = Math.PI * 2,
|
|
98
|
+
const $ = Math.PI * 2, Ie = Math.PI / 2, ut = 1e-5, ie = Math.PI / 180;
|
|
99
99
|
function k(h, e, t) {
|
|
100
100
|
return Math.max(e, Math.min(t, h));
|
|
101
101
|
}
|
|
@@ -105,7 +105,7 @@ function S(h, e = ut) {
|
|
|
105
105
|
function P(h, e, t = ut) {
|
|
106
106
|
return S(h - e, t);
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function He(h, e) {
|
|
109
109
|
return Math.round(h / e) * e;
|
|
110
110
|
}
|
|
111
111
|
function re(h) {
|
|
@@ -114,7 +114,7 @@ function re(h) {
|
|
|
114
114
|
function oe(h) {
|
|
115
115
|
return Math.abs(h) < Number.MAX_VALUE ? h : h * (1 / 0);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function ce(h, e, t, s, i = 1 / 0, r) {
|
|
118
118
|
s = Math.max(1e-4, s);
|
|
119
119
|
const o = 2 / s, n = o * r, a = 1 / (1 + n + 0.48 * n * n + 0.235 * n * n * n);
|
|
120
120
|
let c = h - e;
|
|
@@ -140,13 +140,13 @@ function Be(h, e, t, s, i = 1 / 0, r, o) {
|
|
|
140
140
|
const V = y - h.x, le = l - h.y, bt = _ - h.z, xt = o.x - y, Lt = o.y - l, Pt = o.z - _;
|
|
141
141
|
return V * xt + le * Lt + bt * Pt > 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;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function Ee(h, e) {
|
|
144
144
|
e.set(0, 0), h.forEach((t) => {
|
|
145
145
|
e.x += t.clientX, e.y += t.clientY;
|
|
146
146
|
}), e.x /= h.length, e.y /= h.length;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
return
|
|
148
|
+
function Te(h, e) {
|
|
149
|
+
return H(h) ? (console.warn(`${e} is not supported in OrthographicCamera`), !0) : !1;
|
|
150
150
|
}
|
|
151
151
|
class Os {
|
|
152
152
|
constructor() {
|
|
@@ -212,11 +212,11 @@ class Os {
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
const
|
|
216
|
-
let T, Ve,
|
|
215
|
+
const de = 1 / 8, Es = /Mac/.test(navigator.platform);
|
|
216
|
+
let T, Ve, me, we, D, b, L, G, ne, F, N, Z, Ye, Ze, z, ae, X, We, be, Ke, xe, Le, pe;
|
|
217
217
|
class J extends Os {
|
|
218
218
|
static install(e) {
|
|
219
|
-
T = e.THREE, Ve = Object.freeze(new T.Vector3(0, 0, 0)),
|
|
219
|
+
T = e.THREE, Ve = Object.freeze(new T.Vector3(0, 0, 0)), me = Object.freeze(new T.Vector3(0, 1, 0)), we = Object.freeze(new T.Vector3(0, 0, 1)), D = new T.Vector2(), b = 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(), Ye = new T.Vector3(), Ze = new T.Vector3(), z = new T.Spherical(), ae = new T.Spherical(), X = new T.Box3(), We = new T.Box3(), be = new T.Sphere(), Ke = new T.Quaternion(), xe = new T.Quaternion(), Le = new T.Matrix4(), pe = new T.Raycaster();
|
|
220
220
|
}
|
|
221
221
|
/**
|
|
222
222
|
* list all ACTIONs
|
|
@@ -249,7 +249,7 @@ class J extends Os {
|
|
|
249
249
|
if (Y(this._camera)) {
|
|
250
250
|
const x = b.copy(this._camera.position).sub(this._target), R = this._camera.getEffectiveFOV() * ie, V = x.length() * Math.tan(R * 0.5);
|
|
251
251
|
w = this.truckSpeed * l * V / this._elementRect.height, E = this.truckSpeed * _ * V / this._elementRect.height;
|
|
252
|
-
} else if (
|
|
252
|
+
} else if (H(this._camera)) {
|
|
253
253
|
const x = this._camera;
|
|
254
254
|
w = this.truckSpeed * l * (x.right - x.left) / x.zoom / this._elementRect.width, E = this.truckSpeed * _ * (x.top - x.bottom) / x.zoom / this._elementRect.height;
|
|
255
255
|
} else
|
|
@@ -282,7 +282,7 @@ class J extends Os {
|
|
|
282
282
|
"camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."
|
|
283
283
|
), this._camera = e, this._yAxisUpSpace = new T.Quaternion().setFromUnitVectors(
|
|
284
284
|
this._camera.up,
|
|
285
|
-
|
|
285
|
+
me
|
|
286
286
|
), 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(
|
|
287
287
|
b.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)
|
|
288
288
|
), 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 = [
|
|
@@ -297,10 +297,10 @@ class J extends Os {
|
|
|
297
297
|
left: d.ROTATE,
|
|
298
298
|
middle: d.DOLLY,
|
|
299
299
|
right: d.TRUCK,
|
|
300
|
-
wheel: Y(this._camera) ? d.DOLLY :
|
|
300
|
+
wheel: Y(this._camera) ? d.DOLLY : H(this._camera) ? d.ZOOM : d.NONE
|
|
301
301
|
}, this.touches = {
|
|
302
302
|
one: d.TOUCH_ROTATE,
|
|
303
|
-
two: Y(this._camera) ? d.TOUCH_DOLLY_TRUCK :
|
|
303
|
+
two: Y(this._camera) ? d.TOUCH_DOLLY_TRUCK : H(this._camera) ? d.TOUCH_ZOOM_TRUCK : d.NONE,
|
|
304
304
|
three: d.TOUCH_TRUCK
|
|
305
305
|
};
|
|
306
306
|
const s = new T.Vector2(), i = new T.Vector2(), r = new T.Vector2(), o = (l) => {
|
|
@@ -438,7 +438,7 @@ class J extends Os {
|
|
|
438
438
|
}
|
|
439
439
|
}, v = (l) => {
|
|
440
440
|
if (!this._enabled) return;
|
|
441
|
-
if (
|
|
441
|
+
if (Ee(this._activePointers, D), this._getClientRect(this._elementRect), s.copy(D), i.copy(D), this._activePointers.length >= 2) {
|
|
442
442
|
const O = D.x - this._activePointers[1].clientX, C = D.y - this._activePointers[1].clientY, w = Math.sqrt(O * O + C * C);
|
|
443
443
|
r.set(0, w);
|
|
444
444
|
const E = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5, x = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;
|
|
@@ -463,16 +463,16 @@ class J extends Os {
|
|
|
463
463
|
((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" });
|
|
464
464
|
}, p = () => {
|
|
465
465
|
if (!this._enabled || !this._dragNeedsUpdate) return;
|
|
466
|
-
this._dragNeedsUpdate = !1,
|
|
466
|
+
this._dragNeedsUpdate = !1, Ee(this._activePointers, D);
|
|
467
467
|
const _ = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, O = _ ? -_.deltaX : i.x - D.x, C = _ ? -_.deltaY : i.y - D.y;
|
|
468
468
|
if (i.copy(D), ((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) {
|
|
469
469
|
const w = 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;
|
|
470
470
|
(this._state & d.DOLLY) === d.DOLLY ? (this._dollyInternal(
|
|
471
|
-
x * C *
|
|
471
|
+
x * C * de,
|
|
472
472
|
w,
|
|
473
473
|
E
|
|
474
474
|
), this._isUserControllingDolly = !0) : (this._zoomInternal(
|
|
475
|
-
x * C *
|
|
475
|
+
x * C * de,
|
|
476
476
|
w,
|
|
477
477
|
E
|
|
478
478
|
), this._isUserControllingZoom = !0);
|
|
@@ -481,11 +481,11 @@ class J extends Os {
|
|
|
481
481
|
const w = D.x - this._activePointers[1].clientX, E = D.y - this._activePointers[1].clientY, x = Math.sqrt(w * w + E * E), R = r.y - x;
|
|
482
482
|
r.set(0, x);
|
|
483
483
|
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;
|
|
484
|
-
(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 *
|
|
484
|
+
(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);
|
|
485
485
|
}
|
|
486
486
|
((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" });
|
|
487
487
|
}, f = () => {
|
|
488
|
-
|
|
488
|
+
Ee(this._activePointers, D), i.copy(D), 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(
|
|
489
489
|
"pointermove",
|
|
490
490
|
n,
|
|
491
491
|
{ passive: !1 }
|
|
@@ -986,12 +986,12 @@ class J extends Os {
|
|
|
986
986
|
c.isEmpty() && (console.warn(
|
|
987
987
|
"camera-controls: fitTo() cannot be used with an empty box. Aborting"
|
|
988
988
|
), Promise.resolve());
|
|
989
|
-
const u =
|
|
989
|
+
const u = He(this._sphericalEnd.theta, Ie), m = He(this._sphericalEnd.phi, Ie);
|
|
990
990
|
a.push(this.rotateTo(u, m, t));
|
|
991
|
-
const v = b.setFromSpherical(this._sphericalEnd).normalize(), p = Ke.setFromUnitVectors(v,
|
|
992
|
-
f && p.multiply(
|
|
991
|
+
const v = b.setFromSpherical(this._sphericalEnd).normalize(), p = Ke.setFromUnitVectors(v, we), f = P(Math.abs(v.y), 1);
|
|
992
|
+
f && p.multiply(xe.setFromAxisAngle(me, u)), p.multiply(this._yAxisUpSpaceInverse);
|
|
993
993
|
const g = We.makeEmpty();
|
|
994
|
-
L.copy(c.min).applyQuaternion(p), g.expandByPoint(L), L.copy(c.min).setX(c.max.x).applyQuaternion(p), g.expandByPoint(L), L.copy(c.min).setY(c.max.y).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).setZ(c.min.z).applyQuaternion(p), g.expandByPoint(L), L.copy(c.min).setZ(c.max.z).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).setY(c.min.y).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).setX(c.min.x).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).applyQuaternion(p), g.expandByPoint(L), g.min.x -= i, g.min.y -= o, g.max.x += r, g.max.y += n, p.setFromUnitVectors(
|
|
994
|
+
L.copy(c.min).applyQuaternion(p), g.expandByPoint(L), L.copy(c.min).setX(c.max.x).applyQuaternion(p), g.expandByPoint(L), L.copy(c.min).setY(c.max.y).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).setZ(c.min.z).applyQuaternion(p), g.expandByPoint(L), L.copy(c.min).setZ(c.max.z).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).setY(c.min.y).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).setX(c.min.x).applyQuaternion(p), g.expandByPoint(L), L.copy(c.max).applyQuaternion(p), g.expandByPoint(L), g.min.x -= i, g.min.y -= o, g.max.x += r, g.max.y += n, p.setFromUnitVectors(we, v), f && p.premultiply(xe.invert()), p.premultiply(this._yAxisUpSpace);
|
|
995
995
|
const y = g.getSize(b), l = g.getCenter(L).applyQuaternion(p);
|
|
996
996
|
if (Y(this._camera)) {
|
|
997
997
|
const _ = this.getDistanceToFitBox(
|
|
@@ -1003,7 +1003,7 @@ class J extends Os {
|
|
|
1003
1003
|
a.push(
|
|
1004
1004
|
this.moveTo(l.x, l.y, l.z, t)
|
|
1005
1005
|
), a.push(this.dollyTo(_, t)), a.push(this.setFocalOffset(0, 0, 0, t));
|
|
1006
|
-
} else if (
|
|
1006
|
+
} else if (H(this._camera)) {
|
|
1007
1007
|
const _ = this._camera, O = _.right - _.left, C = _.top - _.bottom, w = s ? Math.max(O / y.x, C / y.y) : Math.min(O / y.x, C / y.y);
|
|
1008
1008
|
a.push(
|
|
1009
1009
|
this.moveTo(l.x, l.y, l.z, t)
|
|
@@ -1018,7 +1018,7 @@ class J extends Os {
|
|
|
1018
1018
|
* @category Methods
|
|
1019
1019
|
*/
|
|
1020
1020
|
fitToSphere(e, t) {
|
|
1021
|
-
const s = [], r = "isObject3D" in e ? J.createBoundingSphere(e,
|
|
1021
|
+
const s = [], r = "isObject3D" in e ? J.createBoundingSphere(e, be) : be.copy(e);
|
|
1022
1022
|
if (s.push(
|
|
1023
1023
|
this.moveTo(
|
|
1024
1024
|
r.center.x,
|
|
@@ -1029,7 +1029,7 @@ class J extends Os {
|
|
|
1029
1029
|
), Y(this._camera)) {
|
|
1030
1030
|
const o = this.getDistanceToFitSphere(r.radius);
|
|
1031
1031
|
s.push(this.dollyTo(o, t));
|
|
1032
|
-
} else if (
|
|
1032
|
+
} else if (H(this._camera)) {
|
|
1033
1033
|
const o = this._camera.right - this._camera.left, n = this._camera.top - this._camera.bottom, a = 2 * r.radius, c = Math.min(o / a, n / a);
|
|
1034
1034
|
s.push(this.zoomTo(c, t));
|
|
1035
1035
|
}
|
|
@@ -1236,7 +1236,7 @@ class J extends Os {
|
|
|
1236
1236
|
* @category Methods
|
|
1237
1237
|
*/
|
|
1238
1238
|
getDistanceToFitBox(e, t, s, i = !1) {
|
|
1239
|
-
if (
|
|
1239
|
+
if (Te(this._camera, "getDistanceToFitBox"))
|
|
1240
1240
|
return this._spherical.radius;
|
|
1241
1241
|
const r = e / t, o = this._camera.getEffectiveFOV() * ie, n = this._camera.aspect;
|
|
1242
1242
|
return ((i ? r > n : r < n) ? t : e / n) * 0.5 / Math.tan(o * 0.5) + s * 0.5;
|
|
@@ -1248,7 +1248,7 @@ class J extends Os {
|
|
|
1248
1248
|
* @category Methods
|
|
1249
1249
|
*/
|
|
1250
1250
|
getDistanceToFitSphere(e) {
|
|
1251
|
-
if (
|
|
1251
|
+
if (Te(this._camera, "getDistanceToFitSphere"))
|
|
1252
1252
|
return this._spherical.radius;
|
|
1253
1253
|
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;
|
|
1254
1254
|
return e / Math.sin(i * 0.5);
|
|
@@ -1348,7 +1348,7 @@ class J extends Os {
|
|
|
1348
1348
|
* @category Methods
|
|
1349
1349
|
*/
|
|
1350
1350
|
updateCameraUp() {
|
|
1351
|
-
this._yAxisUpSpace.setFromUnitVectors(this._camera.up,
|
|
1351
|
+
this._yAxisUpSpace.setFromUnitVectors(this._camera.up, me), this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert();
|
|
1352
1352
|
}
|
|
1353
1353
|
/**
|
|
1354
1354
|
* Apply current camera-up direction to the camera.
|
|
@@ -1377,7 +1377,7 @@ class J extends Os {
|
|
|
1377
1377
|
this._thetaVelocity.value = 0, this._spherical.theta = this._sphericalEnd.theta;
|
|
1378
1378
|
else {
|
|
1379
1379
|
const m = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
|
|
1380
|
-
this._spherical.theta =
|
|
1380
|
+
this._spherical.theta = ce(
|
|
1381
1381
|
this._spherical.theta,
|
|
1382
1382
|
this._sphericalEnd.theta,
|
|
1383
1383
|
this._thetaVelocity,
|
|
@@ -1390,7 +1390,7 @@ class J extends Os {
|
|
|
1390
1390
|
this._phiVelocity.value = 0, this._spherical.phi = this._sphericalEnd.phi;
|
|
1391
1391
|
else {
|
|
1392
1392
|
const m = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
|
|
1393
|
-
this._spherical.phi =
|
|
1393
|
+
this._spherical.phi = ce(
|
|
1394
1394
|
this._spherical.phi,
|
|
1395
1395
|
this._sphericalEnd.phi,
|
|
1396
1396
|
this._phiVelocity,
|
|
@@ -1403,7 +1403,7 @@ class J extends Os {
|
|
|
1403
1403
|
this._radiusVelocity.value = 0, this._spherical.radius = this._sphericalEnd.radius;
|
|
1404
1404
|
else {
|
|
1405
1405
|
const m = this._isUserControllingDolly ? this.draggingSmoothTime : this.smoothTime;
|
|
1406
|
-
this._spherical.radius =
|
|
1406
|
+
this._spherical.radius = ce(
|
|
1407
1407
|
this._spherical.radius,
|
|
1408
1408
|
this._sphericalEnd.radius,
|
|
1409
1409
|
this._radiusVelocity,
|
|
@@ -1444,7 +1444,7 @@ class J extends Os {
|
|
|
1444
1444
|
this._zoomVelocity.value = 0, this._zoom = this._zoomEnd;
|
|
1445
1445
|
else {
|
|
1446
1446
|
const m = this._isUserControllingZoom ? this.draggingSmoothTime : this.smoothTime;
|
|
1447
|
-
this._zoom =
|
|
1447
|
+
this._zoom = ce(
|
|
1448
1448
|
this._zoom,
|
|
1449
1449
|
this._zoomEnd,
|
|
1450
1450
|
this._zoomVelocity,
|
|
@@ -1472,7 +1472,7 @@ class J extends Os {
|
|
|
1472
1472
|
this._boundary.clampPoint(C, C);
|
|
1473
1473
|
const x = L.subVectors(C, this._targetEnd);
|
|
1474
1474
|
this._targetEnd.copy(C), this._target.add(x), this._changedDolly -= m, S(this._changedDolly) && (this._changedDolly = 0);
|
|
1475
|
-
} else if (
|
|
1475
|
+
} else if (H(this._camera) && this._changedZoom !== 0) {
|
|
1476
1476
|
const m = this._zoom - this._lastZoom, v = this._camera, p = b.set(
|
|
1477
1477
|
this._dollyControlCoord.x,
|
|
1478
1478
|
this._dollyControlCoord.y,
|
|
@@ -1607,7 +1607,7 @@ class J extends Os {
|
|
|
1607
1607
|
if (Y(this._camera)) {
|
|
1608
1608
|
const e = this._camera, t = e.near, s = e.getEffectiveFOV() * ie, i = Math.tan(s * 0.5) * t, r = i * e.aspect;
|
|
1609
1609
|
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);
|
|
1610
|
-
} else if (
|
|
1610
|
+
} else if (H(this._camera)) {
|
|
1611
1611
|
const e = this._camera, t = 1 / e.zoom, s = e.left * t, i = e.right * t, r = e.top * t, o = e.bottom * t;
|
|
1612
1612
|
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);
|
|
1613
1613
|
}
|
|
@@ -1615,16 +1615,16 @@ class J extends Os {
|
|
|
1615
1615
|
// lateUpdate
|
|
1616
1616
|
_collisionTest() {
|
|
1617
1617
|
let e = 1 / 0;
|
|
1618
|
-
if (!(this.colliderMeshes.length >= 1) ||
|
|
1618
|
+
if (!(this.colliderMeshes.length >= 1) || Te(this._camera, "_collisionTest"))
|
|
1619
1619
|
return e;
|
|
1620
1620
|
const s = this._getTargetDirection(ne);
|
|
1621
|
-
|
|
1621
|
+
Le.lookAt(Ve, s, this._camera.up);
|
|
1622
1622
|
for (let i = 0; i < 4; i++) {
|
|
1623
1623
|
const r = L.copy(this._nearPlaneCorners[i]);
|
|
1624
|
-
r.applyMatrix4(
|
|
1624
|
+
r.applyMatrix4(Le);
|
|
1625
1625
|
const o = G.addVectors(this._target, r);
|
|
1626
|
-
|
|
1627
|
-
const n =
|
|
1626
|
+
pe.set(o, s), pe.far = this._spherical.radius + 1;
|
|
1627
|
+
const n = pe.intersectObjects(this.colliderMeshes);
|
|
1628
1628
|
n.length !== 0 && n[0].distance < e && (e = n[0].distance);
|
|
1629
1629
|
}
|
|
1630
1630
|
return e;
|
|
@@ -2075,7 +2075,7 @@ const wt = {
|
|
|
2075
2075
|
fov: 45,
|
|
2076
2076
|
near: 1,
|
|
2077
2077
|
far: 1e3,
|
|
2078
|
-
up: new
|
|
2078
|
+
up: new I(0, 1, 0)
|
|
2079
2079
|
};
|
|
2080
2080
|
class Us extends ee {
|
|
2081
2081
|
constructor(e) {
|
|
@@ -2202,7 +2202,7 @@ class Fs {
|
|
|
2202
2202
|
else if (e.isSpotLight)
|
|
2203
2203
|
i = new jt(e);
|
|
2204
2204
|
else if (e.isHemisphereLight)
|
|
2205
|
-
i = new
|
|
2205
|
+
i = new It(e, 10);
|
|
2206
2206
|
else if (e.isRectAreaLight)
|
|
2207
2207
|
i = new hs(e);
|
|
2208
2208
|
else {
|
|
@@ -2273,7 +2273,7 @@ class Ns extends ee {
|
|
|
2273
2273
|
super(), this.autoRotateSpeed = 0, this.options = e;
|
|
2274
2274
|
const t = {
|
|
2275
2275
|
Vector2: B,
|
|
2276
|
-
Vector3:
|
|
2276
|
+
Vector3: I,
|
|
2277
2277
|
Vector4: Bt,
|
|
2278
2278
|
Quaternion: lt,
|
|
2279
2279
|
Matrix4: W,
|
|
@@ -2312,7 +2312,7 @@ class Ns extends ee {
|
|
|
2312
2312
|
});
|
|
2313
2313
|
}
|
|
2314
2314
|
update(e, t) {
|
|
2315
|
-
super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e *
|
|
2315
|
+
super.update(e, t), this.autoRotateSpeed && this.cameraControls && (this.cameraControls.azimuthAngle += this.autoRotateSpeed * e * Ht.DEG2RAD);
|
|
2316
2316
|
}
|
|
2317
2317
|
}
|
|
2318
2318
|
class js {
|
|
@@ -2384,7 +2384,7 @@ class js {
|
|
|
2384
2384
|
this.event.removeAllListeners(), (e = this.controls) == null || e.dispose();
|
|
2385
2385
|
}
|
|
2386
2386
|
}
|
|
2387
|
-
const Xe = new
|
|
2387
|
+
const Xe = new I(), Is = new lt(), qe = new I(), j = new W(), Hs = new W();
|
|
2388
2388
|
class Bs {
|
|
2389
2389
|
/**
|
|
2390
2390
|
* Constructs a new CSS3D renderer.
|
|
@@ -2443,7 +2443,7 @@ class Bs {
|
|
|
2443
2443
|
if (w.style.display = C === !0 ? "" : "none", C === !0) {
|
|
2444
2444
|
y.onBeforeRender(t, l, _);
|
|
2445
2445
|
let E;
|
|
2446
|
-
y.isCSS3DSprite ? (j.copy(_.matrixWorldInverse), j.transpose(), y.rotation2D !== 0 && j.multiply(
|
|
2446
|
+
y.isCSS3DSprite ? (j.copy(_.matrixWorldInverse), j.transpose(), y.rotation2D !== 0 && j.multiply(Hs.makeRotationZ(y.rotation2D)), y.matrixWorld.decompose(Xe, Is, qe), j.setPosition(Xe), j.scale(qe), j.elements[3] = 0, j.elements[7] = 0, j.elements[11] = 0, j.elements[15] = 1, E = p(j)) : E = p(y.matrixWorld);
|
|
2447
2447
|
const x = n.objects.get(y);
|
|
2448
2448
|
if (x === void 0 || x.style !== E) {
|
|
2449
2449
|
w.style.transform = E;
|
|
@@ -2458,7 +2458,7 @@ class Bs {
|
|
|
2458
2458
|
}
|
|
2459
2459
|
}
|
|
2460
2460
|
}
|
|
2461
|
-
const q = new
|
|
2461
|
+
const q = new I(), Qe = new W(), Je = new W(), et = new I(), tt = new I();
|
|
2462
2462
|
class Vs {
|
|
2463
2463
|
/**
|
|
2464
2464
|
* Constructs a new CSS2D renderer.
|
|
@@ -2690,7 +2690,7 @@ const Ks = (h) => {
|
|
|
2690
2690
|
"baseTexture"
|
|
2691
2691
|
);
|
|
2692
2692
|
return e.needsSwap = !0, e;
|
|
2693
|
-
},
|
|
2693
|
+
}, $s = new Xt({ color: "black" }), Gs = new ct({
|
|
2694
2694
|
color: "black",
|
|
2695
2695
|
sizeAttenuation: !1
|
|
2696
2696
|
}), Xs = new ct({
|
|
@@ -2776,7 +2776,7 @@ class ii {
|
|
|
2776
2776
|
const a = new ke(t);
|
|
2777
2777
|
a.renderToScreen = !1, a.addPass(this.renderPass), a.addPass(n), this.bloomComposer = a;
|
|
2778
2778
|
const c = Ks(a);
|
|
2779
|
-
c.uniforms.bloomAlphaType.value = o, this.bloomComposer = a, this.finalComposer.addPass(c), this.mixPass = c, this.bloomLayer.set(
|
|
2779
|
+
c.uniforms.bloomAlphaType.value = o, this.bloomComposer = a, this.finalComposer.addPass(c), this.mixPass = c, this.bloomLayer.set(Oe);
|
|
2780
2780
|
}
|
|
2781
2781
|
setBloomSelection(e, t) {
|
|
2782
2782
|
if (!this.bloomComposer) {
|
|
@@ -2785,7 +2785,7 @@ class ii {
|
|
|
2785
2785
|
}
|
|
2786
2786
|
e.traverse((s) => {
|
|
2787
2787
|
const { object3d: i } = s;
|
|
2788
|
-
i && (t ? (this.bloomSelection.add(s), i.layers.enable(
|
|
2788
|
+
i && (t ? (this.bloomSelection.add(s), i.layers.enable(Oe)) : (this.bloomSelection.delete(s), i.layers.disable(Oe)));
|
|
2789
2789
|
}), this.bloomSelection.size === 0 ? this.bloomComposerActive = !1 : this.bloomComposerActive = !0;
|
|
2790
2790
|
}
|
|
2791
2791
|
enable() {
|
|
@@ -3291,7 +3291,7 @@ class hi {
|
|
|
3291
3291
|
}
|
|
3292
3292
|
class ci extends hi {
|
|
3293
3293
|
constructor(e, t) {
|
|
3294
|
-
super(e), this.objMap = /* @__PURE__ */ new Map(), this.objects = /* @__PURE__ */ new Map(), this.objectsPm = /* @__PURE__ */ new Map(), this.objectNamesToFactories = /* @__PURE__ */ new Map(), this.mList = t.mList, this.scene = this.createBaseObject(t.scene || new nt(), {
|
|
3294
|
+
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 nt(), {
|
|
3295
3295
|
key: "@Scene",
|
|
3296
3296
|
name: "场景",
|
|
3297
3297
|
mList: !1
|
|
@@ -3317,10 +3317,15 @@ class ci extends hi {
|
|
|
3317
3317
|
if (i.object3d = e, i.pencil = this.pencil, i.lead = this, i.mList = this.mList, s.key)
|
|
3318
3318
|
i.key = s.key;
|
|
3319
3319
|
else if (s.target) {
|
|
3320
|
-
const r = s.target.key, o = s.target.
|
|
3321
|
-
i.key = `${r}__c__${o}`;
|
|
3320
|
+
const r = s.target.key, o = this.objectWrapChindIdMap.get(s.target) ? this.objectWrapChindIdMap.get(s.target) + 1 : 0;
|
|
3321
|
+
this.objectWrapChindIdMap.set(s.target, o), i.key = `${r}__c__${o}`;
|
|
3322
3322
|
}
|
|
3323
|
-
return s.name && (e.name = s.name), s.target && s.target.object3d.add(i.object3d), this.objects.set(i.key, i), this.objMap.set(i.object3d, i), this.pencil.options.mList && s.mList && (this.mList.proxyBaseObject(i), this.mList.addBaseObjectMap(i)),
|
|
3323
|
+
return s.name && (e.name = s.name), s.target && s.target.object3d.add(i.object3d), this.objects.set(i.key, i), this.objMap.set(i.object3d, i), this.pencil.options.mList && s.mList && (this.mList.proxyBaseObject(i), this.mList.addBaseObjectMap(i)), e.children && e.children.forEach((r) => {
|
|
3324
|
+
this.createBaseObject(r, {
|
|
3325
|
+
target: i,
|
|
3326
|
+
mList: s.mList
|
|
3327
|
+
});
|
|
3328
|
+
}), i;
|
|
3324
3329
|
}
|
|
3325
3330
|
init(e) {
|
|
3326
3331
|
return Object.keys(e).forEach((t) => {
|
|
@@ -3393,13 +3398,10 @@ class ci extends hi {
|
|
|
3393
3398
|
return se(this, null, function* () {
|
|
3394
3399
|
if (yield e.create(), e.object3d) {
|
|
3395
3400
|
const i = e.object3d;
|
|
3396
|
-
i.material && Array.isArray(i.material) && (i.material = i.material.slice()), this.pencil.options.mList && (this.mList.proxyBaseObject(e), this.mList.addBaseObjectMap(e)), s && e.setTop(s), t !== null &&
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
target: this.objMap.get(o)
|
|
3401
|
-
});
|
|
3402
|
-
}
|
|
3401
|
+
i.material && Array.isArray(i.material) && (i.material = i.material.slice()), this.pencil.options.mList && (this.mList.proxyBaseObject(e), this.mList.addBaseObjectMap(e)), s && e.setTop(s), t !== null && t.object3d.add(e.object3d), this.objMap.set(e.object3d, e), i.children.forEach((r) => {
|
|
3402
|
+
this.objMap.get(r) || this.createBaseObject(r, {
|
|
3403
|
+
target: e
|
|
3404
|
+
});
|
|
3403
3405
|
});
|
|
3404
3406
|
}
|
|
3405
3407
|
e.render(), this.pencil.event.emit("lead.draw", { baseObject: e });
|
|
@@ -3442,7 +3444,7 @@ class ci extends hi {
|
|
|
3442
3444
|
dispose() {
|
|
3443
3445
|
super.dispose(), this.scene.erase(), this.objects.forEach((e) => {
|
|
3444
3446
|
e.erase();
|
|
3445
|
-
}), this.objects.clear(), this.objectsPm.clear(), this.objMap.clear(), this.objectNamesToFactories.clear();
|
|
3447
|
+
}), this.objects.clear(), this.objectsPm.clear(), this.objMap.clear(), this.objectWrapChindIdMap.clear(), this.objectNamesToFactories.clear();
|
|
3446
3448
|
}
|
|
3447
3449
|
}
|
|
3448
3450
|
class di extends ee {
|
|
@@ -3572,7 +3574,10 @@ class mi {
|
|
|
3572
3574
|
[...this.materials.entries()].some(([t, s]) => s === e ? (this.remove(t), !0) : !1);
|
|
3573
3575
|
}
|
|
3574
3576
|
proxyBaseObject(e) {
|
|
3575
|
-
const t = e.object3d
|
|
3577
|
+
const t = e.object3d;
|
|
3578
|
+
if (!t.material)
|
|
3579
|
+
return;
|
|
3580
|
+
const s = (o) => {
|
|
3576
3581
|
if (o.hasOwnProperty("__isProxy"))
|
|
3577
3582
|
return o;
|
|
3578
3583
|
const n = new Proxy(o, {
|
|
@@ -3651,14 +3656,14 @@ class mi {
|
|
|
3651
3656
|
}
|
|
3652
3657
|
addBaseObjectMap(e) {
|
|
3653
3658
|
const t = e.object3d;
|
|
3654
|
-
[...Object.values(e.materialList), t.material].forEach(
|
|
3659
|
+
t.material && ([...Object.values(e.materialList), t.material].forEach(
|
|
3655
3660
|
(s) => {
|
|
3656
3661
|
s && this.material2array(s).forEach((r) => {
|
|
3657
3662
|
const o = this.materialBaseObjectMap.get(r);
|
|
3658
3663
|
o ? o.add(e) : this.materialBaseObjectMap.set(r, /* @__PURE__ */ new Set([e]));
|
|
3659
3664
|
});
|
|
3660
3665
|
}
|
|
3661
|
-
), this.pencil.event.emit("mList.addBaseObjectMap");
|
|
3666
|
+
), this.pencil.event.emit("mList.addBaseObjectMap"));
|
|
3662
3667
|
}
|
|
3663
3668
|
rmBaseObjectMap(e, t, s = !0) {
|
|
3664
3669
|
const i = t && this.material2array(t);
|
|
@@ -3711,7 +3716,7 @@ class pi extends ee {
|
|
|
3711
3716
|
const _e = class _e {
|
|
3712
3717
|
constructor(e) {
|
|
3713
3718
|
var r, o;
|
|
3714
|
-
this.raycaster = new ht(), this.maxBackufferArea = 5760 * 5760, this.installPlugins = /* @__PURE__ */ new Map(), this._cameraPositon = new
|
|
3719
|
+
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 ss(), this.userData = {}, this.pageActiveIndex = 0, this.pageCountIndex = 0, this.userSetDprCache = 1, this.viewPadding = [0, 0, 0, 0], this.event.setMaxListeners(1 / 0), (o = (r = this.timer).connect) == null || o.call(r, document), this.options = is(_e.options, e, {
|
|
3715
3720
|
isMergeableObject: as
|
|
3716
3721
|
}), this.userSetDprCache = this.options.renderer.devicePixelRatio;
|
|
3717
3722
|
const {
|
|
@@ -4012,11 +4017,11 @@ const _e = class _e {
|
|
|
4012
4017
|
}
|
|
4013
4018
|
};
|
|
4014
4019
|
_e.options = {
|
|
4015
|
-
stats:
|
|
4016
|
-
helper:
|
|
4017
|
-
viewHelper:
|
|
4020
|
+
stats: he,
|
|
4021
|
+
helper: he,
|
|
4022
|
+
viewHelper: he,
|
|
4018
4023
|
controls: !0,
|
|
4019
|
-
transformControls:
|
|
4024
|
+
transformControls: he,
|
|
4020
4025
|
renderer: As,
|
|
4021
4026
|
composer: si,
|
|
4022
4027
|
scene: zs,
|