@shopware-ag/dive 1.15.1 → 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.cjs CHANGED
@@ -879,7 +879,8 @@ var _DIVECommunication = class _DIVECommunication {
879
879
  lights: Array.from(this.registered.values()).filter((object) => object.entityType === "light"),
880
880
  objects: Array.from(this.registered.values()).filter((object) => object.entityType === "model"),
881
881
  cameras: Array.from(this.registered.values()).filter((object) => object.entityType === "pov"),
882
- primitives: Array.from(this.registered.values()).filter((object) => object.entityType === "primitive")
882
+ primitives: Array.from(this.registered.values()).filter((object) => object.entityType === "primitive"),
883
+ groups: Array.from(this.registered.values()).filter((object) => object.entityType === "group")
883
884
  };
884
885
  Object.assign(payload, sceneData);
885
886
  return sceneData;
@@ -1539,6 +1540,9 @@ var DIVEGroup = class extends DIVENode {
1539
1540
  */
1540
1541
  updateBB() {
1541
1542
  this._boundingBox.makeEmpty();
1543
+ if (this.children.length === 1) {
1544
+ return this.position.clone();
1545
+ }
1542
1546
  this.children.forEach((child) => {
1543
1547
  if (child.uuid === this._boxMesh.uuid) return;
1544
1548
  this._boundingBox.expandByObject(child);
@@ -1546,9 +1550,14 @@ var DIVEGroup = class extends DIVENode {
1546
1550
  return this._boundingBox.getCenter(new import_three10.Vector3());
1547
1551
  }
1548
1552
  updateBoxMesh() {
1553
+ if (this.children.length === 1) {
1554
+ this._boxMesh.visible = false;
1555
+ return;
1556
+ }
1549
1557
  this._boxMesh.quaternion.copy(this.quaternion.clone().invert());
1550
1558
  this._boxMesh.scale.set(1 / this.scale.x, 1 / this.scale.y, 1 / this.scale.z);
1551
1559
  this._boxMesh.geometry = new import_three10.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);
1560
+ this._boxMesh.visible = true;
1552
1561
  }
1553
1562
  onMove() {
1554
1563
  super.onMove();
@@ -1575,7 +1584,14 @@ var DIVERoot = class extends import_three11.Object3D {
1575
1584
  return bb;
1576
1585
  }
1577
1586
  GetSceneObject(object) {
1578
- return this.children.find((object3D) => object3D.userData.id === object.id);
1587
+ let foundObject;
1588
+ this.traverse((object3D) => {
1589
+ if (foundObject) return;
1590
+ if (object3D.userData.id === object.id) {
1591
+ foundObject = object3D;
1592
+ }
1593
+ });
1594
+ return foundObject;
1579
1595
  }
1580
1596
  AddSceneObject(object) {
1581
1597
  switch (object.entityType) {