added decal movement across the wall

This commit is contained in:
2025-08-26 16:38:29 +05:30
parent 165325468a
commit c0e040fb3a
5 changed files with 131 additions and 55 deletions

View File

@@ -12,7 +12,7 @@ interface WallStore {
addDecal: (wallUuid: string, decal: Decal) => void;
updateDecal: (decalUuid: string, decal: Decal) => Wall | undefined;
removeDecal: (decalUuid: string) => Wall | undefined;
updateDecalPosition: (decalUuid: string, position: [number, number, number]) => void;
updateDecalPosition: (decalUuid: string, position: [number, number, number]) => Wall | undefined;
updateDecalRotation: (decalUuid: string, rotation: number) => void;
updateDecalScale: (decalUuid: string, scale: number) => void;
@@ -118,15 +118,20 @@ export const createWallStore = () => {
return affectedWall;
},
updateDecalPosition: (decalUuid, position) => set((state) => {
for (const wall of state.walls) {
const decal = wall.decals.find(d => d.decalUuid === decalUuid);
if (decal) {
decal.decalPosition = position;
break;
updateDecalPosition: (decalUuid, position) => {
let affectedWall: Wall | undefined;
set((state) => {
for (const wall of state.walls) {
const decal = wall.decals.find(d => d.decalUuid === decalUuid);
if (decal) {
decal.decalPosition = position;
affectedWall = JSON.parse(JSON.stringify(wall));
break;
}
}
}
}),
})
return affectedWall;
},
updateDecalRotation: (decalUuid, rotation) => set((state) => {
for (const wall of state.walls) {