Merge remote-tracking branch 'origin/main' into realTimeVisulization

This commit is contained in:
2025-04-02 18:11:35 +05:30
18 changed files with 337 additions and 278 deletions

View File

@@ -12,18 +12,27 @@ export const useSocketStore = create<any>((set: any, get: any) => ({
}
const socket = io(
`http://${process.env.REACT_APP_SERVER_SOCKET_API_BASE_URL}/Builder`,
`http://${process.env.REACT_APP_SERVER_SOCKET_API_BASE_URL}`,
{
reconnection: false,
auth: { email, organization },
}
);
set({ socket });
const visualizationSocket = io(
`http://${process.env.REACT_APP_SERVER_SOCKET_API_BASE_URL}/Visualization`,
{
reconnection: false,
auth: { email, organization },
}
);
set({ socket, visualizationSocket });
},
disconnectSocket: () => {
set((state: any) => {
state.socket?.disconnect();
state.visualizationSocket?.disconnect();
return { socket: null };
});
},
@@ -400,22 +409,3 @@ export const useWidgetSubOption = create<any>((set: any) => ({
widgetSubOption: "2D",
setWidgetSubOption: (x: any) => set({ widgetSubOption: x }),
}));
export const useLimitDistance = create<any>((set: any) => ({
limitDistance: true,
setLimitDistance: (x: any) => set({ limitDistance: x }),
}));
export const useTileDistance = create<any>((set: any) => ({
gridValue: { size: 300, divisions: 75 },
planeValue: { height: 300, width: 300 },
setGridValue: (value: any) =>
set((state: any) => ({
gridValue: { ...state.gridValue, ...value },
})),
setPlaneValue: (value: any) =>
set((state: any) => ({
planeValue: { ...state.planeValue, ...value },
})),
}));

View File

@@ -36,7 +36,7 @@ type DroppedObjectsState = {
bottom: number | "auto";
}
) => void;
deleteObject: (zoneName: string, index: number) => void; // Add this line
deleteObject: (zoneName: string, id: string, index: number) => void; // Add this line
duplicateObject: (zoneName: string, index: number) => void; // Add this line
};
@@ -77,15 +77,16 @@ export const useDroppedObjectsStore = create<DroppedObjectsState>((set) => ({
};
}),
deleteObject: (zoneName: string, index: number) =>
deleteObject: (zoneName: string, id: string, index: number) =>
set((state) => {
const zone = state.zones[zoneName];
console.log("zone: ", zone);
if (!zone) return state;
return {
zones: {
[zoneName]: {
...zone,
objects: zone.objects.filter((_, i) => i !== index), // Remove object at the given index
objects: zone.objects.filter((obj) => obj.id !== id), // Remove object at the given index
},
},
};