@shopware-ag/dive 2.1.1 → 2.2.0

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.
Files changed (30) hide show
  1. package/build/chunks/{AssetCache-B02vAmfm.cjs → AssetCache-BMVppBkc.cjs} +1 -1
  2. package/build/chunks/{AssetCache-DP95DtBA.mjs → AssetCache-i1EZuRDg.mjs} +1 -1
  3. package/build/chunks/{AssetLoader-BOnrkFcl.mjs → AssetLoader-DBUfBwc8.mjs} +2 -2
  4. package/build/chunks/{AssetLoader-C6MLrKu2.cjs → AssetLoader-YnT__zG9.cjs} +1 -1
  5. package/build/chunks/FileTypes-BkOFcrLx.cjs +29 -0
  6. package/build/chunks/{FileTypes-D5zw1toN.mjs → FileTypes-CzAW1KDG.mjs} +361 -394
  7. package/build/chunks/{SelectTool-J55L_APQ.cjs → SelectTool-C_aEE9Wg.cjs} +1 -1
  8. package/build/chunks/{SelectTool-BNZdhIaO.mjs → SelectTool-DWWRFEd6.mjs} +1 -1
  9. package/build/components/model/Model.d.ts +5 -4
  10. package/build/components/primitive/Primitive.d.ts +6 -7
  11. package/build/dive.cjs +1 -1
  12. package/build/dive.mjs +2 -2
  13. package/build/plugins/ar/index.cjs +1 -1
  14. package/build/plugins/ar/index.mjs +1 -1
  15. package/build/plugins/assetcache/index.cjs +1 -1
  16. package/build/plugins/assetcache/index.mjs +1 -1
  17. package/build/plugins/assetloader/index.cjs +1 -1
  18. package/build/plugins/assetloader/index.mjs +1 -1
  19. package/build/plugins/orbitcontroller/index.cjs +1 -1
  20. package/build/plugins/orbitcontroller/index.mjs +1 -1
  21. package/build/plugins/orientationdisplay/index.cjs +1 -1
  22. package/build/plugins/orientationdisplay/index.mjs +1 -1
  23. package/build/plugins/quickview/index.cjs +1 -1
  24. package/build/plugins/quickview/index.mjs +1 -1
  25. package/build/plugins/state/index.cjs +1 -1
  26. package/build/plugins/state/index.mjs +2 -2
  27. package/build/plugins/toolbox/index.cjs +1 -1
  28. package/build/plugins/toolbox/index.mjs +2 -2
  29. package/package.json +1 -1
  30. package/build/chunks/FileTypes-BobMthbh.cjs +0 -29
