gl-draw 0.14.21 → 0.14.22

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.
@@ -40,8 +40,8 @@ import { TransformControls as Rt } from "three/examples/jsm/controls/TransformCo
40
40
  import { EffectComposer as Me } from "three/examples/jsm/postprocessing/EffectComposer";
41
41
  import { RenderPass as Ut } from "three/examples/jsm/postprocessing/RenderPass";
42
42
  import { SSAOPass as zt } from "three/examples/jsm/postprocessing/SSAOPass";
43
- import { FullScreenQuad as kt } from "three/examples/jsm/postprocessing/Pass";
44
- import { OutputPass as Ft } from "three/examples/jsm/postprocessing/OutputPass";
43
+ import { FullScreenQuad as Ft } from "three/examples/jsm/postprocessing/Pass";
44
+ import { OutputPass as kt } from "three/examples/jsm/postprocessing/OutputPass";
45
45
  import { ShaderPass as Nt } from "three/examples/jsm/postprocessing/ShaderPass";
46
46
  import { UnrealBloomPass as Ht } from "three/examples/jsm/postprocessing/UnrealBloomPass";
47
47
  import "three/examples/jsm/renderers/CSS2DRenderer";
@@ -57,7 +57,7 @@ import { GLTFLoader as De } from "three/examples/jsm/loaders/GLTFLoader";
57
57
  import { DRACOLoader as It } from "three/examples/jsm/loaders/DRACOLoader";
58
58
  import { EXRLoader as jt } from "three/examples/jsm/loaders/EXRLoader";
59
59
  import { LottieLoader as Vt } from "three/examples/jsm/loaders/LottieLoader";
