added decal movement across the wall
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user