feat: Enhance wall asset interaction and management; implement position updates and add closest point calculation utility

This commit is contained in:
2025-06-30 17:48:29 +05:30
parent 1a9aef323a
commit 364b643c72
6 changed files with 135 additions and 14 deletions

View File

@@ -6,6 +6,7 @@ interface WallAssetStore {
setWallAssets: (assets: WallAsset[]) => void;
addWallAsset: (asset: WallAsset) => void;
updateWallAsset: (uuid: string, updated: Partial<WallAsset>) => void;
setWallAssetPosition: (uuid: string, position: [number, number, number]) => void;
removeWallAsset: (uuid: string) => void;
clearWallAssets: () => void;
@@ -37,6 +38,13 @@ export const createWallAssetStore = () => {
}
}),
setWallAssetPosition: (uuid, position) => set(state => {
const asset = state.wallAssets.find(a => a.modelUuid === uuid);
if (asset) {
asset.position = position;
}
}),
removeWallAsset: (uuid) => set(state => {
state.wallAssets = state.wallAssets.filter(a => a.modelUuid !== uuid);
}),