@shopware-ag/dive 1.15.2 → 1.15.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/dive.d.cts CHANGED
@@ -405,9 +405,11 @@ interface COMPUTE_ENCOMPASSING_VIEW {
405
405
  *
406
406
  * @module
407
407
  */
408
- interface DIVEMoveable {
409
- isMoveable: true;
408
+ interface DIVEMovable {
409
+ isMovable: true;
410
+ onMoveStart?: () => void;
410
411
  onMove?: () => void;
412
+ onMoveEnd?: () => void;
411
413
  }
412
414
 
413
415
  /**
@@ -415,17 +417,16 @@ interface DIVEMoveable {
415
417
  *
416
418
  * @module
417
419
  */
418
-
419
420
  interface DIVESelectable {
420
421
  isSelectable: true;
421
422
  onSelect?: () => void;
422
423
  onDeselect?: () => void;
423
424
  }
424
425
 
425
- declare class DIVENode extends Object3D implements DIVESelectable, DIVEMoveable {
426
+ declare class DIVENode extends Object3D implements DIVESelectable, DIVEMovable {
426
427
  readonly isDIVENode: true;
427
428
  readonly isSelectable: true;
428
- readonly isMoveable: true;
429
+ readonly isMovable: true;
429
430
  gizmo: TransformControls | null;
430
431
  protected _boundingBox: Box3;
431
432
  constructor();
@@ -441,23 +442,21 @@ declare class DIVENode extends Object3D implements DIVESelectable, DIVEMoveable
441
442
 
442
443
  declare class DIVEGroup extends DIVENode {
443
444
  readonly isDIVEGroup: true;
444
- private _boxMesh;
445
+ private _members;
446
+ private _lines;
445
447
  constructor();
446
- SetBoundingBoxVisibility(visible: boolean): void;
448
+ SetLinesVisibility(visible: boolean, object?: Object3D): void;
447
449
  attach(object: DIVESceneObject): this;
448
450
  remove(object: DIVESceneObject): this;
451
+ UpdateLineTo(object: Object3D): void;
449
452
  /**
450
- * Recalculates the position of the group based on it's bounding box.
451
- * Children's world positions are kept.
453
+ * Adds a line to this grouo as last child.
452
454
  */
453
- private recalculatePosition;
455
+ private createLine;
454
456
  /**
455
- * Updates the bounding box of the group.
456
- * @returns {Vector3} The new center of the bounding box.
457
+ * Updates a line to the object.
457
458
  */
458
- private updateBB;
459
- private updateBoxMesh;
460
- onMove(): void;
459
+ private updateLineTo;
461
460
  }
462
461
 
463
462
  /**
@@ -486,10 +485,10 @@ declare class DIVEAmbientLight extends Object3D {
486
485
  *
487
486
  * @module
488
487
  */
489
- declare class DIVEPointLight extends Object3D implements DIVESelectable, DIVEMoveable {
488
+ declare class DIVEPointLight extends Object3D implements DIVESelectable, DIVEMovable {
490
489
  readonly isDIVELight: true;
491
490
  readonly isDIVEPointLight: true;
492
- readonly isMoveable: true;
491
+ readonly isMovable: true;
493
492
  readonly isSelectable: true;
494
493
  gizmo: TransformControls$1 | null;
495
494
  private light;
@@ -662,6 +661,12 @@ declare class DIVEScene extends Scene {
662
661
  }): void;
663
662
  }
664
663
 
664
+ /**
665
+ * Interface for objects that can be hovered in the scene.
666
+ *
667
+ * @module
668
+ */
669
+
665
670
  interface DIVEDraggable {
666
671
  isDraggable: true;
667
672
  onDragStart?: (e: DraggableEvent) => void;
@@ -669,6 +674,12 @@ interface DIVEDraggable {
669
674
  onDragEnd?: (e: DraggableEvent) => void;
670
675
  }
671
676
 
677
+ /**
678
+ * Interface for objects that can be hovered in the scene.
679
+ *
680
+ * @module
681
+ */
682
+
672
683
  interface DIVEHoverable {
673
684
  isHoverable: true;
674
685
  onPointerEnter?: (i: Intersection) => void;
@@ -723,7 +734,7 @@ declare abstract class DIVEBaseTool {
723
734
  /**
724
735
  * A Tool to select and move objects in the scene.
725
736
  *
726
- * Objects have to implement the DIVESelectable interface to be selectable and DIVEMoveable to be moveable.
737
+ * Objects have to implement the DIVESelectable interface to be selectable and DIVEMovable to be movable.
727
738
  *
728
739
  * @module
729
740
  */
@@ -739,7 +750,7 @@ declare class DIVETransformTool extends DIVEBaseTool {
739
750
  /**
740
751
  * A Tool to select and move objects in the scene.
741
752
  *
742
- * Objects have to implement the DIVESelectable interface to be selectable and DIVEMoveable to be moveable.
753
+ * Objects have to implement the DIVESelectable interface to be selectable and DIVEMovable to be movable.
743
754
  *
744
755
  * @module
745
756
  */
package/build/dive.d.ts CHANGED
@@ -405,9 +405,11 @@ interface COMPUTE_ENCOMPASSING_VIEW {
405
405
  *
406
406
  * @module
407
407
  */
408
- interface DIVEMoveable {
409
- isMoveable: true;
408
+ interface DIVEMovable {
409
+ isMovable: true;
410
+ onMoveStart?: () => void;
410
411
  onMove?: () => void;
412
+ onMoveEnd?: () => void;
411
413
  }
412
414
 
413
415
  /**
@@ -415,17 +417,16 @@ interface DIVEMoveable {
415
417
  *
416
418
  * @module
417
419
  */
418
-
419
420
  interface DIVESelectable {
420
421
  isSelectable: true;
421
422
  onSelect?: () => void;
422
423
  onDeselect?: () => void;
423
424
  }
424
425
 
425
- declare class DIVENode extends Object3D implements DIVESelectable, DIVEMoveable {
426
+ declare class DIVENode extends Object3D implements DIVESelectable, DIVEMovable {
426
427
  readonly isDIVENode: true;
427
428
  readonly isSelectable: true;
428
- readonly isMoveable: true;
429
+ readonly isMovable: true;
429
430
  gizmo: TransformControls | null;
430
431
  protected _boundingBox: Box3;
431
432
  constructor();
@@ -441,23 +442,21 @@ declare class DIVENode extends Object3D implements DIVESelectable, DIVEMoveable
441
442
 
442
443
  declare class DIVEGroup extends DIVENode {
443
444
  readonly isDIVEGroup: true;
444
- private _boxMesh;
445
+ private _members;
446
+ private _lines;
445
447
  constructor();
446
- SetBoundingBoxVisibility(visible: boolean): void;
448
+ SetLinesVisibility(visible: boolean, object?: Object3D): void;
447
449
  attach(object: DIVESceneObject): this;
448
450
  remove(object: DIVESceneObject): this;
451
+ UpdateLineTo(object: Object3D): void;
449
452
  /**
450
- * Recalculates the position of the group based on it's bounding box.
451
- * Children's world positions are kept.
453
+ * Adds a line to this grouo as last child.
452
454
  */
453
- private recalculatePosition;
455
+ private createLine;
454
456
  /**
455
- * Updates the bounding box of the group.
456
- * @returns {Vector3} The new center of the bounding box.
457
+ * Updates a line to the object.
457
458
  */
458
- private updateBB;
459
- private updateBoxMesh;
460
- onMove(): void;
459
+ private updateLineTo;
461
460
  }
462
461
 
463
462
  /**
@@ -486,10 +485,10 @@ declare class DIVEAmbientLight extends Object3D {
486
485
  *
487
486
  * @module
488
487
  */
489
- declare class DIVEPointLight extends Object3D implements DIVESelectable, DIVEMoveable {
488
+ declare class DIVEPointLight extends Object3D implements DIVESelectable, DIVEMovable {
490
489
  readonly isDIVELight: true;
491
490
  readonly isDIVEPointLight: true;
492
- readonly isMoveable: true;
491
+ readonly isMovable: true;
493
492
  readonly isSelectable: true;
494
493
  gizmo: TransformControls$1 | null;
495
494
  private light;
@@ -662,6 +661,12 @@ declare class DIVEScene extends Scene {
662
661
  }): void;
663
662
  }
664
663
 
664
+ /**
665
+ * Interface for objects that can be hovered in the scene.
666
+ *
667
+ * @module
668
+ */
669
+
665
670
  interface DIVEDraggable {
666
671
  isDraggable: true;
667
672
  onDragStart?: (e: DraggableEvent) => void;
@@ -669,6 +674,12 @@ interface DIVEDraggable {
669
674
  onDragEnd?: (e: DraggableEvent) => void;
670
675
  }
671
676
 
677
+ /**
678
+ * Interface for objects that can be hovered in the scene.
679
+ *
680
+ * @module
681
+ */
682
+
672
683
  interface DIVEHoverable {
673
684
  isHoverable: true;
674
685
  onPointerEnter?: (i: Intersection) => void;
@@ -723,7 +734,7 @@ declare abstract class DIVEBaseTool {
723
734
  /**
724
735
  * A Tool to select and move objects in the scene.
725
736
  *
726
- * Objects have to implement the DIVESelectable interface to be selectable and DIVEMoveable to be moveable.
737
+ * Objects have to implement the DIVESelectable interface to be selectable and DIVEMovable to be movable.
727
738
  *
728
739
  * @module
729
740
  */
@@ -739,7 +750,7 @@ declare class DIVETransformTool extends DIVEBaseTool {
739
750
  /**
740
751
  * A Tool to select and move objects in the scene.
741
752
  *
742
- * Objects have to implement the DIVESelectable interface to be selectable and DIVEMoveable to be moveable.
753
+ * Objects have to implement the DIVESelectable interface to be selectable and DIVEMovable to be movable.
743
754
  *
744
755
  * @module
745
756
  */
package/build/dive.js CHANGED
@@ -69,45 +69,27 @@ var init_VisibilityLayerMask = __esm({
69
69
  }
70
70
  });
71
71
 
72
- // src/interface/Draggable.ts
73
- var isDraggable, findDraggableInterface;
74
- var init_Draggable = __esm({
75
- "src/interface/Draggable.ts"() {
72
+ // src/helper/isInterface/implementsInterface.ts
73
+ function implementsInterface(object, discriminator) {
74
+ if (!object) return false;
75
+ return discriminator in object;
76
+ }
77
+ var init_implementsInterface = __esm({
78
+ "src/helper/isInterface/implementsInterface.ts"() {
76
79
  "use strict";
77
- isDraggable = (object) => {
78
- return "isDraggable" in object;
79
- };
80
- findDraggableInterface = (child) => {
81
- if (child === void 0) return void 0;
82
- if (child.parent === null) {
83
- return void 0;
84
- }
85
- if (isDraggable(child)) {
86
- return child;
87
- }
88
- return findDraggableInterface(child.parent);
89
- };
90
80
  }
91
81
  });
92
82
 
93
- // src/interface/Hoverable.ts
94
- var isHoverable, findHoverableInterface;
95
- var init_Hoverable = __esm({
96
- "src/interface/Hoverable.ts"() {
83
+ // src/helper/findInterface/findInterface.ts
84
+ function findInterface(object, discriminator) {
85
+ if (!object) return void 0;
86
+ if (implementsInterface(object, discriminator)) return object;
87
+ return findInterface(object.parent, discriminator);
88
+ }
89
+ var init_findInterface = __esm({
90
+ "src/helper/findInterface/findInterface.ts"() {
97
91
  "use strict";
98
- isHoverable = (object) => {
99
- return "isHoverable" in object;
100
- };
101
- findHoverableInterface = (child) => {
102
- if (child === void 0) return void 0;
103
- if (child.parent === null) {
104
- return void 0;
105
- }
106
- if (isHoverable(child)) {
107
- return child;
108
- }
109
- return findHoverableInterface(child.parent);
110
- };
92
+ init_implementsInterface();
111
93
  }
112
94
  });
113
95
 
@@ -118,8 +100,7 @@ var init_BaseTool = __esm({
118
100
  "src/toolbox/BaseTool.ts"() {
119
101
  "use strict";
120
102
  init_VisibilityLayerMask();
121
- init_Draggable();
122
- init_Hoverable();
103
+ init_findInterface();
123
104
  DIVEBaseTool = class {
124
105
  constructor(scene, controller) {
125
106
  this.POINTER_DRAG_THRESHOLD = 1e-3;
@@ -166,7 +147,7 @@ var init_BaseTool = __esm({
166
147
  break;
167
148
  }
168
149
  this._lastPointerDown.copy(this._pointer);
169
- this._draggable = findDraggableInterface((_a = this._intersects[0]) == null ? void 0 : _a.object) || null;
150
+ this._draggable = findInterface((_a = this._intersects[0]) == null ? void 0 : _a.object, "isDraggable") || null;
170
151
  }
171
152
  onDragStart(e) {
172
153
  if (!this._draggable) return;
@@ -195,7 +176,7 @@ var init_BaseTool = __esm({
195
176
  this._pointer.y = -(e.offsetY / this._canvas.clientHeight) * 2 + 1;
196
177
  this._raycaster.setFromCamera(this._pointer, this._controller.object);
197
178
  this._intersects = this.raycast(this._scene.children);
198
- const hoverable = findHoverableInterface((_a = this._intersects[0]) == null ? void 0 : _a.object);
179
+ const hoverable = findInterface((_a = this._intersects[0]) == null ? void 0 : _a.object, "isHoverable");
199
180
  if (this._intersects[0] && hoverable) {
200
181
  if (!this._hovered) {
201
182
  if (hoverable.onPointerEnter) hoverable.onPointerEnter(this._intersects[0]);
@@ -307,6 +288,7 @@ var init_TransformTool = __esm({
307
288
  "src/toolbox/transform/TransformTool.ts"() {
308
289
  "use strict";
309
290
  init_BaseTool();
291
+ init_implementsInterface();
310
292
  DIVETransformTool = class extends DIVEBaseTool {
311
293
  constructor(scene, controller) {
312
294
  super(scene, controller);
@@ -316,16 +298,21 @@ var init_TransformTool = __esm({
316
298
  this._gizmo.mode = "translate";
317
299
  this._gizmo.addEventListener("mouseDown", () => {
318
300
  controller.enabled = false;
319
- });
320
- this._gizmo.addEventListener("mouseUp", () => {
321
- controller.enabled = true;
301
+ if (!implementsInterface(this._gizmo.object, "isMovable")) return;
302
+ if (!this._gizmo.object.onMoveStart) return;
303
+ this._gizmo.object.onMoveStart();
322
304
  });
323
305
  this._gizmo.addEventListener("objectChange", () => {
324
- if (!this._gizmo.object) return;
325
- if (!("isMoveable" in this._gizmo.object)) return;
326
- if (!("onMove" in this._gizmo.object)) return;
306
+ if (!implementsInterface(this._gizmo.object, "isMovable")) return;
307
+ if (!this._gizmo.object.onMove) return;
327
308
  this._gizmo.object.onMove();
328
309
  });
310
+ this._gizmo.addEventListener("mouseUp", () => {
311
+ controller.enabled = true;
312
+ if (!implementsInterface(this._gizmo.object, "isMovable")) return;
313
+ if (!this._gizmo.object.onMoveEnd) return;
314
+ this._gizmo.object.onMoveEnd();
315
+ });
329
316
  scene.add(this._gizmo);
330
317
  }
331
318
  Activate() {
@@ -354,26 +341,6 @@ var init_TransformTool = __esm({
354
341
  }
355
342
  });
356
343
 
357
- // src/interface/Selectable.ts
358
- function isSelectable(object) {
359
- return "isSelectable" in object;
360
- }
361
- function findSelectableInterface(child) {
362
- if (child === void 0) return void 0;
363
- if (child.parent === null) {
364
- return void 0;
365
- }
366
- if (isSelectable(child)) {
367
- return child;
368
- }
369
- return findSelectableInterface(child.parent);
370
- }
371
- var init_Selectable = __esm({
372
- "src/interface/Selectable.ts"() {
373
- "use strict";
374
- }
375
- });
376
-
377
344
  // src/toolbox/select/SelectTool.ts
378
345
  var SelectTool_exports = {};
379
346
  __export(SelectTool_exports, {
@@ -385,7 +352,7 @@ var init_SelectTool = __esm({
385
352
  "src/toolbox/select/SelectTool.ts"() {
386
353
  "use strict";
387
354
  init_TransformTool();
388
- init_Selectable();
355
+ init_findInterface();
389
356
  isSelectTool = (tool) => {
390
357
  return tool.isSelectTool !== void 0;
391
358
  };
@@ -406,7 +373,7 @@ var init_SelectTool = __esm({
406
373
  this.DetachGizmo();
407
374
  }
408
375
  AttachGizmo(selectable) {
409
- if ("isMoveable" in selectable) {
376
+ if ("isMovable" in selectable) {
410
377
  const movable = selectable;
411
378
  this._gizmo.attach(movable);
412
379
  this.SetGizmoVisibility(movable.visible);
@@ -418,7 +385,7 @@ var init_SelectTool = __esm({
418
385
  onClick(e) {
419
386
  super.onClick(e);
420
387
  const first = this._raycaster.intersectObjects(this._scene.Root.children, true).filter((intersect) => intersect.object.visible)[0];
421
- const selectable = findSelectableInterface(first == null ? void 0 : first.object);
388
+ const selectable = findInterface(first == null ? void 0 : first.object, "isSelectable");
422
389
  if (!first || !selectable) {
423
390
  if (this._gizmo.object) {
424
391
  this.Deselect(this._gizmo.object);
@@ -1066,7 +1033,7 @@ var DIVEPointLight = class extends Object3D3 {
1066
1033
  super();
1067
1034
  this.isDIVELight = true;
1068
1035
  this.isDIVEPointLight = true;
1069
- this.isMoveable = true;
1036
+ this.isMovable = true;
1070
1037
  this.isSelectable = true;
1071
1038
  this.gizmo = null;
1072
1039
  this.name = "DIVEPointLight";
@@ -1170,7 +1137,7 @@ var DIVENode = class extends Object3D5 {
1170
1137
  super();
1171
1138
  this.isDIVENode = true;
1172
1139
  this.isSelectable = true;
1173
- this.isMoveable = true;
1140
+ this.isMovable = true;
1174
1141
  this.gizmo = null;
1175
1142
  this.layers.mask = PRODUCT_LAYER_MASK;
1176
1143
  this._boundingBox = new Box3();
@@ -1195,6 +1162,9 @@ var DIVENode = class extends Object3D5 {
1195
1162
  onMove() {
1196
1163
  var _a;
1197
1164
  (_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("UPDATE_OBJECT", { id: this.userData.id, position: this.position, rotation: this.rotation, scale: this.scale });
1165
+ if (this.parent && "isDIVEGroup" in this.parent) {
1166
+ this.parent.UpdateLineTo(this);
1167
+ }
1198
1168
  }
1199
1169
  onSelect() {
1200
1170
  var _a;
@@ -1472,68 +1442,120 @@ var DIVEPrimitive = class extends DIVENode {
1472
1442
  };
1473
1443
 
1474
1444
  // src/group/Group.ts
1475
- import { BoxGeometry as BoxGeometry2, Mesh as Mesh4, MeshBasicMaterial as MeshBasicMaterial2, Vector3 as Vector34 } from "three";
1445
+ import { BufferGeometry as BufferGeometry2, Line, LineDashedMaterial, Vector3 as Vector34 } from "three";
1476
1446
  var DIVEGroup = class extends DIVENode {
1447
+ // lines to children
1477
1448
  constructor() {
1478
1449
  super();
1479
1450
  this.isDIVEGroup = true;
1480
1451
  this.name = "DIVEGroup";
1481
- this._boxMesh = new Mesh4(new BoxGeometry2(0, 0, 0), new MeshBasicMaterial2({ color: 16711680, wireframe: true }));
1482
- this._boxMesh.visible = false;
1483
- this.add(this._boxMesh);
1452
+ this._members = [];
1453
+ this._lines = [];
1484
1454
  }
1485
- SetBoundingBoxVisibility(visible) {
1486
- this._boxMesh.visible = visible;
1455
+ SetLinesVisibility(visible, object) {
1456
+ if (!object) {
1457
+ this._lines.forEach((line) => {
1458
+ line.visible = visible;
1459
+ });
1460
+ return;
1461
+ }
1462
+ const index = this._members.indexOf(object);
1463
+ if (index === -1) return;
1464
+ this._lines[index].visible = visible;
1487
1465
  }
1488
1466
  attach(object) {
1467
+ const line = this.createLine();
1468
+ this.add(line);
1469
+ this._lines.push(line);
1489
1470
  super.attach(object);
1490
- this.recalculatePosition();
1491
- this.updateBoxMesh();
1471
+ this._members.push(object);
1472
+ this.updateLineTo(line, object);
1473
+ this.SetLinesVisibility(true, object);
1492
1474
  return this;
1493
1475
  }
1494
1476
  remove(object) {
1477
+ const index = this._members.indexOf(object);
1478
+ if (index === -1) return this;
1479
+ const line = this._lines[index];
1480
+ super.remove(line);
1481
+ this._lines.splice(index, 1);
1495
1482
  super.remove(object);
1496
- this.recalculatePosition();
1497
- this.updateBoxMesh();
1483
+ this._members.splice(index, 1);
1498
1484
  return this;
1499
1485
  }
1486
+ UpdateLineTo(object) {
1487
+ const index = this._members.indexOf(object);
1488
+ if (index === -1) return;
1489
+ this.updateLineTo(this._lines[index], object);
1490
+ }
1500
1491
  /**
1501
- * Recalculates the position of the group based on it's bounding box.
1502
- * Children's world positions are kept.
1492
+ * Adds a line to this grouo as last child.
1503
1493
  */
1504
- recalculatePosition() {
1505
- var _a;
1506
- const childrensWorldPositions = this.children.map((child) => child.getWorldPosition(new Vector34()));
1507
- const bbcenter = this.updateBB();
1508
- this.position.copy(bbcenter);
1509
- this.children.forEach((child, i) => {
1510
- if (child.uuid === this._boxMesh.uuid) return;
1511
- child.position.copy(this.worldToLocal(childrensWorldPositions[i]));
1494
+ createLine() {
1495
+ const geo = new BufferGeometry2();
1496
+ const mat = new LineDashedMaterial({
1497
+ color: 6710886,
1498
+ dashSize: 0.05,
1499
+ gapSize: 0.025
1512
1500
  });
1513
- (_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("UPDATE_OBJECT", { id: this.userData.id, position: this.position });
1501
+ const line = new Line(geo, mat);
1502
+ line.visible = false;
1503
+ return line;
1514
1504
  }
1515
1505
  /**
1516
- * Updates the bounding box of the group.
1517
- * @returns {Vector3} The new center of the bounding box.
1506
+ * Updates a line to the object.
1518
1507
  */
1519
- updateBB() {
1520
- this._boundingBox.makeEmpty();
1521
- this.children.forEach((child) => {
1522
- if (child.uuid === this._boxMesh.uuid) return;
1523
- this._boundingBox.expandByObject(child);
1524
- });
1525
- return this._boundingBox.getCenter(new Vector34());
1526
- }
1527
- updateBoxMesh() {
1528
- this._boxMesh.quaternion.copy(this.quaternion.clone().invert());
1529
- this._boxMesh.scale.set(1 / this.scale.x, 1 / this.scale.y, 1 / this.scale.z);
1530
- this._boxMesh.geometry = new BoxGeometry2(this._boundingBox.max.x - this._boundingBox.min.x, this._boundingBox.max.y - this._boundingBox.min.y, this._boundingBox.max.z - this._boundingBox.min.z);
1531
- }
1532
- onMove() {
1533
- super.onMove();
1534
- this.updateBB();
1535
- this.updateBoxMesh();
1536
- }
1508
+ updateLineTo(line, object) {
1509
+ line.geometry.setFromPoints([new Vector34(0, 0, 0), object.position.clone()]);
1510
+ line.computeLineDistances();
1511
+ }
1512
+ // public SetBoundingBoxVisibility(visible: boolean): void {
1513
+ // this._boxMesh.visible = visible;
1514
+ // }
1515
+ // /**
1516
+ // * Recalculates the position of the group based on it's bounding box.
1517
+ // * Children's world positions are kept.
1518
+ // */
1519
+ // private recalculatePosition(): void {
1520
+ // // store all children's world positions
1521
+ // const childrensWorldPositions: Vector3[] = this.children.map((child) => child.getWorldPosition(new Vector3()));
1522
+ // // calculate new center and set it as the group's position
1523
+ // const bbcenter = this.updateBB();
1524
+ // this.position.copy(bbcenter);
1525
+ // // set childrens's positions so their world positions are kept
1526
+ // this.children.forEach((child, i) => {
1527
+ // if (child.uuid === this._boxMesh.uuid) return;
1528
+ // child.position.copy(this.worldToLocal(childrensWorldPositions[i]));
1529
+ // });
1530
+ // DIVECommunication.get(this.userData.id)?.PerformAction('UPDATE_OBJECT', { id: this.userData.id, position: this.position });
1531
+ // }
1532
+ // /**
1533
+ // * Updates the bounding box of the group.
1534
+ // * @returns {Vector3} The new center of the bounding box.
1535
+ // */
1536
+ // private updateBB(): Vector3 {
1537
+ // this._boundingBox.makeEmpty();
1538
+ // if (this.children.length === 1) {
1539
+ // // because we always have the box mesh as 1 child
1540
+ // return this.position.clone();
1541
+ // }
1542
+ // this.children.forEach((child) => {
1543
+ // if (child.uuid === this._boxMesh.uuid) return;
1544
+ // this._boundingBox.expandByObject(child);
1545
+ // });
1546
+ // return this._boundingBox.getCenter(new Vector3());
1547
+ // }
1548
+ // private updateBoxMesh(): void {
1549
+ // if (this.children.length === 1) {
1550
+ // // because we always have the box mesh as 1 child
1551
+ // this._boxMesh.visible = false;
1552
+ // return;
1553
+ // }
1554
+ // this._boxMesh.quaternion.copy(this.quaternion.clone().invert());
1555
+ // this._boxMesh.scale.set(1 / this.scale.x, 1 / this.scale.y, 1 / this.scale.z);
1556
+ // this._boxMesh.geometry = new BoxGeometry(this._boundingBox.max.x - this._boundingBox.min.x, this._boundingBox.max.y - this._boundingBox.min.y, this._boundingBox.max.z - this._boundingBox.min.z);
1557
+ // this._boxMesh.visible = true;
1558
+ // }
1537
1559
  };
1538
1560
 
1539
1561
  // src/scene/root/Root.ts
@@ -1554,7 +1576,14 @@ var DIVERoot = class extends Object3D6 {
1554
1576
  return bb;
1555
1577
  }
1556
1578
  GetSceneObject(object) {
1557
- return this.children.find((object3D) => object3D.userData.id === object.id);
1579
+ let foundObject;
1580
+ this.traverse((object3D) => {
1581
+ if (foundObject) return;
1582
+ if (object3D.userData.id === object.id) {
1583
+ foundObject = object3D;
1584
+ }
1585
+ });
1586
+ return foundObject;
1558
1587
  }
1559
1588
  AddSceneObject(object) {
1560
1589
  switch (object.entityType) {
@@ -1723,7 +1752,7 @@ var DIVERoot = class extends Object3D6 {
1723
1752
  if (group.rotation !== void 0) sceneObject.SetRotation(group.rotation);
1724
1753
  if (group.scale !== void 0) sceneObject.SetScale(group.scale);
1725
1754
  if (group.visible !== void 0) sceneObject.SetVisibility(group.visible);
1726
- if (group.bbVisible !== void 0) sceneObject.SetBoundingBoxVisibility(group.bbVisible);
1755
+ if (group.bbVisible !== void 0) sceneObject.SetLinesVisibility(group.bbVisible);
1727
1756
  if (group.parent !== void 0) this.setParent(__spreadProps(__spreadValues({}, group), { parent: group.parent }));
1728
1757
  }
1729
1758
  deleteLight(light) {
@@ -1823,8 +1852,8 @@ var DIVEGrid = class extends Object3D7 {
1823
1852
 
1824
1853
  // src/primitive/floor/Floor.ts
1825
1854
  init_VisibilityLayerMask();
1826
- import { Color as Color6, Mesh as Mesh5, MeshStandardMaterial as MeshStandardMaterial3, PlaneGeometry } from "three";
1827
- var DIVEFloor = class extends Mesh5 {
1855
+ import { Color as Color6, Mesh as Mesh4, MeshStandardMaterial as MeshStandardMaterial3, PlaneGeometry } from "three";
1856
+ var DIVEFloor = class extends Mesh4 {
1828
1857
  constructor() {
1829
1858
  super(new PlaneGeometry(1e4, 1e4), new MeshStandardMaterial3({ color: new Color6(150 / 255, 150 / 255, 150 / 255) }));
1830
1859
  this.isFloor = true;