60
- import { makePromiseCreator as Yt, generateUUID as Re } from "esus-lite";
60
+ import { makePromiseCreator as Bt, generateUUID as Re } from "esus-lite";
61
61
  const D = {
62
62
  LEFT: 1,
63
63
  RIGHT: 2,
@@ -89,14 +89,14 @@ const D = {
89
89
  IN: 1,
90
90
  OUT: -1
91
91
  };
92
- function Y(l) {
92
+ function B(l) {
93
93
  return l.isPerspectiveCamera;
94
94
  }
95
95
  function j(l) {
96
96
  return l.isOrthographicCamera;
97
97
  }
98
98
  const W = Math.PI * 2, Ue = Math.PI / 2, tt = 1e-5, ee = Math.PI / 180;
99
- function F(l, e, t) {
99
+ function k(l, e, t) {
100
100
  return Math.max(e, Math.min(t, l));
101
101
  }
102
102
  function M(l, e = tt) {
@@ -119,17 +119,17 @@ function he(l, e, t, s, i = 1 / 0, r) {
119
119
  const o = 2 / s, a = o * r, h = 1 / (1 + a + 0.48 * a * a + 0.235 * a * a * a);
120
120
  let d = l - e;
121
121
  const f = e, p = i * s;
122
- d = F(d, -p, p), e = l - d;
122
+ d = k(d, -p, p), e = l - d;
123
123
  const y = (t.value + o * d) * r;
124
124
  t.value = (t.value - o * y) * h;
125
125
  let v = e + (d + y) * h;
126
126
  return f - l > 0 == v > f && (v = f, t.value = (v - f) / r), v;
127
127
  }
128
- function ke(l, e, t, s, i = 1 / 0, r, o) {
128
+ function Fe(l, e, t, s, i = 1 / 0, r, o) {
129
129
  s = Math.max(1e-4, s);
130
130
  const a = 2 / s, h = a * r, d = 1 / (1 + h + 0.48 * h * h + 0.235 * h * h * h);
131
131
  let f = e.x, p = e.y, y = e.z, v = l.x - f, m = l.y - p, u = l.z - y;
132
- const _ = f, n = p, g = y, E = i * s, C = E * E, w = v * v + m * m + u * u;
132
+ const g = f, n = p, _ = y, E = i * s, C = E * E, w = v * v + m * m + u * u;
133
133
  if (w > C) {
134
134
  const ve = Math.sqrt(w);
135
135
  v = v / ve * E, m = m / ve * E, u = u / ve * E;
@@ -137,8 +137,8 @@ function ke(l, e, t, s, i = 1 / 0, r, o) {
137
137
  f = l.x - v, p = l.y - m, y = l.z - u;
138
138
  const T = (t.x + a * v) * r, P = (t.y + a * m) * r, R = (t.z + a * u) * r;
139
139
  t.x = (t.x - a * T) * d, t.y = (t.y - a * P) * d, t.z = (t.z - a * R) * d, o.x = f + (v + T) * d, o.y = p + (m + P) * d, o.z = y + (u + R) * d;
140
- const V = _ - l.x, ae = n - l.y, dt = g - l.z, pt = o.x - _, mt = o.y - n, ut = o.z - g;
141
- return V * pt + ae * mt + dt * ut > 0 && (o.x = _, o.y = n, o.z = g, t.x = (o.x - _) / r, t.y = (o.y - n) / r, t.z = (o.z - g) / r), o;
140
+ const V = g - l.x, ae = n - l.y, dt = _ - l.z, pt = o.x - g, mt = o.y - n, ut = o.z - _;
141
+ return V * pt + ae * mt + dt * ut > 0 && (o.x = g, o.y = n, o.z = _, t.x = (o.x - g) / r, t.y = (o.y - n) / r, t.z = (o.z - _) / r), o;
142
142
  }
143
143
  function ye(l, e) {
144
144
  e.set(0, 0), l.forEach((t) => {
@@ -148,7 +148,7 @@ function ye(l, e) {
148
148
  function Ee(l, e) {
149
149
  return j(l) ? (console.warn(`${e} is not supported in OrthographicCamera`), !0) : !1;
150
150
  }
151
- class Bt {
151
+ class Yt {
152
152
  constructor() {
153
153
  this._listeners = {};
154
154
  }
@@ -213,8 +213,8 @@ class Bt {
213
213
  }
214
214
  }
215
215
  const le = 1 / 8, Zt = /Mac/.test(navigator.platform);
216
- let x, Fe, ce, Oe, U, b, L, G, ie, N, H, B, Ne, He, k, re, K, Ie, Te, je, xe, we, de;
217
- class $ extends Bt {
216
+ let x, ke, ce, Oe, U, b, L, G, ie, N, H, Y, Ne, He, F, re, K, Ie, Te, je, xe, we, de;
217
+ class $ extends Yt {
218
218
  /**
219
219
  * Injects THREE as the dependency. You can then proceed to use CameraControls.
220
220
  *
@@ -256,7 +256,7 @@ class $ extends Bt {
256
256
  * @category Statics
257
257
  */
258
258
  static install(e) {
259
- x = e.THREE, Fe = Object.freeze(new x.Vector3(0, 0, 0)), ce = Object.freeze(new x.Vector3(0, 1, 0)), Oe = Object.freeze(new x.Vector3(0, 0, 1)), U = new x.Vector2(), b = new x.Vector3(), L = new x.Vector3(), G = new x.Vector3(), ie = new x.Vector3(), N = new x.Vector3(), H = new x.Vector3(), B = new x.Vector3(), Ne = new x.Vector3(), He = new x.Vector3(), k = new x.Spherical(), re = new x.Spherical(), K = new x.Box3(), Ie = new x.Box3(), Te = new x.Sphere(), je = new x.Quaternion(), xe = new x.Quaternion(), we = new x.Matrix4(), de = new x.Raycaster();
259
+ x = e.THREE, ke = Object.freeze(new x.Vector3(0, 0, 0)), ce = Object.freeze(new x.Vector3(0, 1, 0)), Oe = Object.freeze(new x.Vector3(0, 0, 1)), U = new x.Vector2(), b = new x.Vector3(), L = new x.Vector3(), G = new x.Vector3(), ie = new x.Vector3(), N = new x.Vector3(), H = new x.Vector3(), Y = new x.Vector3(), Ne = new x.Vector3(), He = new x.Vector3(), F = new x.Spherical(), re = new x.Spherical(), K = new x.Box3(), Ie = new x.Box3(), Te = new x.Sphere(), je = new x.Quaternion(), xe = new x.Quaternion(), we = new x.Matrix4(), de = new x.Raycaster();
260
260
  }
261
261
  /**
262
262
  * list all ACTIONs
@@ -284,14 +284,14 @@ class $ extends Bt {
284
284
  */
285
285
  constructor(e, t) {
286
286
  super(), this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.minDistance = Number.EPSILON, this.maxDistance = 1 / 0, this.infinityDolly = !1, this.minZoom = 0.01, this.maxZoom = 1 / 0, this.smoothTime = 0.25, this.draggingSmoothTime = 0.125, this.maxSpeed = 1 / 0, this.azimuthRotateSpeed = 1, this.polarRotateSpeed = 1, this.dollySpeed = 1, this.dollyDragInverted = !1, this.truckSpeed = 2, this.dollyToCursor = !1, this.dragToOffset = !1, this.boundaryFriction = 0, this.restThreshold = 0.01, this.colliderMeshes = [], this.cancel = () => {
287
- }, this._enabled = !0, this._state = c.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = Z.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new x.Vector3(), this._focalOffsetVelocity = new x.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (n, g, E, C) => {
287
+ }, this._enabled = !0, this._state = c.NONE, this._viewport = null, this._changedDolly = 0, this._changedZoom = 0, this._hasRested = !0, this._boundaryEnclosesCamera = !1, this._needsUpdate = !0, this._updatedLastTime = !1, this._elementRect = new DOMRect(), this._isDragging = !1, this._dragNeedsUpdate = !0, this._activePointers = [], this._lockedPointer = null, this._interactiveArea = new DOMRect(0, 0, 1, 1), this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._isUserControllingOffset = !1, this._isUserControllingZoom = !1, this._lastDollyDirection = Z.NONE, this._thetaVelocity = { value: 0 }, this._phiVelocity = { value: 0 }, this._radiusVelocity = { value: 0 }, this._targetVelocity = new x.Vector3(), this._focalOffsetVelocity = new x.Vector3(), this._zoomVelocity = { value: 0 }, this._truckInternal = (n, _, E, C) => {
288
288
  let w, T;
289
- if (Y(this._camera)) {
289
+ if (B(this._camera)) {
290
290
  const P = b.copy(this._camera.position).sub(this._target), R = this._camera.getEffectiveFOV() * ee, V = P.length() * Math.tan(R * 0.5);
291
- w = this.truckSpeed * n * V / this._elementRect.height, T = this.truckSpeed * g * V / this._elementRect.height;
291
+ w = this.truckSpeed * n * V / this._elementRect.height, T = this.truckSpeed * _ * V / this._elementRect.height;
292
292
  } else if (j(this._camera)) {
293
293
  const P = this._camera;
294
- w = this.truckSpeed * n * (P.right - P.left) / P.zoom / this._elementRect.width, T = this.truckSpeed * g * (P.top - P.bottom) / P.zoom / this._elementRect.height;
294
+ w = this.truckSpeed * n * (P.right - P.left) / P.zoom / this._elementRect.width, T = this.truckSpeed * _ * (P.top - P.bottom) / P.zoom / this._elementRect.height;
295
295
  } else
296
296
  return;
297
297
  C ? (E ? this.setFocalOffset(
@@ -305,19 +305,19 @@ class $ extends Bt {
305
305
  this._focalOffsetEnd.z,
306
306
  !0
307
307
  ) : this.truck(w, T, !0);
308
- }, this._rotateInternal = (n, g) => {
309
- const E = W * this.azimuthRotateSpeed * n / this._elementRect.height, C = W * this.polarRotateSpeed * g / this._elementRect.height;
308
+ }, this._rotateInternal = (n, _) => {
309
+ const E = W * this.azimuthRotateSpeed * n / this._elementRect.height, C = W * this.polarRotateSpeed * _ / this._elementRect.height;
310
310
  this.rotate(E, C, !0);
311
- }, this._dollyInternal = (n, g, E) => {
312
- const C = Math.pow(0.95, -n * this.dollySpeed), w = this._sphericalEnd.radius, T = this._sphericalEnd.radius * C, P = F(
311
+ }, this._dollyInternal = (n, _, E) => {
312
+ const C = Math.pow(0.95, -n * this.dollySpeed), w = this._sphericalEnd.radius, T = this._sphericalEnd.radius * C, P = k(
313
313
  T,
314
314
  this.minDistance,
315
315
  this.maxDistance
316
316
  ), R = P - T;
317
- this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(T, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(R, !0), this._dollyToNoClamp(P, !0)) : this._dollyToNoClamp(P, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? T : P) - w, this._dollyControlCoord.set(g, E)), this._lastDollyDirection = Math.sign(-n);
318
- }, this._zoomInternal = (n, g, E) => {
317
+ this.infinityDolly && this.dollyToCursor ? this._dollyToNoClamp(T, !0) : this.infinityDolly && !this.dollyToCursor ? (this.dollyInFixed(R, !0), this._dollyToNoClamp(P, !0)) : this._dollyToNoClamp(P, !0), this.dollyToCursor && (this._changedDolly += (this.infinityDolly ? T : P) - w, this._dollyControlCoord.set(_, E)), this._lastDollyDirection = Math.sign(-n);
318
+ }, this._zoomInternal = (n, _, E) => {
319
319
  const C = Math.pow(0.95, n * this.dollySpeed), w = this._zoom, T = this._zoom * C;
320
- this.zoomTo(T, !0), this.dollyToCursor && (this._changedZoom += T - w, this._dollyControlCoord.set(g, E));
320
+ this.zoomTo(T, !0), this.dollyToCursor && (this._changedZoom += T - w, this._dollyControlCoord.set(_, E));
321
321
  }, typeof x == "undefined" && console.error(
322
322
  "camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."
323
323
  ), this._camera = e, this._yAxisUpSpace = new x.Quaternion().setFromUnitVectors(
@@ -337,10 +337,10 @@ class $ extends Bt {
337
337
  left: c.ROTATE,
338
338
  middle: c.DOLLY,
339
339
  right: c.TRUCK,
340
- wheel: Y(this._camera) ? c.DOLLY : j(this._camera) ? c.ZOOM : c.NONE
340
+ wheel: B(this._camera) ? c.DOLLY : j(this._camera) ? c.ZOOM : c.NONE
341
341
  }, this.touches = {
342
342
  one: c.TOUCH_ROTATE,
343
- two: Y(this._camera) ? c.TOUCH_DOLLY_TRUCK : j(this._camera) ? c.TOUCH_ZOOM_TRUCK : c.NONE,
343
+ two: B(this._camera) ? c.TOUCH_DOLLY_TRUCK : j(this._camera) ? c.TOUCH_ZOOM_TRUCK : c.NONE,
344
344
  three: c.TOUCH_TRUCK
345
345
  };
346
346
  const s = new x.Vector2(), i = new x.Vector2(), r = new x.Vector2(), o = (n) => {
@@ -350,9 +350,9 @@ class $ extends Bt {
350
350
  if (w < this._interactiveArea.left || w > this._interactiveArea.right || T < this._interactiveArea.top || T > this._interactiveArea.bottom)
351
351
  return;
352
352
  }
353
- const g = n.pointerType !== "mouse" ? null : (n.buttons & D.LEFT) === D.LEFT ? D.LEFT : (n.buttons & D.MIDDLE) === D.MIDDLE ? D.MIDDLE : (n.buttons & D.RIGHT) === D.RIGHT ? D.RIGHT : null;
354
- if (g !== null) {
355
- const C = this._findPointerByMouseButton(g);
353
+ const _ = n.pointerType !== "mouse" ? null : (n.buttons & D.LEFT) === D.LEFT ? D.LEFT : (n.buttons & D.MIDDLE) === D.MIDDLE ? D.MIDDLE : (n.buttons & D.RIGHT) === D.RIGHT ? D.RIGHT : null;
354
+ if (_ !== null) {
355
+ const C = this._findPointerByMouseButton(_);
356
356
  C && this._disposePointer(C);
357
357
  }
358
358
  if ((n.buttons & D.LEFT) === D.LEFT && this._lockedPointer)
@@ -363,7 +363,7 @@ class $ extends Bt {
363
363
  clientY: n.clientY,
364
364
  deltaX: 0,
365
365
  deltaY: 0,
366
- mouseButton: g
366
+ mouseButton: _
367
367
  };
368
368
  this._activePointers.push(E), this._domElement.ownerDocument.removeEventListener(
369
369
  "pointermove",
@@ -379,7 +379,7 @@ class $ extends Bt {
379
379
  ), this._domElement.ownerDocument.addEventListener("pointerup", h), this._isDragging = !0, y(n);
380
380
  }, a = (n) => {
381
381
  n.cancelable && n.preventDefault();
382
- const g = n.pointerId, E = this._lockedPointer || this._findPointerById(g);
382
+ const _ = n.pointerId, E = this._lockedPointer || this._findPointerById(_);
383
383
  if (E) {
384
384
  if (E.clientX = n.clientX, E.clientY = n.clientY, E.deltaX = n.movementX, E.deltaY = n.movementY, this._state = 0, n.pointerType === "touch")
385
385
  switch (this._activePointers.length) {
@@ -398,9 +398,9 @@ class $ extends Bt {
398
398
  v();
399
399
  }
400
400
  }, h = (n) => {
401
- const g = this._findPointerById(n.pointerId);
402
- if (!(g && g === this._lockedPointer)) {
403
- if (g && this._disposePointer(g), n.pointerType === "touch")
401
+ const _ = this._findPointerById(n.pointerId);
402
+ if (!(_ && _ === this._lockedPointer)) {
403
+ if (_ && this._disposePointer(_), n.pointerType === "touch")
404
404
  switch (this._activePointers.length) {
405
405
  case 0:
406
406
  this._state = c.NONE;
@@ -432,7 +432,7 @@ class $ extends Bt {
432
432
  const T = performance.now();
433
433
  d - T < 1e3 && this._getClientRect(this._elementRect), d = T;
434
434
  }
435
- const g = Zt ? -1 : -3, E = n.deltaMode === 1 ? n.deltaY / g : n.deltaY / (g * 10), C = this.dollyToCursor ? (n.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, w = this.dollyToCursor ? (n.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
435
+ const _ = Zt ? -1 : -3, E = n.deltaMode === 1 ? n.deltaY / _ : n.deltaY / (_ * 10), C = this.dollyToCursor ? (n.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, w = this.dollyToCursor ? (n.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
436
436
  switch (this.mouseButtons.wheel) {
437
437
  case c.ROTATE: {
438
438
  this._rotateInternal(n.deltaX, n.deltaY), this._isUserControllingRotate = !0;
@@ -463,7 +463,7 @@ class $ extends Bt {
463
463
  }, p = (n) => {
464
464
  if (!(!this._domElement || !this._enabled)) {
465
465
  if (this.mouseButtons.right === $.ACTION.NONE) {
466
- const g = n instanceof PointerEvent ? n.pointerId : 0, E = this._findPointerById(g);
466
+ const _ = n instanceof PointerEvent ? n.pointerId : 0, E = this._findPointerById(_);
467
467
  E && this._disposePointer(E), this._domElement.ownerDocument.removeEventListener(
468
468
  "pointermove",
469
469
  a,
@@ -504,7 +504,7 @@ class $ extends Bt {
504
504
  }, v = () => {
505
505
  if (!this._enabled || !this._dragNeedsUpdate) return;
506
506
  this._dragNeedsUpdate = !1, ye(this._activePointers, U);
507
- const g = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, E = g ? -g.deltaX : i.x - U.x, C = g ? -g.deltaY : i.y - U.y;
507
+ const _ = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement ? this._lockedPointer || this._activePointers[0] : null, E = _ ? -_.deltaX : i.x - U.x, C = _ ? -_.deltaY : i.y - U.y;
508
508
  if (i.copy(U), ((this._state & c.ROTATE) === c.ROTATE || (this._state & c.TOUCH_ROTATE) === c.TOUCH_ROTATE || (this._state & c.TOUCH_DOLLY_ROTATE) === c.TOUCH_DOLLY_ROTATE || (this._state & c.TOUCH_ZOOM_ROTATE) === c.TOUCH_ZOOM_ROTATE) && (this._rotateInternal(E, C), this._isUserControllingRotate = !0), (this._state & c.DOLLY) === c.DOLLY || (this._state & c.ZOOM) === c.ZOOM) {
509
509
  const w = this.dollyToCursor ? (s.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, T = this.dollyToCursor ? (s.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0, P = this.dollyDragInverted ? -1 : 1;
510
510
  (this._state & c.DOLLY) === c.DOLLY ? (this._dollyInternal(
@@ -554,25 +554,25 @@ class $ extends Bt {
554
554
  u
555
555
  ), this._domElement.ownerDocument.addEventListener(
556
556
  "pointerlockerror",
557
- _
557
+ g
558
558
  ), this._domElement.ownerDocument.addEventListener(
559
559
  "pointermove",
560
560
  a,
561
561
  { passive: !1 }
562
562
  ), this._domElement.ownerDocument.addEventListener("pointerup", h), y());
563
563
  }, this.unlockPointer = () => {
564
- var n, g, E;
565
- this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (n = this._domElement) === null || n === void 0 || n.ownerDocument.exitPointerLock(), (g = this._domElement) === null || g === void 0 || g.ownerDocument.removeEventListener(
564
+ var n, _, E;
565
+ this._lockedPointer !== null && (this._disposePointer(this._lockedPointer), this._lockedPointer = null), (n = this._domElement) === null || n === void 0 || n.ownerDocument.exitPointerLock(), (_ = this._domElement) === null || _ === void 0 || _.ownerDocument.removeEventListener(
566
566
  "pointerlockchange",
567
567
  u
568
568
  ), (E = this._domElement) === null || E === void 0 || E.ownerDocument.removeEventListener(
569
569
  "pointerlockerror",
570
- _
570
+ g
571
571
  ), this.cancel();
572
572
  };
573
573
  const u = () => {
574
574
  this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement || this.unlockPointer();
575
- }, _ = () => {
575
+ }, g = () => {
576
576
  this.unlockPointer();
577
577
  };
578
578
  this._addAllEventListeners = (n) => {
@@ -594,7 +594,7 @@ class $ extends Bt {
594
594
  u
595
595
  ), this._domElement.ownerDocument.removeEventListener(
596
596
  "pointerlockerror",
597
- _
597
+ g
598
598
  ));
599
599
  }, this.cancel = () => {
600
600
  this._state !== c.NONE && (this._state = c.NONE, this._activePointers.length = 0, m());
@@ -687,11 +687,11 @@ class $ extends Bt {
687
687
  * @category Properties
688
688
  */
689
689
  set interactiveArea(e) {
690
- this._interactiveArea.width = F(e.width, 0, 1), this._interactiveArea.height = F(e.height, 0, 1), this._interactiveArea.x = F(
690
+ this._interactiveArea.width = k(e.width, 0, 1), this._interactiveArea.height = k(e.height, 0, 1), this._interactiveArea.x = k(
691
691
  e.x,
692
692
  0,
693
693
  1 - this._interactiveArea.width
694
- ), this._interactiveArea.y = F(
694
+ ), this._interactiveArea.y = k(
695
695
  e.y,
696
696
  0,
697
697
  1 - this._interactiveArea.height
@@ -829,11 +829,11 @@ class $ extends Bt {
829
829
  */
830
830
  rotateTo(e, t, s = !1) {
831
831
  this._isUserControllingRotate = !1;
832
- const i = F(
832
+ const i = k(
833
833
  e,
834
834
  this.minAzimuthAngle,
835
835
  this.maxAzimuthAngle
836
- ), r = F(t, this.minPolarAngle, this.maxPolarAngle);
836
+ ), r = k(t, this.minPolarAngle, this.maxPolarAngle);
837
837
  this._sphericalEnd.theta = i, this._sphericalEnd.phi = r, this._sphericalEnd.makeSafe(), this._needsUpdate = !0, s || (this._spherical.theta = this._sphericalEnd.theta, this._spherical.phi = this._sphericalEnd.phi);
838
838
  const o = !s || S(
839
839
  this._spherical.theta,
@@ -863,7 +863,7 @@ class $ extends Bt {
863
863
  */
864
864
  dollyTo(e, t = !1) {
865
865
  return this._isUserControllingDolly = !1, this._lastDollyDirection = Z.NONE, this._changedDolly = 0, this._dollyToNoClamp(
866
- F(e, this.minDistance, this.maxDistance),
866
+ k(e, this.minDistance, this.maxDistance),
867
867
  t
868
868
  );
869
869
  }
@@ -921,7 +921,7 @@ class $ extends Bt {
921
921
  * @category Methods
922
922
  */
923
923
  zoomTo(e, t = !1) {
924
- this._isUserControllingZoom = !1, this._zoomEnd = F(e, this.minZoom, this.maxZoom), this._needsUpdate = !0, t || (this._zoom = this._zoomEnd);
924
+ this._isUserControllingZoom = !1, this._zoomEnd = k(e, this.minZoom, this.maxZoom), this._needsUpdate = !0, t || (this._zoom = this._zoomEnd);
925
925
  const s = !t || S(this._zoom, this._zoomEnd, this.restThreshold);
926
926
  return this._changedZoom = 0, this._createOnRestPromise(s);
927
927
  }
@@ -1032,19 +1032,19 @@ class $ extends Bt {
1032
1032
  m && v.multiply(xe.setFromAxisAngle(ce, f)), v.multiply(this._yAxisUpSpaceInverse);
1033
1033
  const u = Ie.makeEmpty();
1034
1034
  L.copy(d.min).applyQuaternion(v), u.expandByPoint(L), L.copy(d.min).setX(d.max.x).applyQuaternion(v), u.expandByPoint(L), L.copy(d.min).setY(d.max.y).applyQuaternion(v), u.expandByPoint(L), L.copy(d.max).setZ(d.min.z).applyQuaternion(v), u.expandByPoint(L), L.copy(d.min).setZ(d.max.z).applyQuaternion(v), u.expandByPoint(L), L.copy(d.max).setY(d.min.y).applyQuaternion(v), u.expandByPoint(L), L.copy(d.max).setX(d.min.x).applyQuaternion(v), u.expandByPoint(L), L.copy(d.max).applyQuaternion(v), u.expandByPoint(L), u.min.x -= i, u.min.y -= o, u.max.x += r, u.max.y += a, v.setFromUnitVectors(Oe, y), m && v.premultiply(xe.invert()), v.premultiply(this._yAxisUpSpace);
1035
- const _ = u.getSize(b), n = u.getCenter(L).applyQuaternion(v);
1036
- if (Y(this._camera)) {
1037
- const g = this.getDistanceToFitBox(
1038
- _.x,
1039
- _.y,
1040
- _.z,
1035
+ const g = u.getSize(b), n = u.getCenter(L).applyQuaternion(v);
1036
+ if (B(this._camera)) {
1037
+ const _ = this.getDistanceToFitBox(
1038
+ g.x,
1039
+ g.y,
1040
+ g.z,
1041
1041
  s
1042
1042
  );
1043
1043
  h.push(
1044
1044
  this.moveTo(n.x, n.y, n.z, t)
1045
- ), h.push(this.dollyTo(g, t)), h.push(this.setFocalOffset(0, 0, 0, t));
1045
+ ), h.push(this.dollyTo(_, t)), h.push(this.setFocalOffset(0, 0, 0, t));
1046
1046
  } else if (j(this._camera)) {
1047
- const g = this._camera, E = g.right - g.left, C = g.top - g.bottom, w = s ? Math.max(E / _.x, C / _.y) : Math.min(E / _.x, C / _.y);
1047
+ const _ = this._camera, E = _.right - _.left, C = _.top - _.bottom, w = s ? Math.max(E / g.x, C / g.y) : Math.min(E / g.x, C / g.y);
1048
1048
  h.push(
1049
1049
  this.moveTo(n.x, n.y, n.z, t)
1050
1050
  ), h.push(this.zoomTo(w, t)), h.push(this.setFocalOffset(0, 0, 0, t));
@@ -1066,7 +1066,7 @@ class $ extends Bt {
1066
1066
  r.center.z,
1067
1067
  t
1068
1068
  )
1069
- ), Y(this._camera)) {
1069
+ ), B(this._camera)) {
1070
1070
  const o = this.getDistanceToFitSphere(r.radius);
1071
1071
  s.push(this.dollyTo(o, t));
1072
1072
  } else if (j(this._camera)) {
@@ -1127,19 +1127,19 @@ class $ extends Bt {
1127
1127
  */
1128
1128
  lerpLookAt(e, t, s, i, r, o, a, h, d, f, p, y, v, m = !1) {
1129
1129
  this._isUserControllingRotate = !1, this._isUserControllingDolly = !1, this._isUserControllingTruck = !1, this._lastDollyDirection = Z.NONE, this._changedDolly = 0;
1130
- const u = b.set(i, r, o), _ = L.set(e, t, s);
1131
- k.setFromVector3(
1132
- _.sub(u).applyQuaternion(this._yAxisUpSpace)
1130
+ const u = b.set(i, r, o), g = L.set(e, t, s);
1131
+ F.setFromVector3(
1132
+ g.sub(u).applyQuaternion(this._yAxisUpSpace)
1133
1133
  );
1134
- const n = G.set(f, p, y), g = L.set(a, h, d);
1134
+ const n = G.set(f, p, y), _ = L.set(a, h, d);
1135
1135
  re.setFromVector3(
1136
- g.sub(n).applyQuaternion(this._yAxisUpSpace)
1136
+ _.sub(n).applyQuaternion(this._yAxisUpSpace)
1137
1137
  ), this._targetEnd.copy(u.lerp(n, v));
1138
- const E = re.theta - k.theta, C = re.phi - k.phi, w = re.radius - k.radius;
1138
+ const E = re.theta - F.theta, C = re.phi - F.phi, w = re.radius - F.radius;
1139
1139
  this._sphericalEnd.set(
1140
- k.radius + w * v,
1141
- k.phi + C * v,
1142
- k.theta + E * v
1140
+ F.radius + w * v,
1141
+ F.phi + C * v,
1142
+ F.theta + E * v
1143
1143
  ), this.normalizeRotations(), this._needsUpdate = !0, m || (this._target.copy(this._targetEnd), this._spherical.copy(this._sphericalEnd));
1144
1144
  const T = !m || S(this._target.x, this._targetEnd.x, this.restThreshold) && S(this._target.y, this._targetEnd.y, this.restThreshold) && S(this._target.z, this._targetEnd.z, this.restThreshold) && S(
1145
1145
  this._spherical.theta,
@@ -1195,7 +1195,7 @@ class $ extends Bt {
1195
1195
  s,
1196
1196
  i
1197
1197
  );
1198
- return this._sphericalEnd.phi = F(
1198
+ return this._sphericalEnd.phi = k(
1199
1199
  this._sphericalEnd.phi,
1200
1200
  this.minPolarAngle,
1201
1201
  this.maxPolarAngle
@@ -1235,9 +1235,9 @@ class $ extends Bt {
1235
1235
  * @category Methods
1236
1236
  */
1237
1237
  setOrbitPoint(e, t, s) {
1238
- this._camera.updateMatrixWorld(), N.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), H.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), B.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
1238
+ this._camera.updateMatrixWorld(), N.setFromMatrixColumn(this._camera.matrixWorldInverse, 0), H.setFromMatrixColumn(this._camera.matrixWorldInverse, 1), Y.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
1239
1239
  const i = b.set(e, t, s), r = i.distanceTo(this._camera.position), o = i.sub(this._camera.position);
1240
- N.multiplyScalar(o.x), H.multiplyScalar(o.y), B.multiplyScalar(o.z), b.copy(N).add(H).add(B), b.z = b.z + r, this.dollyTo(r, !1), this.setFocalOffset(-b.x, b.y, -b.z, !1), this.moveTo(e, t, s, !1);
1240
+ N.multiplyScalar(o.x), H.multiplyScalar(o.y), Y.multiplyScalar(o.z), b.copy(N).add(H).add(Y), b.z = b.z + r, this.dollyTo(r, !1), this.setFocalOffset(-b.x, b.y, -b.z, !1), this.moveTo(e, t, s, !1);
1241
1241
  }
1242
1242
  /**
1243
1243
  * Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
@@ -1456,7 +1456,7 @@ class $ extends Bt {
1456
1456
  this._targetVelocity.set(0, 0, 0), this._target.copy(this._targetEnd);
1457
1457
  else {
1458
1458
  const p = this._isUserControllingTruck ? this.draggingSmoothTime : this.smoothTime;
1459
- ke(
1459
+ Fe(
1460
1460
  this._target,
1461
1461
  this._targetEnd,
1462
1462
  this._targetVelocity,
@@ -1470,7 +1470,7 @@ class $ extends Bt {
1470
1470
  this._focalOffsetVelocity.set(0, 0, 0), this._focalOffset.copy(this._focalOffsetEnd);
1471
1471
  else {
1472
1472
  const p = this._isUserControllingOffset ? this.draggingSmoothTime : this.smoothTime;
1473
- ke(
1473
+ Fe(
1474
1474
  this._focalOffset,
1475
1475
  this._focalOffsetEnd,
1476
1476
  this._focalOffsetVelocity,
@@ -1494,16 +1494,16 @@ class $ extends Bt {
1494
1494
  );
1495
1495
  }
1496
1496
  if (this.dollyToCursor) {
1497
- if (Y(this._camera) && this._changedDolly !== 0) {
1497
+ if (B(this._camera) && this._changedDolly !== 0) {
1498
1498
  const p = this._spherical.radius - this._lastDistance, y = this._camera, v = this._getCameraDirection(ie), m = b.copy(v).cross(y.up).normalize();
1499
1499
  m.lengthSq() === 0 && (m.x = 1);
1500
- const u = L.crossVectors(m, v), _ = this._sphericalEnd.radius * Math.tan(y.getEffectiveFOV() * ee * 0.5), g = (this._sphericalEnd.radius - p - this._sphericalEnd.radius) / this._sphericalEnd.radius, E = G.copy(this._targetEnd).add(
1500
+ const u = L.crossVectors(m, v), g = this._sphericalEnd.radius * Math.tan(y.getEffectiveFOV() * ee * 0.5), _ = (this._sphericalEnd.radius - p - this._sphericalEnd.radius) / this._sphericalEnd.radius, E = G.copy(this._targetEnd).add(
1501
1501
  m.multiplyScalar(
1502
- this._dollyControlCoord.x * _ * y.aspect
1502
+ this._dollyControlCoord.x * g * y.aspect
1503
1503
  )
1504
1504
  ).add(
1505
- u.multiplyScalar(this._dollyControlCoord.y * _)
1506
- ), C = b.copy(this._targetEnd).lerp(E, g), w = this._lastDollyDirection === Z.IN && this._spherical.radius <= this.minDistance, T = this._lastDollyDirection === Z.OUT && this.maxDistance <= this._spherical.radius;
1505
+ u.multiplyScalar(this._dollyControlCoord.y * g)
1506
+ ), C = b.copy(this._targetEnd).lerp(E, _), w = this._lastDollyDirection === Z.IN && this._spherical.radius <= this.minDistance, T = this._lastDollyDirection === Z.OUT && this.maxDistance <= this._spherical.radius;
1507
1507
  if (this.infinityDolly && (w || T)) {
1508
1508
  this._sphericalEnd.radius -= p, this._spherical.radius -= p;
1509
1509
  const R = L.copy(v).multiplyScalar(-p);
@@ -1517,7 +1517,7 @@ class $ extends Bt {
1517
1517
  this._dollyControlCoord.x,
1518
1518
  this._dollyControlCoord.y,
1519
1519
  (y.near + y.far) / (y.near - y.far)
1520
- ).unproject(y), m = L.set(0, 0, -1).applyQuaternion(y.quaternion), u = G.copy(v).add(m.multiplyScalar(-v.dot(y.up))), n = -(this._zoom - p - this._zoom) / this._zoom, g = this._getCameraDirection(ie), E = this._targetEnd.dot(g), C = b.copy(this._targetEnd).lerp(u, n), w = C.dot(g), T = g.multiplyScalar(
1520
+ ).unproject(y), m = L.set(0, 0, -1).applyQuaternion(y.quaternion), u = G.copy(v).add(m.multiplyScalar(-v.dot(y.up))), n = -(this._zoom - p - this._zoom) / this._zoom, _ = this._getCameraDirection(ie), E = this._targetEnd.dot(_), C = b.copy(this._targetEnd).lerp(u, n), w = C.dot(_), T = _.multiplyScalar(
1521
1521
  w - E
1522
1522
  );
1523
1523
  C.sub(T), this._boundary.clampPoint(C, C);
@@ -1527,7 +1527,7 @@ class $ extends Bt {
1527
1527
  }
1528
1528
  this._camera.zoom !== this._zoom && (this._camera.zoom = this._zoom, this._camera.updateProjectionMatrix(), this._updateNearPlaneCorners(), this._needsUpdate = !0), this._dragNeedsUpdate = !0;
1529
1529
  const h = this._collisionTest();
1530
- this._spherical.radius = Math.min(this._spherical.radius, h), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!M(this._focalOffset.x) || !M(this._focalOffset.y) || !M(this._focalOffset.z)) && (N.setFromMatrixColumn(this._camera.matrix, 0), H.setFromMatrixColumn(this._camera.matrix, 1), B.setFromMatrixColumn(this._camera.matrix, 2), N.multiplyScalar(this._focalOffset.x), H.multiplyScalar(-this._focalOffset.y), B.multiplyScalar(this._focalOffset.z), b.copy(N).add(H).add(B), this._camera.position.add(b), this._camera.updateMatrixWorld()), this._boundaryEnclosesCamera && this._encloseToBoundary(
1530
+ this._spherical.radius = Math.min(this._spherical.radius, h), this._spherical.makeSafe(), this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target), this._camera.lookAt(this._target), (!M(this._focalOffset.x) || !M(this._focalOffset.y) || !M(this._focalOffset.z)) && (N.setFromMatrixColumn(this._camera.matrix, 0), H.setFromMatrixColumn(this._camera.matrix, 1), Y.setFromMatrixColumn(this._camera.matrix, 2), N.multiplyScalar(this._focalOffset.x), H.multiplyScalar(-this._focalOffset.y), Y.multiplyScalar(this._focalOffset.z), b.copy(N).add(H).add(Y), this._camera.position.add(b), this._camera.updateMatrixWorld()), this._boundaryEnclosesCamera && this._encloseToBoundary(
1531
1531
  this._camera.position.copy(this._target),
1532
1532
  b.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),
1533
1533
  1
@@ -1573,9 +1573,9 @@ class $ extends Bt {
1573
1573
  */
1574
1574
  fromJSON(e, t = !1) {
1575
1575
  const s = JSON.parse(e);
1576
- this.enabled = s.enabled, this.minDistance = s.minDistance, this.maxDistance = se(s.maxDistance), this.minZoom = s.minZoom, this.maxZoom = se(s.maxZoom), this.minPolarAngle = s.minPolarAngle, this.maxPolarAngle = se(s.maxPolarAngle), this.minAzimuthAngle = se(s.minAzimuthAngle), this.maxAzimuthAngle = se(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(
1576
+ this.enabled = s.enabled, this.minDistance = s.minDistance, this.maxDistance = se(s.maxDistance), this.minZoom = s.minZoom, this.maxZoom = se(s.maxZoom), this.minPolarAngle = s.minPolarAngle, this.maxPolarAngle = se(s.maxPolarAngle), this.minAzimuthAngle = se(s.minAzimuthAngle), this.maxAzimuthAngle = se(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), F.setFromVector3(
1577
1577
  b.fromArray(s.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)
1578
- ), this.rotateTo(k.theta, k.phi, t), this.dollyTo(k.radius, t), this.zoomTo(s.zoom, t), this.setFocalOffset(
1578
+ ), this.rotateTo(F.theta, F.phi, t), this.dollyTo(F.radius, t), this.zoomTo(s.zoom, t), this.setFocalOffset(
1579
1579
  s.focalOffset[0],
1580
1580
  s.focalOffset[1],
1581
1581
  s.focalOffset[2],
@@ -1644,7 +1644,7 @@ class $ extends Bt {
1644
1644
  }
1645
1645
  }
1646
1646
  _updateNearPlaneCorners() {
1647
- if (Y(this._camera)) {
1647
+ if (B(this._camera)) {
1648
1648
  const e = this._camera, t = e.near, s = e.getEffectiveFOV() * ee, i = Math.tan(s * 0.5) * t, r = i * e.aspect;
1649
1649
  this._nearPlaneCorners[0].set(-r, -i, 0), this._nearPlaneCorners[1].set(r, -i, 0), this._nearPlaneCorners[2].set(r, i, 0), this._nearPlaneCorners[3].set(-r, i, 0);
1650
1650
  } else if (j(this._camera)) {
@@ -1658,7 +1658,7 @@ class $ extends Bt {
1658
1658
  if (!(this.colliderMeshes.length >= 1) || Ee(this._camera, "_collisionTest"))
1659
1659
  return e;
1660
1660
  const s = this._getTargetDirection(ie);
1661
- we.lookAt(Fe, s, this._camera.up);
1661
+ we.lookAt(ke, s, this._camera.up);
1662
1662
  for (let i = 0; i < 4; i++) {
1663
1663
  const r = L.copy(this._nearPlaneCorners[i]);
1664
1664
  r.applyMatrix4(we);
@@ -1771,7 +1771,7 @@ A.EventEmitter = A;
1771
1771
  A.prototype._events = void 0;
1772
1772
  A.prototype._eventsCount = 0;
1773
1773
  A.prototype._maxListeners = void 0;
1774
- var Ye = 10;
1774
+ var Be = 10;
1775
1775
  function _e(l) {
1776
1776
  if (typeof l != "function")
1777
1777
  throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof l);
@@ -1779,12 +1779,12 @@ function _e(l) {
1779
1779
  Object.defineProperty(A, "defaultMaxListeners", {
1780
1780
  enumerable: !0,
1781
1781
  get: function() {
1782
- return Ye;
1782
+ return Be;
1783
1783
  },
1784
1784
  set: function(l) {
1785
1785
  if (typeof l != "number" || l < 0 || st(l))
1786
1786
  throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + l + ".");
1787
- Ye = l;
1787
+ Be = l;
1788
1788
  }
1789
1789
  });
1790
1790
  A.init = function() {
@@ -2413,7 +2413,7 @@ class hs {
2413
2413
  this.event.removeAllListeners(), (e = this.controls) == null || e.dispose();
2414
2414
  }
2415
2415
  }
2416
- const Be = new oe(), ls = new yt(), Ze = new oe(), I = new fe(), cs = new fe();
2416
+ const Ye = new oe(), ls = new yt(), Ze = new oe(), I = new fe(), cs = new fe();
2417
2417
  class ds {
2418
2418
  constructor(e = {}) {
2419
2419
  const t = this;
@@ -2431,54 +2431,54 @@ class ds {
2431
2431
  width: s,
2432
2432
  height: i
2433
2433
  };
2434
- }, this.render = function(_, n) {
2435
- const g = n.projectionMatrix.elements[5] * o;
2436
- n.view && n.view.enabled ? (d.style.transform = `translate( ${-n.view.offsetX * (s / n.view.width)}px, ${-n.view.offsetY * (i / n.view.height)}px )`, d.style.transform += `scale( ${n.view.fullWidth / n.view.width}, ${n.view.fullHeight / n.view.height} )`) : d.style.transform = "", _.matrixWorldAutoUpdate === !0 && _.updateMatrixWorld(), n.parent === null && n.matrixWorldAutoUpdate === !0 && n.updateMatrixWorld();
2434
+ }, this.render = function(g, n) {
2435
+ const _ = n.projectionMatrix.elements[5] * o;
2436
+ n.view && n.view.enabled ? (d.style.transform = `translate( ${-n.view.offsetX * (s / n.view.width)}px, ${-n.view.offsetY * (i / n.view.height)}px )`, d.style.transform += `scale( ${n.view.fullWidth / n.view.width}, ${n.view.fullHeight / n.view.height} )`) : d.style.transform = "", g.matrixWorldAutoUpdate === !0 && g.updateMatrixWorld(), n.parent === null && n.matrixWorldAutoUpdate === !0 && n.updateMatrixWorld();
2437
2437
  let E, C;
2438
2438
  n.isOrthographicCamera && (E = -(n.right + n.left) / 2, C = (n.top + n.bottom) / 2);
2439
- const w = n.view && n.view.enabled ? n.view.height / n.view.fullHeight : 1, T = n.isOrthographicCamera ? `scale( ${w} )scale(` + g + ")translate(" + p(E) + "px," + p(C) + "px)" + y(n.matrixWorldInverse) : `scale( ${w} )translateZ(` + g + "px)" + y(n.matrixWorldInverse), R = (n.isPerspectiveCamera ? "perspective(" + g + "px) " : "") + T + "translate(" + r + "px," + o + "px)";
2440
- a.camera.style !== R && (f.style.transform = R, a.camera.style = R), u(_, _, n);
2441
- }, this.setSize = function(_, n) {
2442
- s = _, i = n, r = s / 2, o = i / 2, h.style.width = _ + "px", h.style.height = n + "px", d.style.width = _ + "px", d.style.height = n + "px", f.style.width = _ + "px", f.style.height = n + "px";
2439
+ const w = n.view && n.view.enabled ? n.view.height / n.view.fullHeight : 1, T = n.isOrthographicCamera ? `scale( ${w} )scale(` + _ + ")translate(" + p(E) + "px," + p(C) + "px)" + y(n.matrixWorldInverse) : `scale( ${w} )translateZ(` + _ + "px)" + y(n.matrixWorldInverse), R = (n.isPerspectiveCamera ? "perspective(" + _ + "px) " : "") + T + "translate(" + r + "px," + o + "px)";
2440
+ a.camera.style !== R && (f.style.transform = R, a.camera.style = R), u(g, g, n);
2441
+ }, this.setSize = function(g, n) {
2442
+ s = g, i = n, r = s / 2, o = i / 2, h.style.width = g + "px", h.style.height = n + "px", d.style.width = g + "px", d.style.height = n + "px", f.style.width = g + "px", f.style.height = n + "px";
2443
2443
  };
2444
- function p(_) {
2445
- return Math.abs(_) < 1e-10 ? 0 : _;
2444
+ function p(g) {
2445
+ return Math.abs(g) < 1e-10 ? 0 : g;
2446
2446
  }
2447
- function y(_) {
2448
- const n = _.elements;
2447
+ function y(g) {
2448
+ const n = g.elements;
2449
2449
  return "matrix3d(" + p(n[0]) + "," + p(-n[1]) + "," + p(n[2]) + "," + p(n[3]) + "," + p(n[4]) + "," + p(-n[5]) + "," + p(n[6]) + "," + p(n[7]) + "," + p(n[8]) + "," + p(-n[9]) + "," + p(n[10]) + "," + p(n[11]) + "," + p(n[12]) + "," + p(-n[13]) + "," + p(n[14]) + "," + p(n[15]) + ")";
2450
2450
  }
2451
- function v(_) {
2452
- const n = _.elements;
2451
+ function v(g) {
2452
+ const n = g.elements;
2453
2453
  return "translate(-50%,-50%)" + ("matrix3d(" + p(n[0]) + "," + p(n[1]) + "," + p(n[2]) + "," + p(n[3]) + "," + p(-n[4]) + "," + p(-n[5]) + "," + p(-n[6]) + "," + p(-n[7]) + "," + p(n[8]) + "," + p(n[9]) + "," + p(n[10]) + "," + p(n[11]) + "," + p(n[12]) + "," + p(n[13]) + "," + p(n[14]) + "," + p(n[15]) + ")");
2454
2454
  }
2455
- function m(_) {
2456
- _.isCSS3DObject && (_.element.style.display = "none");
2457
- for (let n = 0, g = _.children.length; n < g; n++)
2458
- m(_.children[n]);
2455
+ function m(g) {
2456
+ g.isCSS3DObject && (g.element.style.display = "none");
2457
+ for (let n = 0, _ = g.children.length; n < _; n++)
2458
+ m(g.children[n]);
2459
2459
  }
2460
- function u(_, n, g, E) {
2461
- if (_.visible === !1) {
2462
- m(_);
2460
+ function u(g, n, _, E) {
2461
+ if (g.visible === !1) {
2462
+ m(g);
2463
2463
  return;
2464
2464
  }
2465
- if (_.isCSS3DObject) {
2466
- const C = _.layers.test(g.layers) === !0, w = _.element;
2465
+ if (g.isCSS3DObject) {
2466
+ const C = g.layers.test(_.layers) === !0, w = g.element;
2467
2467
  if (w.style.display = C === !0 ? "" : "none", C === !0) {
2468
- _.onBeforeRender(t, n, g);
2468
+ g.onBeforeRender(t, n, _);
2469
2469
  let T;
2470
- _.isCSS3DSprite ? (I.copy(g.matrixWorldInverse), I.transpose(), _.rotation2D !== 0 && I.multiply(cs.makeRotationZ(_.rotation2D)), _.matrixWorld.decompose(Be, ls, Ze), I.setPosition(Be), I.scale(Ze), I.elements[3] = 0, I.elements[7] = 0, I.elements[11] = 0, I.elements[15] = 1, T = v(I)) : T = v(_.matrixWorld);
2471
- const P = a.objects.get(_);
2470
+ g.isCSS3DSprite ? (I.copy(_.matrixWorldInverse), I.transpose(), g.rotation2D !== 0 && I.multiply(cs.makeRotationZ(g.rotation2D)), g.matrixWorld.decompose(Ye, ls, Ze), I.setPosition(Ye), I.scale(Ze), I.elements[3] = 0, I.elements[7] = 0, I.elements[11] = 0, I.elements[15] = 1, T = v(I)) : T = v(g.matrixWorld);
2471
+ const P = a.objects.get(g);
2472
2472
  if (P === void 0 || P.style !== T) {
2473
2473
  w.style.transform = T;
2474
2474
  const R = { style: T };
2475
- a.objects.set(_, R);
2475
+ a.objects.set(g, R);
2476
2476
  }
2477
- w.parentNode !== f && f.appendChild(w), _.onAfterRender(t, n, g);
2477
+ w.parentNode !== f && f.appendChild(w), g.onAfterRender(t, n, _);
2478
2478
  }
2479
2479
  }
2480
- for (let C = 0, w = _.children.length; C < w; C++)
2481
- u(_.children[C], n, g);
2480
+ for (let C = 0, w = g.children.length; C < w; C++)
2481
+ u(g.children[C], n, _);
2482
2482
  }
2483
2483
  }
2484
2484
  }
@@ -2502,44 +2502,44 @@ class ps {
2502
2502
  };
2503
2503
  function d(m) {
2504
2504
  m.isCSS2DObject && (m.element.style.display = "none");
2505
- for (let u = 0, _ = m.children.length; u < _; u++)
2505
+ for (let u = 0, g = m.children.length; u < g; u++)
2506
2506
  d(m.children[u]);
2507
2507
  }
2508
- function f(m, u, _) {
2508
+ function f(m, u, g) {
2509
2509
  if (m.visible === !1) {
2510
2510
  d(m);
2511
2511
  return;
2512
2512
  }
2513
2513
  if (m.isCSS2DObject) {
2514
2514
  X.setFromMatrixPosition(m.matrixWorld), X.applyMatrix4(Ge);
2515
- const n = X.z >= -1 && X.z <= 1 && m.layers.test(_.layers) === !0, g = m.element;
2516
- g.style.display = n === !0 ? "" : "none", n === !0 && (m.onBeforeRender(t, u, _), g.style.transform = "translate(" + -100 * m.center.x + "%," + -100 * m.center.y + "%)translate(" + (X.x * r + r) + "px," + (-X.y * o + o) + "px)", g.parentNode !== h && h.appendChild(g), m.onAfterRender(t, u, _));
2515
+ const n = X.z >= -1 && X.z <= 1 && m.layers.test(g.layers) === !0, _ = m.element;
2516
+ _.style.display = n === !0 ? "" : "none", n === !0 && (m.onBeforeRender(t, u, g), _.style.transform = "translate(" + -100 * m.center.x + "%," + -100 * m.center.y + "%)translate(" + (X.x * r + r) + "px," + (-X.y * o + o) + "px)", _.parentNode !== h && h.appendChild(_), m.onAfterRender(t, u, g));
2517
2517
  const E = {
2518
- distanceToCameraSquared: p(_, m)
2518
+ distanceToCameraSquared: p(g, m)
2519
2519
  };
2520
2520
  a.objects.set(m, E);
2521
2521
  }
2522
- for (let n = 0, g = m.children.length; n < g; n++)
2523
- f(m.children[n], u, _);
2522
+ for (let n = 0, _ = m.children.length; n < _; n++)
2523
+ f(m.children[n], u, g);
2524
2524
  }
2525
2525
  function p(m, u) {
2526
2526
  return Ke.setFromMatrixPosition(m.matrixWorld), Xe.setFromMatrixPosition(u.matrixWorld), Ke.distanceToSquared(Xe);
2527
2527
  }
2528
2528
  function y(m) {
2529
2529
  const u = [];
2530
- return m.traverseVisible(function(_) {
2531
- _.isCSS2DObject && u.push(_);
2530
+ return m.traverseVisible(function(g) {
2531
+ g.isCSS2DObject && u.push(g);
2532
2532
  }), u;
2533
2533
  }
2534
2534
  function v(m) {
2535
- const u = y(m).sort(function(n, g) {
2536
- if (n.renderOrder !== g.renderOrder)
2537
- return g.renderOrder - n.renderOrder;
2538
- const E = a.objects.get(n).distanceToCameraSquared, C = a.objects.get(g).distanceToCameraSquared;
2535
+ const u = y(m).sort(function(n, _) {
2536
+ if (n.renderOrder !== _.renderOrder)
2537
+ return _.renderOrder - n.renderOrder;
2538
+ const E = a.objects.get(n).distanceToCameraSquared, C = a.objects.get(_).distanceToCameraSquared;
2539
2539
  return E - C;
2540
- }), _ = u.length;
2541
- for (let n = 0, g = u.length; n < g; n++)
2542
- u[n].element.style.zIndex = _ - n;
2540
+ }), g = u.length;
2541
+ for (let n = 0, _ = u.length; n < _; n++)
2542
+ u[n].element.style.zIndex = g - n;
2543
2543
  }
2544
2544
  }
2545
2545
  }
@@ -2657,7 +2657,7 @@ const us = {
2657
2657
  }`
2658
2658
  )
2659
2659
  };
2660
- class fs extends Ft {
2660
+ class fs extends kt {
2661
2661
  constructor() {
2662
2662
  super();
2663
2663
  const e = us;
@@ -2666,7 +2666,7 @@ class fs extends Ft {
2666
2666
  uniforms: this.uniforms,
2667
2667
  vertexShader: e.vertexShader,
2668
2668
  fragmentShader: e.fragmentShader
2669
- }), this.fsQuad = new kt(this.material);
2669
+ }), this.fsQuad = new Ft(this.material);
2670
2670
  }
2671
2671
  }
2672
2672
  const _s = (l) => {
@@ -2896,8 +2896,8 @@ class $e extends O.Loader {
2896
2896
  o.removeEventListener("load", v, !1), o.removeEventListener("error", m, !1);
2897
2897
  }, v = () => {
2898
2898
  y(), r.needsUpdate = !0, t && t(r);
2899
- }, m = (_) => {
2900
- y(), i && i(_), this.manager.itemError(e), this.manager.itemEnd(e);
2899
+ }, m = (g) => {
2900
+ y(), i && i(g), this.manager.itemError(e), this.manager.itemEnd(e);
2901
2901
  };
2902
2902
  o.addEventListener("load", v, !1), o.addEventListener("error", m, !1);
2903
2903
  const u = window.URL.createObjectURL(d);
@@ -3037,7 +3037,7 @@ class Ss {
3037
3037
  const s = (a = t == null ? void 0 : t.type) != null ? a : this.getAssetType(e);
3038
3038
  if (!s)
3039
3039
  return;
3040
- const i = (t == null ? void 0 : t.cache) !== !1, r = Yt();
3040
+ const i = (t == null ? void 0 : t.cache) !== !1, r = Bt();
3041
3041
  if (i) {
3042
3042
  if (this.assets.has(e))
3043
3043
  return this.assets.get(e);
@@ -3156,8 +3156,8 @@ class Rs {
3156
3156
  for (const u of m.objArr) {
3157
3157
  if (!u.object3d || !u.visibleWithAncestors) continue;
3158
3158
  h.has(u) || (h.set(u, /* @__PURE__ */ new Map()), d.push(u));
3159
- const _ = h.get(u);
3160
- _.has(m.type) || _.set(m.type, []), _.get(m.type).push(m.cb);
3159
+ const g = h.get(u);
3160
+ g.has(m.type) || g.set(m.type, []), g.get(m.type).push(m.cb);
3161
3161
  }
3162
3162
  if (d.length === 0) return;
3163
3163
  const f = d.map((m) => m.object3d);
@@ -3360,30 +3360,37 @@ class Us extends Rs {
3360
3360
  const i = this.objectNamesToFactories.get(e);
3361
3361
  if (i) {
3362
3362
  t || (t = {}), t.target === void 0 && (t.target = s);
3363
- const { key: d } = t;
3364
- let f = `${e}${d ? `#${d}` : ""}`;
3365
- this.objects.has(f) && (f.includes("#") ? f += `-${Re()}` : f += `#${Re()}`);
3366
- const p = t.target, y = (r = t.onTop) != null ? r : 0, v = (o = t.prefab) != null ? o : !1, m = (a = t.create) != null ? a : !0, u = new i().create(t);
3367
- let _;
3368
- p === null ? _ = null : typeof p == "string" ? _ = this.objects.get(p) : (h = p == null ? void 0 : p.objectType) != null && h.startsWith("BaseObject") || p ? _ = p : v ? _ = this.prefabGroup : _ = this.group, m === !1 ? u.create = () => {
3369
- } : m !== !0 && (u.create = () => {
3370
- m(u);
3371
- }), u.pencil = this.pencil, u.lead = this, u.key = f, u.prefab = v, u.objectType = `BaseObject#${e}`, u.objectOptions = t, this.objects.set(f, u);
3372
- const n = this.addBaseObject(u, _, y);
3373
- return this.objectsPm.set(f, n), yield n, this.objectsPm.delete(f), u;
3363
+ const d = t.target, f = (r = t.onTop) != null ? r : 0, p = (o = t.prefab) != null ? o : !1, y = (a = t.create) != null ? a : !0, v = new i().create(t);
3364
+ let m;
3365
+ return d === null ? m = null : typeof d == "string" ? m = this.objects.get(d) : (h = d == null ? void 0 : d.objectType) != null && h.startsWith("BaseObject") || d ? m = d : p ? m = this.prefabGroup : m = this.group, y === !1 ? v.create = () => {
3366
+ } : y !== !0 && (v.create = () => {
3367
+ y(v);
3368
+ }), v.pencil = this.pencil, v.lead = this, v.prefab = p, v.objectType = `BaseObject#${e}`, v.objectOptions = t, this.setBaseObjectKey(v, t.key, !0), this.objectsPm.set(
3369
+ v.key,
3370
+ this.addBaseObject(v, m, f)
3371
+ ), yield this.objectsPm.get(v.key), this.objectsPm.delete(v.key), v;
3374
3372
  }
3375
3373
  throw new Error(`Unrecognized:${e}`);
3376
3374
  });
3377
3375
  }
3378
- changeBaseObjectKey(e, t, s = !0) {
3379
- const i = e.key;
3380
- this.objects.delete(i);
3381
- const [r] = i.split("#"), o = s ? `${r}#${t}` : `${t}`;
3382
- this.objects.set(o, e), e.key = o;
3376
+ setBaseObjectKey(e, t = "", s = !0) {
3377
+ const i = e.objectType, [, r] = i.split("#");
3378
+ let o = s || !t ? `${r}${t ? `#${t}` : ""}` : t;
3379
+ return this.objects.has(o) && (o.includes("#") ? o += `-${Re()}` : o += `#${Re()}`), e.key = o, this.objects.set(o, e), o;
3380
+ }
3381
+ // For updating an existing object's key
3382
+ updateBaseObjectKey(e, t = "", s = !0) {
3383
+ let i;
3384
+ for (const [r, o] of this.objects.entries())
3385
+ if (o === e) {
3386
+ i = r;
3387
+ break;
3388
+ }
3389
+ return i ? (this.objects.delete(i), this.setBaseObjectKey(e, t, s)) : this.setBaseObjectKey(e, t, s);
3383
3390
  }
3384
3391
  addBaseObject(e, t, s) {
3385
3392
  return J(this, null, function* () {
3386
- return yield e.create(), e.object3d && (s && e.setTop(s), t !== null && (t.add(e.object3d), this.objMap.set(e.object3d, e))), e.render(), e;
3393
+ yield e.create(), e.object3d && (s && e.setTop(s), t !== null && (t.add(e.object3d), this.objMap.set(e.object3d, e))), e.render();
3387
3394
  });
3388
3395
  }
3389
3396
  erase(...e) {
@@ -3565,17 +3572,17 @@ const ue = class ue {
3565
3572
  pencil: this
3566
3573
  });
3567
3574
  this.sceneController = y, this.cameraController = p, this.controlsController = v, this.rendererController = f, this.loaderController = m, this.leadController = u;
3568
- const _ = this.addPage({
3575
+ const g = this.addPage({
3569
3576
  sceneOptions: this.options.scene,
3570
3577
  cameraOptions: this.options.camera
3571
3578
  });
3572
- if (this.showPage(_), s) {
3573
- const g = new ns({
3579
+ if (this.showPage(g), s) {
3580
+ const _ = new ns({
3574
3581
  container: e,
3575
3582
  sceneController: y,
3576
3583
  cameraController: p
3577
3584
  });
3578
- g.add(y.scene), this.helperController = g, i && g.addViewHelper();
3585
+ _.add(y.scene), this.helperController = _, i && _.addViewHelper();
3579
3586
  }
3580
3587
  e.appendChild(f.renderer.domElement);
3581
3588
  }