@@ -1,10 +1,10 @@
1
- var $ = Object.defineProperty;
2
- var j = (r, s, t) => s in r ? $(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
3
- var i = (r, s, t) => j(r, typeof s != "symbol" ? s + "" : s, t);
4
- import { WebGLRenderer as tt, PCFSoftShadowMap as et, PCFShadowMap as it, BasicShadowMap as st, MathUtils as S, Object3D as w, AmbientLight as at, PointLight as nt, SphereGeometry as I, MeshBasicMaterial as G, FrontSide as F, Mesh as P, HemisphereLight as ot, DirectionalLight as rt, Vector3 as h, Box3 as L, MeshStandardMaterial as k, Raycaster as U, Color as g, CylinderGeometry as ht, BufferGeometry as H, BufferAttribute as A, BoxGeometry as M, ConeGeometry as lt, LineDashedMaterial as dt, Line as ct, PlaneGeometry as ut, GridHelper as pt, Scene as mt, TOUCH as f, MOUSE as m, EventDispatcher as gt, Spherical as C, Vector2 as p, Quaternion as T, AxesHelper as _t, Matrix4 as ft, OrthographicCamera as wt, Vector4 as yt, Box3Helper as bt, Sphere as Dt } from "three";
5
- import { P as _, U as Et, H as St, C as y, a as Pt, D as O } from "./PerspectiveCamera-8tnOn5YS.mjs";
6
- import x from "three-spritetext";
7
- class vt {
1
+ var j = Object.defineProperty;
2
+ var tt = (o, s, t) => s in o ? j(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
3
+ var i = (o, s, t) => tt(o, typeof s != "symbol" ? s + "" : s, t);
4
+ import { WebGLRenderer as et, PCFSoftShadowMap as it, PCFShadowMap as st, BasicShadowMap as at, MathUtils as x, Object3D as f, AmbientLight as nt, PointLight as rt, SphereGeometry as R, MeshBasicMaterial as H, FrontSide as Y, Mesh as M, HemisphereLight as ot, DirectionalLight as ht, Vector3 as h, Box3 as w, Quaternion as k, Box3Helper as lt, Sphere as dt, MeshStandardMaterial as A, Raycaster as ct, CylinderGeometry as ut, BufferGeometry as W, BufferAttribute as z, BoxGeometry as I, ConeGeometry as pt, LineDashedMaterial as mt, Line as _t, PlaneGeometry as gt, Color as _, GridHelper as ft, Scene as wt, TOUCH as m, MOUSE as p, EventDispatcher as yt, Spherical as B, Vector2 as c, AxesHelper as bt, Matrix4 as Dt, OrthographicCamera as Et, Vector4 as St } from "three";
5
+ import { P as g, U as Pt, H as vt, C as y, a as xt, D as G } from "./PerspectiveCamera-8tnOn5YS.mjs";
6
+ import T from "three-spritetext";
7
+ class Mt {
8
8
  constructor() {
9
9
  i(this, "isDIVEClock", !0);
10
10
  i(this, "_lastTime", 0);
@@ -36,7 +36,7 @@ class vt {
36
36
  this._lastTime = s, this._tickers.forEach((e) => e.tick(t)), requestAnimationFrame(this._tick.bind(this));
37
37
  }
38
38
  }
39
- const Y = {
39
+ const Z = {
40
40
  canvas: void 0,
41
41
  antialias: !0,
42
42
  alpha: !0,
@@ -48,13 +48,13 @@ const Y = {
48
48
  shadows: !0,
49
49
  shadowQuality: "high"
50
50
  };
51
- class W {
51
+ class N {
52
52
  constructor(s, t, e) {
53
53
  i(this, "isDIVERenderer", !0);
54
54
  i(this, "_webglrenderer");
55
55
  i(this, "_settings");
56
56
  this._scene = s, this._camera = t, this._settings = {
57
- ...Y,
57
+ ...Z,
58
58
  ...e ?? {}
59
59
  }, this._webglrenderer = this._createWebGLRenderer();
60
60
  }
@@ -77,20 +77,20 @@ class W {
77
77
  this._webglrenderer.dispose(), this._settings.canvas = s, this._webglrenderer = this._createWebGLRenderer();
78
78
  }
79
79
  _createWebGLRenderer() {
80
- const s = new tt(this._settings);
81
- return s.shadowMap.enabled = this._settings.shadows, s.shadowMap.type = this._settings.shadowQuality === "high" ? et : this._settings.shadowQuality === "medium" ? it : st, s.setPixelRatio(window.devicePixelRatio), s;
80
+ const s = new et(this._settings);
81
+ return s.shadowMap.enabled = this._settings.shadows, s.shadowMap.type = this._settings.shadowQuality === "high" ? it : this._settings.shadowQuality === "medium" ? st : at, s.setPixelRatio(window.devicePixelRatio), s;
82
82
  }
83
83
  }
84
- const te = W;
85
- class Mt {
84
+ const te = N;
85
+ class Lt {
86
86
  constructor(s, t) {
87
87
  i(this, "isDIVEResizeManager", !0);
88
88
  i(this, "_resizeObserver");
89
89
  i(this, "_width", 0);
90
90
  i(this, "_height", 0);
91
91
  this._renderer = s, this._camera = t, this._resizeObserver = new ResizeObserver((e) => {
92
- const a = e[0], { width: n, height: o } = a.contentRect;
93
- n === this._width && o === this._height || (this._renderer.onResize(n, o), this._camera.onResize(n, o), this._width = n, this._height = o);
92
+ const a = e[0], { width: n, height: r } = a.contentRect;
93
+ n === this._width && r === this._height || (this._renderer.onResize(n, r), this._camera.onResize(n, r), this._width = n, this._height = r);
94
94
  }), this._observeCanvas(this._renderer.canvas);
95
95
  }
96
96
  setCanvas(s) {
@@ -111,18 +111,18 @@ class Mt {
111
111
  }
112
112
  }
113
113
  }
114
- class B {
114
+ class F {
115
115
  constructor(s, t, e) {
116
116
  i(this, "isDIVEView", !0);
117
- i(this, "uuid", S.generateUUID());
117
+ i(this, "uuid", x.generateUUID());
118
118
  i(this, "_paused", !1);
119
119
  i(this, "_renderer");
120
120
  i(this, "_resizeManager");
121
- this._scene = s, this._camera = t, this._settings = e, this._renderer = new W(
121
+ this._scene = s, this._camera = t, this._settings = e, this._renderer = new N(
122
122
  this._scene,
123
123
  this._camera,
124
124
  this._settings
125
- ), this._resizeManager = new Mt(
125
+ ), this._resizeManager = new Lt(
126
126
  this._renderer,
127
127
  this._camera
128
128
  );
@@ -159,14 +159,14 @@ class B {
159
159
  this._paused = !1;
160
160
  }
161
161
  }
162
- class xt extends w {
162
+ class It extends f {
163
163
  constructor() {
164
164
  super();
165
165
  i(this, "isDIVELight", !0);
166
166
  i(this, "isDIVEAmbientLight", !0);
167
167
  i(this, "isSelectable", !0);
168
168
  i(this, "_light");
169
- this.name = "DIVEAmbientLight", this._light = new at(16777215, 1), this._light.layers.mask = _, this.add(this._light);
169
+ this.name = "DIVEAmbientLight", this._light = new nt(16777215, 1), this._light.layers.mask = g, this.add(this._light);
170
170
  }
171
171
  setColor(t) {
172
172
  this._light.color = t;
@@ -178,7 +178,7 @@ class xt extends w {
178
178
  this._light.visible = t;
179
179
  }
180
180
  }
181
- class Tt extends w {
181
+ class Tt extends f {
182
182
  constructor() {
183
183
  super();
184
184
  i(this, "isDIVELight", !0);
@@ -188,18 +188,18 @@ class Tt extends w {
188
188
  i(this, "gizmo", null);
189
189
  i(this, "light");
190
190
  i(this, "mesh");
191
- this.name = "DIVEPointLight", this.light = new nt(16777215, 1), this.light.layers.mask = _, this.light.castShadow = !0, this.light.shadow.mapSize.width = 512, this.light.shadow.mapSize.height = 512, this.add(this.light);
192
- const t = 0.1, e = new I(
191
+ this.name = "DIVEPointLight", this.light = new rt(16777215, 1), this.light.layers.mask = g, this.light.castShadow = !0, this.light.shadow.mapSize.width = 512, this.light.shadow.mapSize.height = 512, this.add(this.light);
192
+ const t = 0.1, e = new R(
193
193
  t,
194
194
  t * 320,
195
195
  t * 320
196
- ), a = new G({
196
+ ), a = new H({
197
197
  color: this.light.color,
198
198
  transparent: !0,
199
199
  opacity: 0.8,
200
- side: F
200
+ side: Y
201
201
  });
202
- this.mesh = new P(e, a), this.mesh.layers.mask = Et, this.add(this.mesh);
202
+ this.mesh = new M(e, a), this.mesh.layers.mask = Pt, this.add(this.mesh);
203
203
  }
204
204
  setColor(t) {
205
205
  this.light.color = t, this.mesh.material.color = t;
@@ -236,7 +236,7 @@ class Tt extends w {
236
236
  });
237
237
  }
238
238
  }
239
- class It extends w {
239
+ class kt extends f {
240
240
  constructor() {
241
241
  super();
242
242
  i(this, "isDIVELight", !0);
@@ -244,7 +244,7 @@ class It extends w {
244
244
  i(this, "isSelectable", !0);
245
245
  i(this, "_hemiLight");
246
246
  i(this, "_dirLight");
247
- this.name = "DIVESceneLight", this._hemiLight = new ot(16777215, 16777215, 2), this._hemiLight.layers.mask = _, this._hemiLight.position.set(0, 50, 0), this._hemiLight.visible = !0, this.add(this._hemiLight), this._dirLight = new rt(16777215, 3), this._dirLight.layers.mask = _, this._dirLight.position.set(1, 1.75, 1), this._dirLight.position.multiplyScalar(30), this._dirLight.castShadow = !0, this._dirLight.visible = !0, this._dirLight.shadow.mapSize.width = 2048, this._dirLight.shadow.mapSize.height = 2048;
247
+ this.name = "DIVESceneLight", this._hemiLight = new ot(16777215, 16777215, 2), this._hemiLight.layers.mask = g, this._hemiLight.position.set(0, 50, 0), this._hemiLight.visible = !0, this.add(this._hemiLight), this._dirLight = new ht(16777215, 3), this._dirLight.layers.mask = g, this._dirLight.position.set(1, 1.75, 1), this._dirLight.position.multiplyScalar(30), this._dirLight.castShadow = !0, this._dirLight.visible = !0, this._dirLight.shadow.mapSize.width = 2048, this._dirLight.shadow.mapSize.height = 2048;
248
248
  const t = 5;
249
249
  this._dirLight.shadow.camera.left = -5, this._dirLight.shadow.camera.right = t, this._dirLight.shadow.camera.top = t, this._dirLight.shadow.camera.bottom = -5, this._dirLight.shadow.camera.far = 3500, this.add(this._dirLight);
250
250
  }
@@ -258,8 +258,8 @@ class It extends w {
258
258
  this._hemiLight.visible = t, this._dirLight.visible = t;
259
259
  }
260
260
  }
261
- const V = (r) => r.parent ? V(r.parent) : r;
262
- class v extends w {
261
+ const X = (o) => o.parent ? X(o.parent) : o;
262
+ class C extends f {
263
263
  constructor() {
264
264
  super();
265
265
  i(this, "isSelectable", !0);
@@ -268,7 +268,7 @@ class v extends w {
268
268
  i(this, "gizmo", null);
269
269
  i(this, "_positionWorldBuffer");
270
270
  i(this, "_boundingBox");
271
- this.layers.mask = _, this._positionWorldBuffer = new h(), this._boundingBox = new L();
271
+ this.layers.mask = g, this._positionWorldBuffer = new h(), this._boundingBox = new w();
272
272
  }
273
273
  setPosition(t) {
274
274
  if (!this.parent) {
@@ -329,10 +329,139 @@ class v extends w {
329
329
  });
330
330
  }
331
331
  }
332
- class Lt extends v {
332
+ class V extends C {
333
+ /**
334
+ * Creates a new BoundingBox instance for the specified 3D object.
335
+ *
336
+ * The constructor computes both a bounding box and bounding sphere for the given object.
337
+ * It handles complex objects with multiple meshes and nested transformations.
338
+ *
339
+ * @param object - The 3D object to compute bounding volumes for
340
+ * @param axisAligned - Whether to create an axis-aligned bounding box (true) or oriented bounding box (false). Defaults to false.
341
+ * @param wireframeColor - The color for the wireframe helpers. Can be a hex number or ColorRepresentation. Defaults to green (0x00ff00).
342
+ *
343
+ * @example
344
+ * ```typescript
345
+ * // Create an oriented bounding box (aligned with object's rotation)
346
+ * const obb = new BoundingBox(mesh, false, 0x00ff00);
347
+ *
348
+ * // Create an axis-aligned bounding box (aligned with world coordinates)
349
+ * const aabb = new BoundingBox(mesh, true, 0xff0000);
350
+ *
351
+ * // Use default green color
352
+ * const defaultBox = new BoundingBox(mesh);
353
+ * ```
354
+ */
355
+ constructor(t, e = !1, a = 65280) {
356
+ super();
357
+ /** The computed bounding box (Box3) */
358
+ i(this, "_box");
359
+ /** The computed bounding sphere (Sphere) */
360
+ i(this, "_sphere");
361
+ /** The center point of the bounding box */
362
+ i(this, "_center");
363
+ /** The radius of the bounding sphere */
364
+ i(this, "_radius");
365
+ /** Visual helper for the bounding box wireframe */
366
+ i(this, "_boxHelper");
367
+ /** Visual helper for the bounding sphere wireframe */
368
+ i(this, "_sphereHelper");
369
+ /** The dimensions (width, height, depth) of the bounding box */
370
+ i(this, "_size");
371
+ const n = new w();
372
+ e ? n.setFromObject(t) : (t.updateWorldMatrix(!0, !0), t.traverse((l) => {
373
+ if (l.isMesh) {
374
+ const d = l, u = d.geometry.clone();
375
+ u.applyMatrix4(d.matrixWorld);
376
+ const D = d.getWorldQuaternion(new k()).invert();
377
+ u.applyQuaternion(D), u.computeBoundingBox(), u.boundingBox && n.union(u.boundingBox);
378
+ }
379
+ })), this.rotation.copy(t.rotation), this._box = n, this._size = n.getSize(new h()), this._center = n.getCenter(new h()), this._boxHelper = new lt(this._box, a), this._boxHelper.visible = !1, this.add(this._boxHelper), this._sphere = n.getBoundingSphere(new dt()), this._radius = this._sphere.radius;
380
+ const r = new R(this._radius, 32, 32);
381
+ r.translate(this._center.x, this._center.y, this._center.z), this._sphereHelper = new M(
382
+ r,
383
+ new H({ color: a, wireframe: !0 })
384
+ ), this._sphereHelper.visible = !1, this.add(this._sphereHelper);
385
+ }
386
+ /**
387
+ * Gets the computed bounding box.
388
+ * @returns The Box3 instance representing the bounding box
389
+ */
390
+ get box() {
391
+ return this._box;
392
+ }
393
+ /**
394
+ * Gets the computed bounding sphere.
395
+ * @returns The Sphere instance representing the bounding sphere
396
+ */
397
+ get sphere() {
398
+ return this._sphere;
399
+ }
400
+ /**
401
+ * Gets the center point of the bounding box.
402
+ * @returns A Vector3 representing the center coordinates
403
+ */
404
+ get center() {
405
+ return this._center;
406
+ }
407
+ /**
408
+ * Gets the radius of the bounding sphere.
409
+ * @returns The radius as a number
410
+ */
411
+ get radius() {
412
+ return this._radius;
413
+ }
414
+ /**
415
+ * Gets the dimensions of the bounding box.
416
+ * @returns A Vector3 representing width, height, and depth
417
+ */
418
+ get size() {
419
+ return this._size;
420
+ }
421
+ /**
422
+ * Sets the visibility of the bounding box wireframe helper.
423
+ *
424
+ * @param visible - Whether the box helper should be visible
425
+ *
426
+ * @example
427
+ * ```typescript
428
+ * const boundingBox = new BoundingBox(mesh);
429
+ *
430
+ * // Show the bounding box wireframe
431
+ * boundingBox.setBoxHelperVisible(true);
432
+ *
433
+ * // Hide the bounding box wireframe
434
+ * boundingBox.setBoxHelperVisible(false);
435
+ * ```
436
+ */
437
+ setBoxHelperVisible(t) {
438
+ this._boxHelper.visible = t;
439
+ }
440
+ /**
441
+ * Sets the visibility of the bounding sphere wireframe helper.
442
+ *
443
+ * @param visible - Whether the sphere helper should be visible
444
+ *
445
+ * @example
446
+ * ```typescript
447
+ * const boundingBox = new BoundingBox(mesh);
448
+ *
449
+ * // Show the bounding sphere wireframe
450
+ * boundingBox.setSphereHelperVisible(true);
451
+ *
452
+ * // Hide the bounding sphere wireframe
453
+ * boundingBox.setSphereHelperVisible(false);
454
+ * ```
455
+ */
456
+ setSphereHelperVisible(t) {
457
+ this._sphereHelper.visible = t;
458
+ }
459
+ }
460
+ class q extends C {
333
461
  constructor() {
334
462
  super();
335
463
  i(this, "isDIVEModel", !0);
464
+ i(this, "_gltf", null);
336
465
  i(this, "_mesh", null);
337
466
  i(this, "_material", null);
338
467
  i(this, "_assetLoader", null);
@@ -344,34 +473,36 @@ class Lt extends v {
344
473
  async setFromURL(t) {
345
474
  const a = await (await this._getAssetLoader()).load(t);
346
475
  return this.setFromGLTF(a), import("../plugins/state/index.mjs").then(({ State: n }) => {
347
- var o;
348
- (o = n.get(this.userData.id)) == null || o.performAction("MODEL_LOADED", {
476
+ var r;
477
+ (r = n.get(this.userData.id)) == null || r.performAction("MODEL_LOADED", {
349
478
  id: this.userData.id
350
479
  });
351
480
  }), this;
352
481
  }
353
482
  setFromGLTF(t) {
354
- return this.clear(), this._boundingBox.makeEmpty(), t.traverse((e) => {
483
+ return this.clear(), this._boundingBox.makeEmpty(), this._gltf = t, this._gltf.name = "GLTF", this._gltf.traverse((e) => {
355
484
  e.castShadow = !0, e.receiveShadow = !0, e.layers.mask = this.layers.mask, this._boundingBox.expandByObject(e), !this._mesh && "isMesh" in e && (this._mesh = e, this._material ? this._mesh.material = this._material : this._material = e.material);
356
- }), this.add(t), this;
485
+ }), this.add(this._gltf), this;
357
486
  }
358
487
  setMaterial(t) {
359
- this._material || (this._material = new k()), t.vertexColors !== void 0 && (this._material.vertexColors = t.vertexColors), t.color !== void 0 && this._material.color.set(t.color), t.map !== void 0 && (this._material.map = t.map), t.normalMap !== void 0 && (this._material.normalMap = t.normalMap), t.roughness !== void 0 && (this._material.roughness = t.roughness), t.roughnessMap !== void 0 && (this._material.roughnessMap = t.roughnessMap, this._material.roughnessMap && (this._material.roughness = 1)), t.metalness !== void 0 && (this._material.metalness = t.metalness), t.metalnessMap !== void 0 && (this._material.metalnessMap = t.metalnessMap, this._material.metalnessMap && (this._material.metalness = 1)), this._mesh && (this._mesh.material = this._material);
488
+ this._material || (this._material = new A()), t.vertexColors !== void 0 && (this._material.vertexColors = t.vertexColors), t.color !== void 0 && this._material.color.set(t.color), t.map !== void 0 && (this._material.map = t.map), t.normalMap !== void 0 && (this._material.normalMap = t.normalMap), t.roughness !== void 0 && (this._material.roughness = t.roughness), t.roughnessMap !== void 0 && (this._material.roughnessMap = t.roughnessMap, this._material.roughnessMap && (this._material.roughness = 1)), t.metalness !== void 0 && (this._material.metalness = t.metalness), t.metalnessMap !== void 0 && (this._material.metalnessMap = t.metalnessMap, this._material.metalnessMap && (this._material.metalness = 1)), this._mesh && (this._mesh.material = this._material);
360
489
  }
361
490
  placeOnFloor() {
362
- var n, o, l, c;
363
- const t = this.getWorldPosition(this._positionWorldBuffer), e = t.clone();
364
- (o = (n = this._mesh) == null ? void 0 : n.geometry) == null || o.computeBoundingBox();
365
- const a = (c = (l = this._mesh) == null ? void 0 : l.geometry) == null ? void 0 : c.boundingBox;
366
- !a || !this._mesh || (t.y = t.y - this._mesh.localToWorld(a.min.clone()).y, t.y !== e.y && import("../plugins/state/index.mjs").then(({ State: d }) => {
367
- var u;
368
- (u = d.get(this.userData.id)) == null || u.performAction("UPDATE_OBJECT", {
491
+ this.updateWorldMatrix(!0, !0);
492
+ const t = this.getWorldPosition(this._positionWorldBuffer), e = t.clone(), a = new w();
493
+ this.children.forEach((r) => {
494
+ r instanceof V || a.expandByObject(r, !0);
495
+ });
496
+ const n = -a.min.y;
497
+ Math.abs(n) < 1e-9 || (t.y += n, t.y !== e.y && (this.setPosition(t), import("../plugins/state/index.mjs").then(({ State: r }) => {
498
+ var l;
499
+ (l = r.get(this.userData.id)) == null || l.performAction("UPDATE_OBJECT", {
369
500
  id: this.userData.id,
370
501
  position: t,
371
502
  rotation: this.rotation,
372
503
  scale: this.scale
373
504
  });
374
- }));
505
+ }), this.onMove()));
375
506
  }
376
507
  dropIt() {
377
508
  if (!this.parent) {
@@ -381,89 +512,54 @@ class Lt extends v {
381
512
  );
382
513
  return;
383
514
  }
384
- const t = this._boundingBox.min.y * this.scale.y, e = this.localToWorld(
385
- this._boundingBox.getCenter(new h()).multiply(this.scale)
386
- );
387
- e.y = t + this.position.y;
388
- const a = new U(e, new h(0, -1, 0));
389
- a.layers.mask = _;
390
- const n = a.intersectObjects(
391
- V(this).root.children,
515
+ const t = this.getWorldPosition(this._positionWorldBuffer), e = t.clone(), a = new w();
516
+ this.children.forEach((d) => {
517
+ d instanceof V || a.expandByObject(d, !0);
518
+ });
519
+ const n = a.getCenter(new h());
520
+ n.y = a.min.y;
521
+ const r = new ct(n, new h(0, -1, 0));
522
+ r.layers.mask = g;
523
+ const l = r.intersectObjects(
524
+ X(this).root.children,
392
525
  !0
393
526
  );
394
- if (n.length > 0) {
395
- const o = n[0].object;
396
- o.geometry.computeBoundingBox();
397
- const l = o.geometry.boundingBox, c = o.localToWorld(l.max.clone()), d = this.position.clone(), u = this.position.clone().setY(c.y).sub(new h(0, t, 0));
398
- if (this.position.copy(u), this.position.y === d.y) return;
399
- this.onMove();
400
- }
527
+ if (l.length > 0) {
528
+ const d = l[0].object, E = new w().setFromObject(d).max.y - a.min.y;
529
+ if (Math.abs(E) < 1e-9 || (t.y += E, t.y === e.y)) return;
530
+ this.setPosition(t), import("../plugins/state/index.mjs").then(({ State: L }) => {
531
+ var S;
532
+ (S = L.get(this.userData.id)) == null || S.performAction("UPDATE_OBJECT", {
533
+ id: this.userData.id,
534
+ position: t,
535
+ rotation: this.rotation,
536
+ scale: this.scale
537
+ });
538
+ }), this.onMove();
539
+ } else
540
+ this.placeOnFloor();
401
541
  }
402
542
  }
403
- class kt extends v {
543
+ class Vt extends q {
404
544
  constructor() {
405
545
  super();
406
546
  i(this, "isDIVEPrimitive", !0);
407
547
  i(this, "_mesh");
408
- this._mesh = new P(), this._mesh.layers.mask = _, this._mesh.castShadow = !0, this._mesh.receiveShadow = !0, this._mesh.material = new k(), this.add(this._mesh);
548
+ i(this, "_material");
549
+ this._mesh = new M(), this._mesh.name = "PrimitiveMesh", this._mesh.layers.mask = g, this._mesh.castShadow = !0, this._mesh.receiveShadow = !0, this.add(this._mesh), this._material = new A(), this._mesh.material = this._material;
409
550
  }
410
551
  setGeometry(t) {
411
552
  const e = this.assembleGeometry(t);
412
- e && (this._mesh.geometry = e, this._boundingBox.setFromObject(this._mesh));
413
- }
414
- setMaterial(t) {
415
- const e = this._mesh.material;
416
- t.vertexColors !== void 0 && (e.vertexColors = t.vertexColors), t.color !== void 0 && (e.color = new g(t.color)), t.map !== void 0 && (e.map = t.map), t.normalMap !== void 0 && (e.normalMap = t.normalMap), t.roughness !== void 0 && (e.roughness = t.roughness), t.roughnessMap !== void 0 && (e.roughnessMap = t.roughnessMap, e.roughnessMap && (e.roughness = 1)), t.metalness !== void 0 && (e.metalness = t.metalness), t.metalnessMap !== void 0 && (e.metalnessMap = t.metalnessMap, e.metalnessMap && (e.metalness = 0)), this._mesh && (this._mesh.material = e);
417
- }
418
- placeOnFloor() {
419
- var n, o, l, c;
420
- const t = this.getWorldPosition(this._positionWorldBuffer), e = t.clone();
421
- (o = (n = this._mesh) == null ? void 0 : n.geometry) == null || o.computeBoundingBox();
422
- const a = (c = (l = this._mesh) == null ? void 0 : l.geometry) == null ? void 0 : c.boundingBox;
423
- !a || !this._mesh || (t.y = t.y - this._mesh.localToWorld(a.min.clone()).y, t.y !== e.y && import("../plugins/state/index.mjs").then(({ State: d }) => {
424
- var u;
425
- (u = d.get(this.userData.id)) == null || u.performAction("UPDATE_OBJECT", {
426
- id: this.userData.id,
427
- position: t,
428
- rotation: this.rotation,
429
- scale: this.scale
430
- });
431
- }));
432
- }
433
- dropIt() {
434
- if (!this.parent) {
435
- console.warn(
436
- "DIVEPrimitive: dropIt() called on a model that is not in the scene.",
437
- this
438
- );
439
- return;
440
- }
441
- const t = this._boundingBox.min.y * this.scale.y, e = this.localToWorld(
442
- this._boundingBox.getCenter(new h()).multiply(this.scale)
443
- );
444
- e.y = t + this.position.y;
445
- const a = new U(e, new h(0, -1, 0));
446
- a.layers.mask = _;
447
- const n = a.intersectObjects(
448
- V(this).root.children,
449
- !0
450
- );
451
- if (n.length > 0) {
452
- const o = n[0].object;
453
- o.geometry.computeBoundingBox();
454
- const l = o.geometry.boundingBox, c = o.localToWorld(l.max.clone()), d = this.position.clone(), u = this.position.clone().setY(c.y).sub(new h(0, t, 0));
455
- if (this.position.copy(u), this.position.y === d.y) return;
456
- this.onMove();
457
- }
553
+ e && (e.computeVertexNormals(), e.computeBoundingBox(), e.computeBoundingSphere(), this._mesh.geometry = e, this._boundingBox.setFromObject(this._mesh));
458
554
  }
459
555
  assembleGeometry(t) {
460
- switch (this._mesh.material.flatShading = !1, t.name.toLowerCase()) {
556
+ switch (this._material.flatShading = !1, t.name.toLowerCase()) {
461
557
  case "cylinder":
462
558
  return this.createCylinderGeometry(t);
463
559
  case "sphere":
464
560
  return this.createSphereGeometry(t);
465
561
  case "pyramid":
466
- return this._mesh.material.flatShading = !0, this.createPyramidGeometry(t);
562
+ return this._material.flatShading = !0, this.createPyramidGeometry(t);
467
563
  case "cube":
468
564
  case "box":
469
565
  return this.createBoxGeometry(t);
@@ -481,7 +577,7 @@ class kt extends v {
481
577
  }
482
578
  }
483
579
  createCylinderGeometry(t) {
484
- const e = new ht(
580
+ const e = new ut(
485
581
  t.width / 2,
486
582
  t.width / 2,
487
583
  t.height,
@@ -490,7 +586,7 @@ class kt extends v {
490
586
  return e.translate(0, t.height / 2, 0), e;
491
587
  }
492
588
  createSphereGeometry(t) {
493
- return new I(t.width / 2, 256, 256);
589
+ return new R(t.width / 2, 256, 256);
494
590
  }
495
591
  createPyramidGeometry(t) {
496
592
  const e = new Float32Array([
@@ -532,14 +628,14 @@ class kt extends v {
532
628
  3,
533
629
  4,
534
630
  0
535
- ]), n = new H();
631
+ ]), n = new W();
536
632
  return n.setAttribute(
537
633
  "position",
538
- new A(e, 3)
539
- ), n.setIndex(new A(a, 1)), n.computeVertexNormals(), n.computeBoundingBox(), n.computeBoundingSphere(), n;
634
+ new z(e, 3)
635
+ ), n.setIndex(new z(a, 1)), n;
540
636
  }
541
637
  createBoxGeometry(t) {
542
- const e = new M(
638
+ const e = new I(
543
639
  t.width,
544
640
  t.height,
545
641
  t.depth
@@ -547,11 +643,11 @@ class kt extends v {
547
643
  return e.translate(0, t.height / 2, 0), e;
548
644
  }
549
645
  createConeGeometry(t) {
550
- const e = new lt(t.width / 2, t.height, 256);
646
+ const e = new pt(t.width / 2, t.height, 256);
551
647
  return e.translate(0, t.height / 2, 0), e;
552
648
  }
553
649
  createWallGeometry(t) {
554
- const e = new M(
650
+ const e = new I(
555
651
  t.width,
556
652
  t.height,
557
653
  t.depth || 0.05,
@@ -560,7 +656,7 @@ class kt extends v {
560
656
  return e.translate(0, t.height / 2, 0), e;
561
657
  }
562
658
  createPlaneGeometry(t) {
563
- const e = new M(
659
+ const e = new I(
564
660
  t.width,
565
661
  t.height,
566
662
  t.depth
@@ -568,7 +664,7 @@ class kt extends v {
568
664
  return e.translate(0, t.height / 2, 0), e;
569
665
  }
570
666
  }
571
- class Vt extends v {
667
+ class Rt extends C {
572
668
  // lines to children
573
669
  constructor() {
574
670
  super();
@@ -622,11 +718,11 @@ class Vt extends v {
622
718
  * Creates a line for visualization.
623
719
  */
624
720
  createLine() {
625
- const t = new H(), e = new dt({
721
+ const t = new W(), e = new mt({
626
722
  color: 6710886,
627
723
  dashSize: 0.05,
628
724
  gapSize: 0.025
629
- }), a = new ct(t, e);
725
+ }), a = new _t(t, e);
630
726
  return a.visible = !1, a;
631
727
  }
632
728
  /**
@@ -687,37 +783,37 @@ class Vt extends v {
687
783
  // this._boxMesh.visible = true;
688
784
  // }
689
785
  }
690
- class Rt extends P {
786
+ class At extends M {
691
787
  constructor() {
692
- const t = new ut(1, 1);
788
+ const t = new gt(1, 1);
693
789
  t.scale(1e3, 1e3, 1), t.rotateX(-Math.PI / 2);
694
- const e = new k({
695
- color: new g(16777215),
696
- side: F
790
+ const e = new A({
791
+ color: new _(16777215),
792
+ side: Y
697
793
  });
698
794
  super(t, e);
699
795
  i(this, "isDIVEFloor", !0);
700
- this.name = "Floor", this.layers.mask = _, this.receiveShadow = !0;
796
+ this.name = "Floor", this.layers.mask = g, this.receiveShadow = !0;
701
797
  }
702
798
  setVisibility(t) {
703
799
  this.visible = t;
704
800
  }
705
801
  setColor(t) {
706
- this.material.color = new g(t);
802
+ this.material.color = new _(t);
707
803
  }
708
804
  }
709
- class At extends w {
805
+ class Ct extends f {
710
806
  constructor() {
711
807
  super();
712
808
  i(this, "isDIVERoot", !0);
713
809
  i(this, "_floor");
714
- this.name = "Root", this._floor = new Rt(), this.add(this._floor);
810
+ this.name = "Root", this._floor = new At(), this.add(this._floor);
715
811
  }
716
812
  get floor() {
717
813
  return this._floor;
718
814
  }
719
815
  computeSceneBB() {
720
- const t = new L();
816
+ const t = new w();
721
817
  return this.children.forEach((e) => {
722
818
  "isDIVEFloor" in e || e.traverse((a) => {
723
819
  "isObject3D" in a && t.expandByObject(a);
@@ -742,11 +838,11 @@ class At extends w {
742
838
  case "light": {
743
839
  switch (t.type) {
744
840
  case "scene": {
745
- e = new It();
841
+ e = new kt();
746
842
  break;
747
843
  }
748
844
  case "ambient": {
749
- e = new xt();
845
+ e = new It();
750
846
  break;
751
847
  }
752
848
  case "point": {
@@ -762,15 +858,15 @@ class At extends w {
762
858
  break;
763
859
  }
764
860
  case "model": {
765
- e = new Lt(), e.name = t.name, e.userData.id = t.id, e.userData.uri = t.uri, this.add(e), this._updateModel(e, t);
861
+ e = new q(), e.name = t.name, e.userData.id = t.id, e.userData.uri = t.uri, this.add(e), this._updateModel(e, t);
766
862
  break;
767
863
  }
768
864
  case "primitive": {
769
- e = new kt(), e.name = t.name, e.userData.id = t.id, this.add(e), this._updatePrimitive(e, t);
865
+ e = new Vt(), e.name = t.name, e.userData.id = t.id, this.add(e), this._updatePrimitive(e, t);
770
866
  break;
771
867
  }
772
868
  case "group": {
773
- e = new Vt(), e.name = t.name, e.userData.id = t.id, this.add(e), this._updateGroup(e, t);
869
+ e = new Rt(), e.name = t.name, e.userData.id = t.id, this.add(e), this._updateGroup(e, t);
774
870
  break;
775
871
  }
776
872
  default:
@@ -851,7 +947,7 @@ class At extends w {
851
947
  e.position.x,
852
948
  e.position.y,
853
949
  e.position.z
854
- ), e.intensity !== void 0 && e.intensity !== null && t.setIntensity(e.intensity), e.enabled !== void 0 && e.enabled !== null && t.setEnabled(e.enabled), e.color !== void 0 && e.color !== null && t.setColor(new g(e.color)), e.visible !== void 0 && e.visible !== null && (t.visible = e.visible), e.parentId !== void 0 && this._setParent({ ...e, parentId: e.parentId });
950
+ ), e.intensity !== void 0 && e.intensity !== null && t.setIntensity(e.intensity), e.enabled !== void 0 && e.enabled !== null && t.setEnabled(e.enabled), e.color !== void 0 && e.color !== null && t.setColor(new _(e.color)), e.visible !== void 0 && e.visible !== null && (t.visible = e.visible), e.parentId !== void 0 && this._setParent({ ...e, parentId: e.parentId });
855
951
  }
856
952
  _updateModel(t, e) {
857
953
  e.uri !== void 0 && t.setFromURL(e.uri), e.name !== void 0 && (t.name = e.name), e.position !== void 0 && t.setPosition(e.position), e.rotation !== void 0 && t.setRotation(e.rotation), e.scale !== void 0 && t.setScale(e.scale), e.visible !== void 0 && t.setVisibility(e.visible), e.material !== void 0 && t.setMaterial(e.material), e.parentId !== void 0 && this._setParent({ ...e, parentId: e.parentId });
@@ -898,39 +994,39 @@ class At extends w {
898
994
  return t.parent !== null ? this._findScene(t.parent) : t;
899
995
  }
900
996
  }
901
- const Ct = "#888888", Ot = "#dddddd";
902
- class Bt extends w {
997
+ const Ot = "#888888", zt = "#dddddd";
998
+ class Bt extends f {
903
999
  constructor() {
904
1000
  super(), this.name = "Grid";
905
- const s = new pt(
1001
+ const s = new ft(
906
1002
  100,
907
1003
  100,
908
- Ct,
909
- Ot
1004
+ Ot,
1005
+ zt
910
1006
  );
911
- s.material.depthTest = !1, s.layers.mask = St, this.add(s);
1007
+ s.material.depthTest = !1, s.layers.mask = vt, this.add(s);
912
1008
  }
913
1009
  setVisibility(s) {
914
1010
  this.visible = s;
915
1011
  }
916
1012
  }
917
- const E = {
1013
+ const v = {
918
1014
  displayFloor: !1,
919
1015
  displayGrid: !1,
920
1016
  backgroundColor: "#ffffff"
921
1017
  };
922
- class zt extends mt {
1018
+ class Gt extends wt {
923
1019
  constructor(t) {
924
1020
  super();
925
1021
  i(this, "isDIVEScene", !0);
926
1022
  i(this, "_root");
927
1023
  i(this, "_grid");
928
- this.background = new g(
929
- (t == null ? void 0 : t.backgroundColor) ?? E.backgroundColor
930
- ), this._root = new At(), this._root.floor.setVisibility(
931
- (t == null ? void 0 : t.displayFloor) ?? E.displayFloor
1024
+ this.background = new _(
1025
+ (t == null ? void 0 : t.backgroundColor) ?? v.backgroundColor
1026
+ ), this._root = new Ct(), this._root.floor.setVisibility(
1027
+ (t == null ? void 0 : t.displayFloor) ?? v.displayFloor
932
1028
  ), this.add(this._root), this._grid = new Bt(), this._grid.setVisibility(
933
- (t == null ? void 0 : t.displayGrid) ?? E.displayGrid
1029
+ (t == null ? void 0 : t.displayGrid) ?? v.displayGrid
934
1030
  ), this.add(this._grid);
935
1031
  }
936
1032
  get root() {
@@ -940,13 +1036,13 @@ class zt extends mt {
940
1036
  return this._grid;
941
1037
  }
942
1038
  setBackground(t) {
943
- this.background = new g(t);
1039
+ this.background = new _(t);
944
1040
  }
945
1041
  computeSceneBB() {
946
1042
  return this._root.computeSceneBB();
947
1043
  }
948
1044
  }
949
- const Gt = {
1045
+ const Ft = {
950
1046
  enableDamping: !0,
951
1047
  dampingFactor: 0.05,
952
1048
  enabled: !0,
@@ -976,15 +1072,15 @@ const Gt = {
976
1072
  BOTTOM: "ArrowDown"
977
1073
  },
978
1074
  mouseButtons: {
979
- LEFT: m.ROTATE,
980
- MIDDLE: m.DOLLY,
981
- RIGHT: m.PAN
1075
+ LEFT: p.ROTATE,
1076
+ MIDDLE: p.DOLLY,
1077
+ RIGHT: p.PAN
982
1078
  },
983
1079
  touches: {
984
- ONE: f.ROTATE,
985
- TWO: f.DOLLY_PAN
1080
+ ONE: m.ROTATE,
1081
+ TWO: m.DOLLY_PAN
986
1082
  }
987
- }, b = class b extends gt {
1083
+ }, b = class b extends yt {
988
1084
  constructor(t, e, a) {
989
1085
  super();
990
1086
  // public API
@@ -1023,32 +1119,32 @@ const Gt = {
1023
1119
  BOTTOM: "ArrowDown"
1024
1120
  });
1025
1121
  i(this, "mouseButtons", {
1026
- LEFT: m.ROTATE,
1027
- MIDDLE: m.DOLLY,
1028
- RIGHT: m.PAN
1122
+ LEFT: p.ROTATE,
1123
+ MIDDLE: p.DOLLY,
1124
+ RIGHT: p.PAN
1029
1125
  });
1030
- i(this, "touches", { ONE: f.ROTATE, TWO: f.DOLLY_PAN });
1126
+ i(this, "touches", { ONE: m.ROTATE, TWO: m.DOLLY_PAN });
1031
1127
  i(this, "target0");
1032
1128
  i(this, "position0");
1033
1129
  i(this, "zoom0");
1034
- i(this, "uuid", S.generateUUID());
1130
+ i(this, "uuid", x.generateUUID());
1035
1131
  // private state
1036
1132
  i(this, "state", -1);
1037
1133
  i(this, "EPS", 1e-6);
1038
- i(this, "spherical", new C());
1039
- i(this, "sphericalDelta", new C());
1134
+ i(this, "spherical", new B());
1135
+ i(this, "sphericalDelta", new B());
1040
1136
  i(this, "scale", 1);
1041
1137
  i(this, "panOffset", new h());
1042
1138
  i(this, "zoomChanged", !1);
1043
- i(this, "rotateStart", new p());
1044
- i(this, "rotateEnd", new p());
1045
- i(this, "rotateDelta", new p());
1046
- i(this, "panStart", new p());
1047
- i(this, "panEnd", new p());
1048
- i(this, "panDelta", new p());
1049
- i(this, "dollyStart", new p());
1050
- i(this, "dollyEnd", new p());
1051
- i(this, "dollyDelta", new p());
1139
+ i(this, "rotateStart", new c());
1140
+ i(this, "rotateEnd", new c());
1141
+ i(this, "rotateDelta", new c());
1142
+ i(this, "panStart", new c());
1143
+ i(this, "panEnd", new c());
1144
+ i(this, "panDelta", new c());
1145
+ i(this, "dollyStart", new c());
1146
+ i(this, "dollyEnd", new c());
1147
+ i(this, "dollyDelta", new c());
1052
1148
  i(this, "pointers", []);
1053
1149
  i(this, "pointerPositions", {});
1054
1150
  // for update() function
@@ -1056,7 +1152,7 @@ const Gt = {
1056
1152
  i(this, "quat");
1057
1153
  i(this, "quatInverse");
1058
1154
  i(this, "lastPosition", new h());
1059
- i(this, "lastQuaternion", new T());
1155
+ i(this, "lastQuaternion", new k());
1060
1156
  i(this, "lastTarget", new h());
1061
1157
  i(this, "panLeft", (() => {
1062
1158
  const t = new h();
@@ -1086,11 +1182,11 @@ const Gt = {
1086
1182
  e = -1;
1087
1183
  }
1088
1184
  switch (e) {
1089
- case m.DOLLY:
1185
+ case p.DOLLY:
1090
1186
  if (this.enableZoom === !1) return;
1091
1187
  this.handleMouseDownDolly(t), this.state = 1;
1092
1188
  break;
1093
- case m.ROTATE:
1189
+ case p.ROTATE:
1094
1190
  if (t.ctrlKey || t.metaKey || t.shiftKey) {
1095
1191
  if (this.enablePan === !1) return;
1096
1192
  this.handleMouseDownPan(t), this.state = 2;
@@ -1099,7 +1195,7 @@ const Gt = {
1099
1195
  this.handleMouseDownRotate(t), this.state = 0;
1100
1196
  }
1101
1197
  break;
1102
- case m.PAN:
1198
+ case p.PAN:
1103
1199
  if (t.ctrlKey || t.metaKey || t.shiftKey) {
1104
1200
  if (this.enableRotate === !1) return;
1105
1201
  this.handleMouseDownRotate(t), this.state = 0;
@@ -1140,11 +1236,11 @@ const Gt = {
1140
1236
  switch (this.trackPointer(t), this.pointers.length) {
1141
1237
  case 1:
1142
1238
  switch (this.touches.ONE) {
1143
- case f.ROTATE:
1239
+ case m.ROTATE:
1144
1240
  if (this.enableRotate === !1) return;
1145
1241
  this.handleTouchStartRotate(t), this.state = 3;
1146
1242
  break;
1147
- case f.PAN:
1243
+ case m.PAN:
1148
1244
  if (this.enablePan === !1) return;
1149
1245
  this.handleTouchStartPan(t), this.state = 4;
1150
1246
  break;
@@ -1154,12 +1250,12 @@ const Gt = {
1154
1250
  break;
1155
1251
  case 2:
1156
1252
  switch (this.touches.TWO) {
1157
- case f.DOLLY_PAN:
1253
+ case m.DOLLY_PAN:
1158
1254
  if (this.enableZoom === !1 && this.enablePan === !1)
1159
1255
  return;
1160
1256
  this.handleTouchStartDollyPan(t), this.state = 5;
1161
1257
  break;
1162
- case f.DOLLY_ROTATE:
1258
+ case m.DOLLY_ROTATE:
1163
1259
  if (this.enableZoom === !1 && this.enableRotate === !1)
1164
1260
  return;
1165
1261
  this.handleTouchStartDollyRotate(t), this.state = 6;
@@ -1221,7 +1317,7 @@ const Gt = {
1221
1317
  i(this, "onContextMenu", (t) => {
1222
1318
  this.enabled !== !1 && t.preventDefault();
1223
1319
  });
1224
- this.object = t, this.domElements = Array.isArray(e) ? e : [e], Object.assign(this, a), this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this.quat = new T().setFromUnitVectors(
1320
+ this.object = t, this.domElements = Array.isArray(e) ? e : [e], Object.assign(this, a), this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this.quat = new k().setFromUnitVectors(
1225
1321
  t.up,
1226
1322
  new h(0, 1, 0)
1227
1323
  ), this.quatInverse = this.quat.clone().invert(), this.domElements.forEach((n) => this.addEventListeners(n)), this.update();
@@ -1279,14 +1375,14 @@ const Gt = {
1279
1375
  this.removeDomElements(...this.domElements), this.domElements = [], this.addDomElements(...t);
1280
1376
  }
1281
1377
  computeEncompassingView(t, e = 0) {
1282
- const a = t.center, o = t.sphere.radius, l = this.object.fov * (Math.PI / 180), c = this.object.aspect, d = l / 2, u = Math.atan(Math.tan(d) * c), q = o / Math.sin(d), K = o / Math.sin(u), Q = Math.max(q, K) * (1 + e), R = this.object.position.clone().sub(this.target).normalize(), J = R.length() > 1e-3 ? R : new h(0, 0, 1);
1378
+ const a = t.center, r = t.sphere.radius, l = this.object.fov * (Math.PI / 180), d = this.object.aspect, u = l / 2, D = Math.atan(Math.tan(u) * d), E = r / Math.sin(u), L = r / Math.sin(D), S = Math.max(E, L) * (1 + e), O = this.object.position.clone().sub(this.target).normalize(), $ = O.length() > 1e-3 ? O : new h(0, 0, 1);
1283
1379
  return {
1284
- position: a.clone().add(J.multiplyScalar(Q)),
1380
+ position: a.clone().add($.multiplyScalar(S)),
1285
1381
  target: a
1286
1382
  };
1287
1383
  }
1288
1384
  focusObject(t, e = 0) {
1289
- const a = new Xt(t), n = this.computeEncompassingView(a, e);
1385
+ const a = new V(t), n = this.computeEncompassingView(a, e);
1290
1386
  this.object.position.copy(n.position), this.target.copy(n.target), this.update();
1291
1387
  }
1292
1388
  zoomIn(t) {
@@ -1336,8 +1432,8 @@ const Gt = {
1336
1432
  pan(t, e, a) {
1337
1433
  const n = new h();
1338
1434
  if ("isPerspectiveCamera" in this.object) {
1339
- const o = this.object.position;
1340
- n.copy(o).sub(this.target);
1435
+ const r = this.object.position;
1436
+ n.copy(r).sub(this.target);
1341
1437
  let l = n.length();
1342
1438
  l *= Math.tan(
1343
1439
  this.object.fov / 2 * Math.PI / 180
@@ -1433,8 +1529,8 @@ const Gt = {
1433
1529
  }
1434
1530
  }
1435
1531
  handleTouchStartDolly(t) {
1436
- const e = this.getSecondPointer(t), a = t.pageX - e.pageX, n = t.pageY - e.pageY, o = Math.sqrt(a * a + n * n);
1437
- this.dollyStart.set(0, o);
1532
+ const e = this.getSecondPointer(t), a = t.pageX - e.pageX, n = t.pageY - e.pageY, r = Math.sqrt(a * a + n * n);
1533
+ this.dollyStart.set(0, r);
1438
1534
  }
1439
1535
  handleTouchStartDollyPan(t) {
1440
1536
  this.enableZoom && this.handleTouchStartDolly(t), this.enablePan && this.handleTouchStartPan(t);
@@ -1446,8 +1542,8 @@ const Gt = {
1446
1542
  if (this.pointers.length === 1)
1447
1543
  this.rotateEnd.set(t.pageX, t.pageY);
1448
1544
  else {
1449
- const a = this.getSecondPointer(t), n = 0.5 * (t.pageX + a.pageX), o = 0.5 * (t.pageY + a.pageY);
1450
- this.rotateEnd.set(n, o);
1545
+ const a = this.getSecondPointer(t), n = 0.5 * (t.pageX + a.pageX), r = 0.5 * (t.pageY + a.pageY);
1546
+ this.rotateEnd.set(n, r);
1451
1547
  }
1452
1548
  const e = t.currentTarget;
1453
1549
  this.rotateDelta.subVectors(this.rotateEnd, this.rotateStart).multiplyScalar(this.rotateSpeed), this.rotateLeft(
@@ -1460,15 +1556,15 @@ const Gt = {
1460
1556
  if (this.pointers.length === 1)
1461
1557
  this.panEnd.set(t.pageX, t.pageY);
1462
1558
  else {
1463
- const a = this.getSecondPointer(t), n = 0.5 * (t.pageX + a.pageX), o = 0.5 * (t.pageY + a.pageY);
1464
- this.panEnd.set(n, o);
1559
+ const a = this.getSecondPointer(t), n = 0.5 * (t.pageX + a.pageX), r = 0.5 * (t.pageY + a.pageY);
1560
+ this.panEnd.set(n, r);
1465
1561
  }
1466
1562
  const e = t.currentTarget;
1467
1563
  this.panDelta.subVectors(this.panEnd, this.panStart).multiplyScalar(this.panSpeed), this.pan(this.panDelta.x, this.panDelta.y, e), this.panStart.copy(this.panEnd);
1468
1564
  }
1469
1565
  handleTouchMoveDolly(t) {
1470
- const e = this.getSecondPointer(t), a = t.pageX - e.pageX, n = t.pageY - e.pageY, o = Math.sqrt(a * a + n * n);
1471
- this.dollyEnd.set(0, o), this.dollyDelta.set(
1566
+ const e = this.getSecondPointer(t), a = t.pageX - e.pageX, n = t.pageY - e.pageY, r = Math.sqrt(a * a + n * n);
1567
+ this.dollyEnd.set(0, r), this.dollyDelta.set(
1472
1568
  0,
1473
1569
  Math.pow(this.dollyEnd.y / this.dollyStart.y, this.zoomSpeed)
1474
1570
  ), this.dollyOut(this.dollyDelta.y), this.dollyStart.copy(this.dollyEnd);
@@ -1492,7 +1588,7 @@ const Gt = {
1492
1588
  }
1493
1589
  trackPointer(t) {
1494
1590
  let e = this.pointerPositions[t.pointerId];
1495
- e === void 0 && (e = new p(), this.pointerPositions[t.pointerId] = e), e.set(t.pageX, t.pageY);
1591
+ e === void 0 && (e = new c(), this.pointerPositions[t.pointerId] = e), e.set(t.pageX, t.pageY);
1496
1592
  }
1497
1593
  getSecondPointer(t) {
1498
1594
  return this.pointers[0].pointerId === t.pointerId ? this.pointers[1] : this.pointers[0];
@@ -1504,39 +1600,39 @@ const Gt = {
1504
1600
  }
1505
1601
  };
1506
1602
  i(b, "DEFAULT_ZOOM_FACTOR", 1);
1507
- let z = b;
1508
- class Ft extends w {
1603
+ let U = b;
1604
+ class Ut extends f {
1509
1605
  constructor() {
1510
1606
  super();
1511
1607
  i(this, "_axesHelper");
1512
- this._axesHelper = new _t(0.5), this._axesHelper.layers.mask = y, this._axesHelper.material.depthTest = !1, this._axesHelper.position.set(0, 0, -1), this._axesHelper.setColors(
1513
- new g(Wt),
1514
- new g(Zt),
1515
- new g(Nt)
1608
+ this._axesHelper = new bt(0.5), this._axesHelper.layers.mask = y, this._axesHelper.material.depthTest = !1, this._axesHelper.position.set(0, 0, -1), this._axesHelper.setColors(
1609
+ new _(Zt),
1610
+ new _(Nt),
1611
+ new _(Xt)
1516
1612
  );
1517
- const t = new x("X", 0.2, Z), e = new x("Y", 0.2, N), a = new x("Z", 0.2, X);
1613
+ const t = new T("X", 0.2, K), e = new T("Y", 0.2, Q), a = new T("Z", 0.2, J);
1518
1614
  t.layers.mask = y, e.layers.mask = y, a.layers.mask = y, t.position.set(0.7, 0, 0), e.position.set(0, 0.7, 0), a.position.set(0, 0, 0.7), this._axesHelper.add(t), this._axesHelper.add(e), this._axesHelper.add(a);
1519
1615
  }
1520
1616
  setFromCameraMatrix(t) {
1521
1617
  this._axesHelper.rotation.setFromRotationMatrix(
1522
- new ft().extractRotation(t).invert()
1618
+ new Dt().extractRotation(t).invert()
1523
1619
  );
1524
1620
  }
1525
1621
  }
1526
- class Ut {
1622
+ class Ht {
1527
1623
  constructor(s, t, e) {
1528
- i(this, "uuid", S.generateUUID());
1624
+ i(this, "uuid", x.generateUUID());
1529
1625
  i(this, "_axes");
1530
1626
  i(this, "_orthographicCamera");
1531
- i(this, "_restoreViewport", new yt());
1532
- this._renderer = s, this._scene = t, this._camera = e, this._orthographicCamera = new wt(
1627
+ i(this, "_restoreViewport", new St());
1628
+ this._renderer = s, this._scene = t, this._camera = e, this._orthographicCamera = new Et(
1533
1629
  -1,
1534
1630
  1,
1535
1631
  1,
1536
1632
  -1,
1537
1633
  0.1,
1538
1634
  100
1539
- ), this._orthographicCamera.layers.mask = y, this._scene.add(this._orthographicCamera), this._axes = new Ft(), this._scene.add(this._axes);
1635
+ ), this._orthographicCamera.layers.mask = y, this._scene.add(this._orthographicCamera), this._axes = new Ut(), this._scene.add(this._axes);
1540
1636
  }
1541
1637
  tick() {
1542
1638
  const s = this._scene.background;
@@ -1549,7 +1645,7 @@ class Ut {
1549
1645
  this._scene.remove(this._axes), this._scene.remove(this._orthographicCamera);
1550
1646
  }
1551
1647
  }
1552
- const Ht = `
1648
+ const Yt = `
1553
1649
  @@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@
1554
1650
  @@@@+-:::::::---------------------==------------------------------=#@@@@
1555
1651
  @@%=::::.......::---------------------------------------------------------+@@
@@ -1584,18 +1680,18 @@ window.DIVE = {
1584
1680
  return window.DIVE.instances[0];
1585
1681
  }
1586
1682
  };
1587
- const D = {
1683
+ const P = {
1588
1684
  autoStart: !0,
1589
1685
  displayAxes: !1,
1590
- ...E,
1591
- ...Pt,
1592
- ...Y,
1593
- ...Gt
1686
+ ...v,
1687
+ ...xt,
1688
+ ...Z,
1689
+ ...Ft
1594
1690
  };
1595
- class Yt {
1691
+ class Wt {
1596
1692
  constructor(s) {
1597
1693
  // descriptive members
1598
- i(this, "_instanceId", S.generateUUID());
1694
+ i(this, "_instanceId", x.generateUUID());
1599
1695
  i(this, "_settings");
1600
1696
  i(this, "_views");
1601
1697
  i(this, "_mainView");
@@ -1603,25 +1699,25 @@ class Yt {
1603
1699
  i(this, "_clock");
1604
1700
  i(this, "orientationDisplay");
1605
1701
  this._settings = {
1606
- ...D,
1702
+ ...P,
1607
1703
  ...s ?? {}
1608
- }, this._clock = new vt(), this._scene = new zt(), this.scene.setBackground(
1609
- (s == null ? void 0 : s.backgroundColor) ?? D.backgroundColor
1704
+ }, this._clock = new Mt(), this._scene = new Gt(), this.scene.setBackground(
1705
+ (s == null ? void 0 : s.backgroundColor) ?? P.backgroundColor
1610
1706
  ), this.scene.grid.setVisibility(
1611
- (s == null ? void 0 : s.displayGrid) ?? D.displayGrid
1707
+ (s == null ? void 0 : s.displayGrid) ?? P.displayGrid
1612
1708
  ), this.scene.root.floor.setVisibility(
1613
- (s == null ? void 0 : s.displayFloor) ?? D.displayFloor
1709
+ (s == null ? void 0 : s.displayFloor) ?? P.displayFloor
1614
1710
  );
1615
- const t = new B(
1711
+ const t = new F(
1616
1712
  this._scene,
1617
- new O(),
1713
+ new G(),
1618
1714
  this._settings
1619
1715
  );
1620
- this._clock.addTicker(t), this._views = [t], this._mainView = t, this._settings.autoStart && this.start(), this._settings.displayAxes ? (console.log("displayAxes", this._settings.displayAxes), this.orientationDisplay = new Ut(
1716
+ this._clock.addTicker(t), this._views = [t], this._mainView = t, this._settings.autoStart && this.start(), this._settings.displayAxes ? (console.log("displayAxes", this._settings.displayAxes), this.orientationDisplay = new Ht(
1621
1717
  this.mainView.renderer,
1622
1718
  this.scene,
1623
1719
  this.mainView.camera
1624
- ), this.clock.addTicker(this.orientationDisplay)) : this.orientationDisplay = null, console.log("DIVE 2.1.1 initialized successfully!"), console.log(Ht), window.DIVE.instances.push(this);
1720
+ ), this.clock.addTicker(this.orientationDisplay)) : this.orientationDisplay = null, console.log("DIVE 2.2.0 initialized successfully!"), console.log(Yt), window.DIVE.instances.push(this);
1625
1721
  }
1626
1722
  /**
1627
1723
  * @deprecated This static method will be removed in a future version. Please use `import { QuickView, QuickViewSettings, QuickViewDefaultSettings } from '@shopware-ag/dive/quickview'` instead.
@@ -1683,9 +1779,9 @@ class Yt {
1683
1779
  });
1684
1780
  }
1685
1781
  createView(s) {
1686
- const t = new B(
1782
+ const t = new F(
1687
1783
  this._scene,
1688
- s ?? new O(),
1784
+ s ?? new G(),
1689
1785
  {
1690
1786
  ...this._settings,
1691
1787
  canvas: void 0
@@ -1698,136 +1794,7 @@ class Yt {
1698
1794
  this._views = this._views.filter((t) => t !== s), this._clock.removeTicker(s), this._mainView === s && (this._mainView = this._views[0]), s.dispose();
1699
1795
  }
1700
1796
  }
1701
- const ee = Yt, Z = "#c20017", N = "#00ab26", X = "#0081d4", Wt = Z, Zt = N, Nt = X;
1702
- class Xt extends v {
1703
- /**
1704
- * Creates a new BoundingBox instance for the specified 3D object.
1705
- *
1706
- * The constructor computes both a bounding box and bounding sphere for the given object.
1707
- * It handles complex objects with multiple meshes and nested transformations.
1708
- *
1709
- * @param object - The 3D object to compute bounding volumes for
1710
- * @param axisAligned - Whether to create an axis-aligned bounding box (true) or oriented bounding box (false). Defaults to false.
1711
- * @param wireframeColor - The color for the wireframe helpers. Can be a hex number or ColorRepresentation. Defaults to green (0x00ff00).
1712
- *
1713
- * @example
1714
- * ```typescript
1715
- * // Create an oriented bounding box (aligned with object's rotation)
1716
- * const obb = new BoundingBox(mesh, false, 0x00ff00);
1717
- *
1718
- * // Create an axis-aligned bounding box (aligned with world coordinates)
1719
- * const aabb = new BoundingBox(mesh, true, 0xff0000);
1720
- *
1721
- * // Use default green color
1722
- * const defaultBox = new BoundingBox(mesh);
1723
- * ```
1724
- */
1725
- constructor(t, e = !1, a = 65280) {
1726
- super();
1727
- /** The computed bounding box (Box3) */
1728
- i(this, "_box");
1729
- /** The computed bounding sphere (Sphere) */
1730
- i(this, "_sphere");
1731
- /** The center point of the bounding box */
1732
- i(this, "_center");
1733
- /** The radius of the bounding sphere */
1734
- i(this, "_radius");
1735
- /** Visual helper for the bounding box wireframe */
1736
- i(this, "_boxHelper");
1737
- /** Visual helper for the bounding sphere wireframe */
1738
- i(this, "_sphereHelper");
1739
- /** The dimensions (width, height, depth) of the bounding box */
1740
- i(this, "_size");
1741
- const n = new L();
1742
- e ? n.setFromObject(t) : (t.updateWorldMatrix(!0, !0), t.traverse((l) => {
1743
- if (l.isMesh) {
1744
- const c = l, d = c.geometry.clone();
1745
- d.applyMatrix4(c.matrixWorld);
1746
- const u = c.getWorldQuaternion(new T()).invert();
1747
- d.applyQuaternion(u), d.computeBoundingBox(), d.boundingBox && n.union(d.boundingBox);
1748
- }
1749
- })), this.rotation.copy(t.rotation), this._box = n, this._size = n.getSize(new h()), this._center = n.getCenter(new h()), this._boxHelper = new bt(this._box, a), this._boxHelper.visible = !1, this.add(this._boxHelper), this._sphere = n.getBoundingSphere(new Dt()), this._radius = this._sphere.radius;
1750
- const o = new I(this._radius, 32, 32);
1751
- o.translate(this._center.x, this._center.y, this._center.z), this._sphereHelper = new P(
1752
- o,
1753
- new G({ color: a, wireframe: !0 })
1754
- ), this._sphereHelper.visible = !1, this.add(this._sphereHelper);
1755
- }
1756
- /**
1757
- * Gets the computed bounding box.
1758
- * @returns The Box3 instance representing the bounding box
1759
- */
1760
- get box() {
1761
- return this._box;
1762
- }
1763
- /**
1764
- * Gets the computed bounding sphere.
1765
- * @returns The Sphere instance representing the bounding sphere
1766
- */
1767
- get sphere() {
1768
- return this._sphere;
1769
- }
1770
- /**
1771
- * Gets the center point of the bounding box.
1772
- * @returns A Vector3 representing the center coordinates
1773
- */
1774
- get center() {
1775
- return this._center;
1776
- }
1777
- /**
1778
- * Gets the radius of the bounding sphere.
1779
- * @returns The radius as a number
1780
- */
1781
- get radius() {
1782
- return this._radius;
1783
- }
1784
- /**
1785
- * Gets the dimensions of the bounding box.
1786
- * @returns A Vector3 representing width, height, and depth
1787
- */
1788
- get size() {
1789
- return this._size;
1790
- }
1791
- /**
1792
- * Sets the visibility of the bounding box wireframe helper.
1793
- *
1794
- * @param visible - Whether the box helper should be visible
1795
- *
1796
- * @example
1797
- * ```typescript
1798
- * const boundingBox = new BoundingBox(mesh);
1799
- *
1800
- * // Show the bounding box wireframe
1801
- * boundingBox.setBoxHelperVisible(true);
1802
- *
1803
- * // Hide the bounding box wireframe
1804
- * boundingBox.setBoxHelperVisible(false);
1805
- * ```
1806
- */
1807
- setBoxHelperVisible(t) {
1808
- this._boxHelper.visible = t;
1809
- }
1810
- /**
1811
- * Sets the visibility of the bounding sphere wireframe helper.
1812
- *
1813
- * @param visible - Whether the sphere helper should be visible
1814
- *
1815
- * @example
1816
- * ```typescript
1817
- * const boundingBox = new BoundingBox(mesh);
1818
- *
1819
- * // Show the bounding sphere wireframe
1820
- * boundingBox.setSphereHelperVisible(true);
1821
- *
1822
- * // Hide the bounding sphere wireframe
1823
- * boundingBox.setSphereHelperVisible(false);
1824
- * ```
1825
- */
1826
- setSphereHelperVisible(t) {
1827
- this._sphereHelper.visible = t;
1828
- }
1829
- }
1830
- const qt = {
1797
+ const ee = Wt, K = "#c20017", Q = "#00ab26", J = "#0081d4", Zt = K, Nt = Q, Xt = J, qt = {
1831
1798
  glb: {
1832
1799
  key: "glb",
1833
1800
  extension: "glb"
@@ -1841,44 +1808,44 @@ const qt = {
1841
1808
  extension: "usdz"
1842
1809
  }
1843
1810
  }, ie = Object.values(qt).map(
1844
- (r) => r.extension
1811
+ (o) => o.extension
1845
1812
  );
1846
1813
  export {
1847
- Wt as A,
1848
- v as B,
1849
- kt as C,
1850
- D,
1851
- At as E,
1852
- Xt as F,
1853
- Ct as G,
1854
- V as H,
1814
+ Zt as A,
1815
+ C as B,
1816
+ Vt as C,
1817
+ P as D,
1818
+ Ct as E,
1819
+ V as F,
1820
+ Ot as G,
1821
+ X as H,
1855
1822
  qt as I,
1856
- Gt as O,
1823
+ Ft as O,
1857
1824
  ie as S,
1858
- z as a,
1859
- Ut as b,
1860
- Ft as c,
1861
- Yt as d,
1862
- It as e,
1863
- Lt as f,
1864
- Zt as g,
1865
- Nt as h,
1825
+ U as a,
1826
+ Ht as b,
1827
+ Ut as c,
1828
+ Wt as d,
1829
+ kt as e,
1830
+ q as f,
1831
+ Nt as g,
1832
+ Xt as h,
1866
1833
  ee as i,
1867
- vt as j,
1868
- Y as k,
1869
- W as l,
1834
+ Mt as j,
1835
+ Z as k,
1836
+ N as l,
1870
1837
  te as m,
1871
- Mt as n,
1872
- E as o,
1873
- zt as p,
1874
- B as q,
1875
- Z as r,
1876
- N as s,
1877
- X as t,
1878
- Ot as u,
1879
- Rt as v,
1838
+ Lt as n,
1839
+ v as o,
1840
+ Gt as p,
1841
+ F as q,
1842
+ K as r,
1843
+ Q as s,
1844
+ J as t,
1845
+ zt as u,
1846
+ At as v,
1880
1847
  Bt as w,
1881
- Vt as x,
1882
- xt as y,
1848
+ Rt as x,
1849
+ It as y,
1883
1850
  Tt as z
1884
1851
  };