feat: Enhance wall and wall asset interactions; integrate pointer event handling for wall asset updates and improve wall asset visibility logic

This commit is contained in:
2025-07-31 15:53:34 +05:30
parent 5b62f54769
commit 1177e35db6
2 changed files with 81 additions and 38 deletions

View File

@@ -16,8 +16,10 @@ import defaultMaterial from '../../../../../assets/textures/floor/wall-tex.png';
import material1 from '../../../../../assets/textures/floor/factory wall texture.jpg';
function Wall({ wall }: { readonly wall: Wall }) {
const { wallStore } = useSceneContext();
const { wallStore, wallAssetStore } = useSceneContext();
const { walls, addDecal } = wallStore();
const { getAssetsByWall } = wallAssetStore();
const assets = getAssetsByWall(wall.wallUuid);
const { selectedWall, setSelectedWall, setSelectedDecal } = useBuilderStore();
const { togglView } = useToggleView();
const { activeModule } = useModuleStore();
@@ -105,19 +107,35 @@ function Wall({ wall }: { readonly wall: Wall }) {
key={wall.wallUuid}
userData={wall}
>
<Base
castShadow
receiveShadow
ref={meshRef}
geometry={geometry}
position={[centerX, centerY, centerZ]}
rotation={[0, -angle, 0]}
userData={wall}
>
{materials.map((material, index) => (
<primitive key={index} visible={visible} object={material} attach={`material-${index}`} />
))}
</Base>
{(assets.length > 0 || walls[0].wallUuid === wall.wallUuid) ?
<Base
castShadow
receiveShadow
ref={meshRef}
geometry={geometry}
position={[centerX, centerY, centerZ]}
rotation={[0, -angle, 0]}
userData={wall}
>
{materials.map((material, index) => (
<primitive key={index} visible={visible} object={material} attach={`material-${index}`} />
))}
</Base>
:
<mesh
castShadow
receiveShadow
ref={meshRef}
geometry={geometry}
position={[centerX, centerY, centerZ]}
rotation={[0, -angle, 0]}
userData={wall}
>
{materials.map((material, index) => (
<primitive key={index} visible={visible} object={material} attach={`material-${index}`} />
))}
</mesh>
}
<mesh
castShadow
receiveShadow