@shopware-ag/dive 1.15.2 → 1.15.3

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.js CHANGED
@@ -1518,6 +1518,9 @@ var DIVEGroup = class extends DIVENode {
1518
1518
  */
1519
1519
  updateBB() {
1520
1520
  this._boundingBox.makeEmpty();
1521
+ if (this.children.length === 1) {
1522
+ return this.position.clone();
1523
+ }
1521
1524
  this.children.forEach((child) => {
1522
1525
  if (child.uuid === this._boxMesh.uuid) return;
1523
1526
  this._boundingBox.expandByObject(child);
@@ -1525,9 +1528,14 @@ var DIVEGroup = class extends DIVENode {
1525
1528
  return this._boundingBox.getCenter(new Vector34());
1526
1529
  }
1527
1530
  updateBoxMesh() {
1531
+ if (this.children.length === 1) {
1532
+ this._boxMesh.visible = false;
1533
+ return;
1534
+ }
1528
1535
  this._boxMesh.quaternion.copy(this.quaternion.clone().invert());
1529
1536
  this._boxMesh.scale.set(1 / this.scale.x, 1 / this.scale.y, 1 / this.scale.z);
1530
1537
  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);
1538
+ this._boxMesh.visible = true;
1531
1539
  }
1532
1540
  onMove() {
1533
1541
  super.onMove();
@@ -1554,7 +1562,14 @@ var DIVERoot = class extends Object3D6 {
1554
1562
  return bb;
1555
1563
  }
1556
1564
  GetSceneObject(object) {
1557
- return this.children.find((object3D) => object3D.userData.id === object.id);
1565
+ let foundObject;
1566
+ this.traverse((object3D) => {
1567
+ if (foundObject) return;
1568
+ if (object3D.userData.id === object.id) {
1569
+ foundObject = object3D;
1570
+ }
1571
+ });
1572
+ return foundObject;
1558
1573
  }
1559
1574
  AddSceneObject(object) {
1560
1575
  switch (object.entityType) {