From ccf64e0f970d257ba6218c5ab036b0aad7625951 Mon Sep 17 00:00:00 2001 From: Jerald-Golden-B Date: Fri, 18 Jul 2025 17:10:40 +0530 Subject: [PATCH] bug fix --- .../builder/asset/functions/assetBoundingBox.tsx | 13 +++++++++---- .../Instances/Instances/wallAssetInstance.tsx | 6 +++--- .../selection3D/moveControls3D.tsx | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/src/modules/builder/asset/functions/assetBoundingBox.tsx b/app/src/modules/builder/asset/functions/assetBoundingBox.tsx index b26485d..5923321 100644 --- a/app/src/modules/builder/asset/functions/assetBoundingBox.tsx +++ b/app/src/modules/builder/asset/functions/assetBoundingBox.tsx @@ -2,13 +2,14 @@ import { Line } from "@react-three/drei"; import { Box3, Vector3 } from "three"; import { useMemo } from "react"; -export const AssetBoundingBox = ({ name, boundingBox, color, lineWidth, }: { name: string; boundingBox: Box3 | null; color: string; lineWidth: number; }) => { - const { points } = useMemo(() => { - if (!boundingBox) return { points: [], center: new Vector3() }; +export const AssetBoundingBox = ({ name, boundingBox, color, lineWidth }: { name: string; boundingBox: Box3 | null; color: string; lineWidth: number; }) => { + const { points, size, center } = useMemo(() => { + if (!boundingBox) { return { points: [], center: new Vector3(), size: new Vector3(), }; } const min = boundingBox.min; const max = boundingBox.max; const center = boundingBox.getCenter(new Vector3()); + const size = boundingBox.getSize(new Vector3()); const edges: Array<[number, number, number]> = [ [min.x, min.y, min.z], [max.x, min.y, min.z], @@ -27,7 +28,7 @@ export const AssetBoundingBox = ({ name, boundingBox, color, lineWidth, }: { nam [min.x, max.y, min.z], [min.x, max.y, max.z], ]; - return { points: edges, center }; + return { points: edges, center, size }; }, [boundingBox]); if (!boundingBox) return null; @@ -41,6 +42,10 @@ export const AssetBoundingBox = ({ name, boundingBox, color, lineWidth, }: { nam color={color} lineWidth={lineWidth} /> + + + + ); }; diff --git a/app/src/modules/builder/wallAsset/Instances/Instances/wallAssetInstance.tsx b/app/src/modules/builder/wallAsset/Instances/Instances/wallAssetInstance.tsx index 1a674c7..203223d 100644 --- a/app/src/modules/builder/wallAsset/Instances/Instances/wallAssetInstance.tsx +++ b/app/src/modules/builder/wallAsset/Instances/Instances/wallAssetInstance.tsx @@ -242,7 +242,7 @@ function WallAssetInstance({ wallAsset }: { wallAsset: WallAsset }) { visible={wallAsset.isVisible} userData={wallAsset} > - + @@ -265,7 +265,7 @@ function WallAssetInstance({ wallAsset }: { wallAsset: WallAsset }) { e.stopPropagation(); let currentObject = e.object as THREE.Object3D; while (currentObject) { - if (currentObject.name === "Scene") { + if (currentObject.userData.wallUuid) { break; } currentObject = currentObject.parent as THREE.Object3D; @@ -286,7 +286,7 @@ function WallAssetInstance({ wallAsset }: { wallAsset: WallAsset }) { e.stopPropagation(); let currentObject = e.object as THREE.Object3D; while (currentObject) { - if (currentObject.name === "Scene") { + if (currentObject.userData.wallUuid) { break; } currentObject = currentObject.parent as THREE.Object3D; diff --git a/app/src/modules/scene/controls/selectionControls/selection3D/moveControls3D.tsx b/app/src/modules/scene/controls/selectionControls/selection3D/moveControls3D.tsx index e58cc44..88b8bf6 100644 --- a/app/src/modules/scene/controls/selectionControls/selection3D/moveControls3D.tsx +++ b/app/src/modules/scene/controls/selectionControls/selection3D/moveControls3D.tsx @@ -208,7 +208,7 @@ function MoveControls3D({ if (dragOffset) { const rawBasePosition = new THREE.Vector3().addVectors(intersectionPoint, dragOffset); - let moveSpeed = keyEvent.includes("Shift") ? 0.25 : 1; + let moveSpeed = keyEvent.includes("Shift") ? 0.05 : 1; const initialBasePosition = initialPositions[movedObjects[0].uuid]; const positionDifference = new THREE.Vector3().subVectors(rawBasePosition, initialBasePosition);