@shopware-ag/dive
Advanced tools
Comparing version 1.15.2 to 1.15.3
{ | ||
"name": "@shopware-ag/dive", | ||
"version": "1.15.2", | ||
"version": "1.15.3", | ||
"description": "Shopware Spatial Framework", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -78,2 +78,8 @@ import { BoxGeometry, Mesh, MeshBasicMaterial, Vector3 } from "three"; | ||
this._boundingBox.makeEmpty(); | ||
if (this.children.length === 1) { | ||
// because we always have the box mesh as 1 child | ||
return this.position.clone(); | ||
} | ||
this.children.forEach((child) => { | ||
@@ -88,5 +94,12 @@ if (child.uuid === this._boxMesh.uuid) return; | ||
private updateBoxMesh(): void { | ||
if (this.children.length === 1) { | ||
// because we always have the box mesh as 1 child | ||
this._boxMesh.visible = false; | ||
return; | ||
} | ||
this._boxMesh.quaternion.copy(this.quaternion.clone().invert()); | ||
this._boxMesh.scale.set(1 / this.scale.x, 1 / this.scale.y, 1 / this.scale.z); | ||
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); | ||
this._boxMesh.visible = true; | ||
} | ||
@@ -93,0 +106,0 @@ |
@@ -44,4 +44,13 @@ import { Box3, Color, Object3D } from "three"; | ||
public GetSceneObject<T extends DIVESceneObject>(object: Partial<COMEntity> & { id: string }): T | undefined { | ||
return this.children.find(object3D => object3D.userData.id === object.id) as T | undefined; | ||
public GetSceneObject<T extends DIVESceneObject>( | ||
object: Partial<COMEntity> & { id: string } | ||
): T | undefined { | ||
let foundObject: T | undefined; | ||
this.traverse((object3D) => { | ||
if (foundObject) return; | ||
if (object3D.userData.id === object.id) { | ||
foundObject = object3D as T; | ||
} | ||
}); | ||
return foundObject; | ||
} | ||
@@ -48,0 +57,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
949164
15016