+
+
ROI Summary
@@ -14,6 +75,111 @@ const ROISummary = () => {
+
+
Product :
+
{roiSummaryData.productName}
+
+
+
+
+ +{roiSummaryData.roiPercentage}% ROI with payback in
+ just {roiSummaryData.paybackPeriod} months
+
+
+
+
+
+
+ you're on track to hit it by
+
July 2029
+
+
+
+
+
+ Total Cost Incurred
+ {roiSummaryData.totalCost}
+
+
+ Revenue Generated
+
+ {roiSummaryData.revenueGenerated}
+
+
+
+
+ Net Profit
+ {roiSummaryData.netProfit}
+
+
+
+
+
+
+ â‘
+ Cost Breakdown
+
+
+
+ {isTableOpen ? "⌵" : "⌵"}
+
+
+
+
+
+
+ Item
+ Unit Cost
+ Labor Cost
+ Total Cost
+ Selling Price
+
+
+
+ {roiSummaryData.costBreakdown.map((row, index) => (
+
+ {row.item}
+ {row.unitCost}
+ {row.laborCost}
+ {row.totalCost}
+ {row.sellingPrice}
+
+ ))}
+
+
+
+
+
+
+ 💡
+ How to improve ROI?
+
+
+ Increase CNC utilization by 10% {" "}
+ to shave 0.5 months of payback
+ period
+
+
+ Get ROI Boost Tips
+
+
);
diff --git a/app/src/components/ui/analysis/SemiCircleProgress.tsx b/app/src/components/ui/analysis/SemiCircleProgress.tsx
new file mode 100644
index 0000000..084636b
--- /dev/null
+++ b/app/src/components/ui/analysis/SemiCircleProgress.tsx
@@ -0,0 +1,27 @@
+import React from "react";
+
+const SemiCircleProgress = () => {
+ const progress = 50;
+ const clampedProgress = Math.min(Math.max(progress, 0), 100);
+ const gradientProgress = clampedProgress * 0.5;
+
+ return (
+
+
+
+
{clampedProgress}%
+
Years
+
+
you're on track to hit it by July 2029
+
+ );
+};
+
+export default SemiCircleProgress;
diff --git a/app/src/components/ui/analysis/ThroughputSummary.tsx b/app/src/components/ui/analysis/ThroughputSummary.tsx
index cb4fac5..b92a82d 100644
--- a/app/src/components/ui/analysis/ThroughputSummary.tsx
+++ b/app/src/components/ui/analysis/ThroughputSummary.tsx
@@ -11,21 +11,57 @@ import { PowerIcon, ThroughputSummaryIcon } from "../../icons/analysis";
ChartJS.register(LineElement, CategoryScale, LinearScale, PointElement);
+// Helper function to generate random colors
+const getRandomColor = () => {
+ const letters = "0123456789ABCDEF";
+ let color = "#";
+ for (let i = 0; i < 6; i++) {
+ color += letters[Math.floor(Math.random() * 16)];
+ }
+ return color;
+};
+
const ThroughputSummary = () => {
- const data = {
+ // Define all data internally within the component
+ const timeRange = {
+ startTime: "08:00 AM",
+ endTime: "09:00 AM",
+ };
+
+ const throughputData = {
labels: ["08:00", "08:10", "08:20", "08:30", "08:40", "08:50", "09:00"],
+ data: [100, 120, 110, 130, 125, 128, 132],
+ totalThroughput: 1240,
+ assetUsage: 85,
+ };
+
+ const energyConsumption = {
+ energyConsumed: 456,
+ unit: "KWH",
+ };
+
+ // Dynamic shift data
+ const shiftUtilization = [
+ { shift: 1, percentage: 30 },
+ { shift: 2, percentage: 40 },
+ { shift: 3, percentage: 30 },
+ ];
+
+ // Chart data configuration
+ const chartData = {
+ labels: throughputData.labels,
datasets: [
{
label: "Units/hour",
- data: [100, 120, 110, 130, 125, 128, 132],
+ data: throughputData.data,
borderColor: "#B392F0",
tension: 0.4,
- pointRadius: 0, // hide points
+ pointRadius: 0, // Hide points
},
],
};
- const options = {
+ const chartOptions = {
responsive: true,
scales: {
x: {
@@ -57,19 +93,15 @@ const ThroughputSummary = () => {
},
};
- const shiftUtilization = {
- "shift 1": 25,
- "shift 2": 45,
- "shift 3": 15,
- };
-
return (
Throughput Summary
-
08:00 - 09:00 AM
+
+ {timeRange.startTime} - {timeRange.endTime}
+
@@ -78,14 +110,15 @@ const ThroughputSummary = () => {
- 1240 Units/hour
+ {throughputData.totalThroughput} {" "}
+ Units/hour
Asset usage
-
85%
+
{throughputData.assetUsage}%
-
+
@@ -97,43 +130,41 @@ const ThroughputSummary = () => {
-
456
-
KWH
+
{energyConsumption.energyConsumed}
+
{energyConsumption.unit}
Shift Utilization
-
85%
+
{throughputData.assetUsage}%
-
-
-
+ {/* Dynamically create progress bars based on shiftUtilization array */}
+ {shiftUtilization.map((shift) => (
+
+ ))}
+
-
-
- Shift 1
-
-
-
- Shift 2
-
-
-
- Shift 3
-
+ {/* Dynamically create shift indicators with random colors */}
+ {shiftUtilization.map((shift) => (
+
+
+ Shift {shift.shift}
+
+ ))}
diff --git a/app/src/components/ui/inputs/InputToggle.tsx b/app/src/components/ui/inputs/InputToggle.tsx
index 941d486..5e69291 100644
--- a/app/src/components/ui/inputs/InputToggle.tsx
+++ b/app/src/components/ui/inputs/InputToggle.tsx
@@ -24,11 +24,16 @@ const InputToggle: React.FC
= ({
{label}
-
+
diff --git a/app/src/components/ui/inputs/PreviewSelectionWithUpload.tsx b/app/src/components/ui/inputs/PreviewSelectionWithUpload.tsx
index 3e14517..53e03ce 100644
--- a/app/src/components/ui/inputs/PreviewSelectionWithUpload.tsx
+++ b/app/src/components/ui/inputs/PreviewSelectionWithUpload.tsx
@@ -1,41 +1,72 @@
import React, { useState } from "react";
-import LabledDropdown from "./LabledDropdown";
import { ArrowIcon } from "../../icons/ExportCommonIcons";
+import LabledDropdown from "./LabledDropdown";
-const PreviewSelectionWithUpload: React.FC = () => {
- const [showPreview, setSetshowPreview] = useState(false);
+interface PreviewSelectionWithUploadProps {
+ preview?: boolean;
+ upload?: boolean;
+ label?: string;
+ onSelect: (option: string) => void;
+ defaultOption: string;
+ options: string[];
+}
+
+const PreviewSelectionWithUpload: React.FC
= ({
+ preview = false,
+ upload = false,
+ onSelect,
+ label,
+ defaultOption,
+ options,
+}) => {
+ const [showPreview, setShowPreview] = useState(false);
return (
-
setSetshowPreview(!showPreview)}
- >
-
Preview
-
-
- {showPreview && (
-
-
+ {preview && (
+ <>
+
setShowPreview(!showPreview)}
+ >
+ Preview
+
+
+ {showPreview && (
+
+ )}
+ >
+ )}
+ {upload && (
+
+
+
Upload Product
+
+
+ Upload here
+
+
)}
-
-
-
Upload Product
-
-
- Upload here
-
-
-
+
);
};
diff --git a/app/src/components/ui/list/DropDownList.tsx b/app/src/components/ui/list/DropDownList.tsx
index 0416a9e..d0b62e8 100644
--- a/app/src/components/ui/list/DropDownList.tsx
+++ b/app/src/components/ui/list/DropDownList.tsx
@@ -81,8 +81,8 @@ const DropDownList: React.FC
= ({
return isPointInsidePolygon([x, z], polygon2D);
})
.map((item: any) => ({
- id: item.modeluuid,
- name: item.modelname,
+ id: item.modelUuid,
+ name: item.modelName,
position: item.position,
rotation: item.rotation
}));
diff --git a/app/src/components/ui/list/List.tsx b/app/src/components/ui/list/List.tsx
index ac21c5a..cdd2a53 100644
--- a/app/src/components/ui/list/List.tsx
+++ b/app/src/components/ui/list/List.tsx
@@ -10,7 +10,7 @@ import {
ArrowIcon,
EyeIcon,
LockIcon,
- RmoveIcon,
+ RemoveIcon,
} from "../../icons/ExportCommonIcons";
import { useThree } from "@react-three/fiber";
import { useFloorItems, useZoneAssetId, useZones } from "../../../store/store";
@@ -136,8 +136,8 @@ const List: React.FC = ({ items = [], remove }) => {
console.log('response: ', response);
setFloorItems((prevFloorItems: any[]) =>
prevFloorItems.map((floorItems) =>
- floorItems.modeluuid === zoneAssetId.id
- ? { ...floorItems, modelname: response.modelname }
+ floorItems.modelUuid === zoneAssetId.id
+ ? { ...floorItems, modelName: response.modelName }
: floorItems
)
);
@@ -181,7 +181,7 @@ const List: React.FC = ({ items = [], remove }) => {
{remove && (
-
+
)}
{item.assets && item.assets.length > 0 && (
@@ -218,7 +218,7 @@ const List: React.FC = ({ items = [], remove }) => {
{remove && (
-
+
)}
diff --git a/app/src/components/ui/simulation/simulationPlayer.tsx b/app/src/components/ui/simulation/simulationPlayer.tsx
index 528fbc2..a23652b 100644
--- a/app/src/components/ui/simulation/simulationPlayer.tsx
+++ b/app/src/components/ui/simulation/simulationPlayer.tsx
@@ -7,6 +7,15 @@ import {
usePlayButtonStore,
useResetButtonStore,
} from "../../../store/usePlayButtonStore";
+import {
+ DailyProductionIcon,
+ EndIcon,
+ ExpandIcon,
+ HourlySimulationIcon,
+ MonthlyROI,
+ SpeedIcon,
+ StartIcon,
+} from "../../icons/ExportCommonIcons";
const SimulationPlayer: React.FC = () => {
const { speed, setSpeed } = useAnimationPlaySpeed();
@@ -21,6 +30,7 @@ const SimulationPlayer: React.FC = () => {
// Button functions
const handleReset = () => {
setReset(true);
+ // setReset(!isReset);
setSpeed(1);
};
const handlePlayStop = () => {
@@ -30,7 +40,7 @@ const SimulationPlayer: React.FC = () => {
const handleExit = () => {
setPlaySimulation(false);
setIsPlaying(false);
- setActiveTool("cursor")
+ setActiveTool("cursor");
};
// Slider functions starts
@@ -72,70 +82,277 @@ const SimulationPlayer: React.FC = () => {
}, []);
// Slider function ends
+ // UI-Part
+ const hourlySimulation = 25;
+ const dailyProduction = 75;
+ const monthlyROI = 50;
+
+ const process = [
+ { name: "process 1", completed: 0 }, // 0% completed
+ { name: "process 2", completed: 20 }, // 20% completed
+ { name: "process 3", completed: 40 }, // 40% completed
+ { name: "process 4", completed: 60 }, // 60% completed
+ { name: "process 5", completed: 80 }, // 80% completed
+ { name: "process 6", completed: 100 }, // 100% completed
+ { name: "process 7", completed: 0 }, // 0% completed
+ { name: "process 8", completed: 50 }, // 50% completed
+ { name: "process 9", completed: 90 }, // 90% completed
+ { name: "process 10", completed: 30 }, // 30% completed
+ ];
+ const [expand, setExpand] = useState(false);
+ // Move getRandomColor out of render
+ const getRandomColor = () => {
+ const letters = "0123456789ABCDEF";
+ let color = "#";
+ for (let i = 0; i < 6; i++) {
+ color += letters[Math.floor(Math.random() * 16)];
+ }
+ return color;
+ };
+
+ // Store colors for each process item
+ const [processColors, setProcessColors] = useState([]);
+
+ // Generate colors on mount or when process changes
+ useEffect(() => {
+ const generatedColors = process.map(() => getRandomColor());
+ setProcessColors(generatedColors);
+ }, []);
+
+ const intervals = [10, 20, 30, 40, 50, 60]; // in minutes
+ const totalSegments = intervals.length;
+ const progress = 80; // percent (example)
+
+ const processPlayerRef = useRef(null);
+ const processWrapperRef = useRef(null);
+ const [playerPosition, setPlayerPosition] = useState(0);
+
+ const handleProcessMouseDown = (e: React.MouseEvent) => {
+ if (!processWrapperRef.current) return;
+
+ const rect = processWrapperRef.current.getBoundingClientRect();
+ let x = e.clientX - rect.left;
+ x = Math.max(0, Math.min(x, rect.width));
+ setPlayerPosition(x);
+
+ const onMouseMove = (e: MouseEvent) => {
+ if (!processWrapperRef.current) return;
+ const newRect = processWrapperRef.current.getBoundingClientRect();
+ let newX = e.clientX - newRect.left;
+ newX = Math.max(0, Math.min(newX, newRect.width));
+ setPlayerPosition(newX);
+
+ const progressPercent = (newX / newRect.width) * 100;
+ console.log(`Dragging at progress: ${progressPercent.toFixed(1)}%`);
+ };
+
+ const onMouseUp = () => {
+ document.removeEventListener("mousemove", onMouseMove);
+ document.removeEventListener("mouseup", onMouseUp);
+ };
+
+ document.addEventListener("mousemove", onMouseMove);
+ document.addEventListener("mouseup", onMouseUp);
+ };
+
return (
-
+
-
{
- handleReset();
- }}
- >
-
- Reset
-
-
{
- handlePlayStop();
- }}
- >
-
- {playSimulation ? "Play" : "Stop"}
-
-
{
- handleExit();
- }}
- >
-
- Exit
-
-
-
-
0.5x
-
-
-
-
-
-
-
-
-
-
-
-
- {speed.toFixed(1)}x
+
+ {/* hourlySimulation */}
+
+
+
+
+
+
Hourly Simulation
-
+
+
+ {/* dailyProduction */}
+
+
+
+
+
+
Daily Production
+
+
+
+ {/* monthlyROI */}
+
-
8x
+
+
{
+ handleReset();
+ }}
+ >
+
+ Reset
+
+
{
+ handlePlayStop();
+ }}
+ >
+
+ {playSimulation ? "Play" : "Stop"}
+
+
{
+ handleExit();
+ }}
+ >
+
+ Exit
+
+
setExpand(!expand)}
+ >
+
+
+
+
+
+
+
+
+
+
+
+
23 April ,25
+
04:41 PM
+
+
+
+
+ {intervals.map((label, index) => {
+ const segmentProgress = (index / totalSegments) * 100;
+ const isFilled = progress >= segmentProgress;
+ return (
+
+
+ {index < intervals.length - 1 && (
+ = ((index + 1) / totalSegments) * 100
+ ? "filled"
+ : ""
+ }`}
+ >
+ )}
+
+ );
+ })}
+
+
+
+
+
+
+
+
+
0X
+
+
+
+
+
+
+
+
+
+
+
+ {speed.toFixed(1)}x
+
+
+
+
8x
+
+
+
+
+
+
+ {process.map((item, index) => (
+
+ ))}
+
+
diff --git a/app/src/functions/collabUserIcon.tsx b/app/src/functions/collabUserIcon.tsx
deleted file mode 100644
index 9e6802b..0000000
--- a/app/src/functions/collabUserIcon.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import React from "react";
-import CustomAvatar from "./users/Avatar";
-
-interface CollabUserIconProps {
- userName: string;
- userImage?: string;
- color: string;
-}
-
-const CollabUserIcon: React.FC
= ({
- userImage,
- userName,
- color,
-}) => {
- return (
-
-
- {userImage ? (
-
- ) : (
-
- )}
-
-
- {userName}
-
-
- );
-};
-
-export default CollabUserIcon;
diff --git a/app/src/modules/builder/IntialLoad/loadInitialFloorItems.ts b/app/src/modules/builder/IntialLoad/loadInitialFloorItems.ts
index c46c0e7..a351d73 100644
--- a/app/src/modules/builder/IntialLoad/loadInitialFloorItems.ts
+++ b/app/src/modules/builder/IntialLoad/loadInitialFloorItems.ts
@@ -72,7 +72,7 @@ async function loadInitialFloorItems(
// Check Three.js Cache
const cachedModel = THREE.Cache.get(item.modelfileID!);
if (cachedModel) {
- // console.log(`[Cache] Fetching ${item.modelname}`);
+ // console.log(`[Cache] Fetching ${item.modelName}`);
processLoadedModel(cachedModel.scene.clone(), item, itemsGroup, setFloorItems, addEvent);
modelsLoaded++;
checkLoadingCompletion(modelsLoaded, modelsToLoad, dracoLoader, resolve);
@@ -82,7 +82,7 @@ async function loadInitialFloorItems(
// Check IndexedDB
const indexedDBModel = await retrieveGLTF(item.modelfileID!);
if (indexedDBModel) {
- // console.log(`[IndexedDB] Fetching ${item.modelname}`);
+ // console.log(`[IndexedDB] Fetching ${item.modelName}`);
const blobUrl = URL.createObjectURL(indexedDBModel);
loader.load(blobUrl, (gltf) => {
URL.revokeObjectURL(blobUrl);
@@ -94,7 +94,7 @@ async function loadInitialFloorItems(
},
undefined,
(error) => {
- toast.error(`[IndexedDB] Error loading ${item.modelname}:`);
+ toast.error(`[IndexedDB] Error loading ${item.modelName}:`);
URL.revokeObjectURL(blobUrl);
resolve();
}
@@ -103,7 +103,7 @@ async function loadInitialFloorItems(
}
// Fetch from Backend
- // console.log(`[Backend] Fetching ${item.modelname}`);
+ // console.log(`[Backend] Fetching ${item.modelName}`);
const modelUrl = `${url_Backend_dwinzo}/api/v2/AssetFile/${item.modelfileID!}`;
loader.load(modelUrl, async (gltf) => {
const modelBlob = await fetch(modelUrl).then((res) => res.blob());
@@ -115,18 +115,18 @@ async function loadInitialFloorItems(
},
undefined,
(error) => {
- toast.error(`[Backend] Error loading ${item.modelname}:`);
+ toast.error(`[Backend] Error loading ${item.modelName}:`);
resolve();
}
);
});
} else {
- // console.log(`Item ${item.modelname} is not near`);
+ // console.log(`Item ${item.modelName} is not near`);
setFloorItems((prevItems) => [
...(prevItems || []),
{
- modeluuid: item.modeluuid,
- modelname: item.modelname,
+ modelUuid: item.modelUuid,
+ modelName: item.modelName,
position: item.position,
rotation: item.rotation,
modelfileID: item.modelfileID,
@@ -154,9 +154,9 @@ function processLoadedModel(
addEvent: (event: EventsSchema) => void,
) {
const model = gltf.clone();
- model.uuid = item.modeluuid;
+ model.uuid = item.modelUuid;
model.scale.set(...CONSTANTS.assetConfig.defaultScaleBeforeGsap);
- model.userData = { name: item.modelname, modelId: item.modelfileID, modeluuid: item.modeluuid };
+ model.userData = { name: item.modelName, modelId: item.modelfileID, modelUuid: item.modelUuid, eventData: item.eventData };
model.position.set(...item.position);
model.rotation.set(item.rotation.x, item.rotation.y, item.rotation.z);
@@ -170,256 +170,142 @@ function processLoadedModel(
}
});
-
itemsGroup?.current?.add(model);
- setFloorItems((prevItems) => [
- ...(prevItems || []),
- {
- modeluuid: item.modeluuid,
- modelname: item.modelname,
- position: item.position,
- rotation: item.rotation,
- modelfileID: item.modelfileID,
- isLocked: item.isLocked,
- isVisible: item.isVisible,
- },
- ]);
+ if (item.eventData) {
+ setFloorItems((prevItems) => [
+ ...(prevItems || []),
+ {
+ modelUuid: item.modelUuid,
+ modelName: item.modelName,
+ position: item.position,
+ rotation: item.rotation,
+ modelfileID: item.modelfileID,
+ isLocked: item.isLocked,
+ isVisible: item.isVisible,
+ eventData: item.eventData,
+ },
+ ]);
- if (item.modelfileID === "a1ee92554935007b10b3eb05") {
- const data = PointsCalculator(
- 'Vehicle',
- gltf.clone(),
- new THREE.Vector3(...model.rotation)
- );
-
- if (!data || !data.points) return;
-
- const vehicleEvent: VehicleEventSchema = {
- modelUuid: item.modeluuid,
- modelName: item.modelname,
- position: item.position,
- rotation: [item.rotation.x, item.rotation.y, item.rotation.z],
- state: "idle",
- type: "vehicle",
- speed: 1,
- point: {
- uuid: THREE.MathUtils.generateUUID(),
- position: [data.points[0].x, data.points[0].y, data.points[0].z],
- rotation: [0, 0, 0],
- action: {
- actionUuid: THREE.MathUtils.generateUUID(),
- actionName: "Vehicle Action",
- actionType: "travel",
- unLoadDuration: 5,
- loadCapacity: 10,
- pickUpPoint: null,
- unLoadPoint: null,
- triggers: []
- }
- }
- };
- addEvent(vehicleEvent);
- } else if (item.modelfileID === "7dc04e36882e4debbc1a8e3d") {
- const data = PointsCalculator(
- 'Conveyor',
- gltf.clone(),
- new THREE.Vector3(...model.rotation)
- );
-
- if (!data || !data.points) return;
-
- const ConveyorEvent: ConveyorEventSchema = {
- modelUuid: item.modeluuid,
- modelName: item.modelname,
- position: item.position,
- rotation: [item.rotation.x, item.rotation.y, item.rotation.z],
- state: "idle",
- type: "transfer",
- speed: 1,
- points: data.points.map((point: THREE.Vector3, index: number) => ({
- uuid: THREE.MathUtils.generateUUID(),
- position: [point.x, point.y, point.z],
- rotation: [0, 0, 0],
- action: {
- actionUuid: THREE.MathUtils.generateUUID(),
- actionName: `Action ${index + 1}`,
- actionType: 'default',
- material: 'Default material',
- delay: 0,
- spawnInterval: 5,
- spawnCount: 1,
- triggers: []
- }
- }))
- };
- addEvent(ConveyorEvent);
- } else if (item.modelfileID === "7dc04e36882e4debbc1a8e3d") {
- // const data = PointsCalculator(
- // 'Conveyor',
- // gltf.clone(),
- // new THREE.Vector3(...model.rotation)
- // );
-
- // if (!data || !data.points) return;
-
- // const points: ConveyorPointSchema[] = data.points.map((point: THREE.Vector3, index: number) => {
- // const actionUuid = THREE.MathUtils.generateUUID();
- // return {
- // uuid: THREE.MathUtils.generateUUID(),
- // position: [point.x, point.y, point.z],
- // rotation: [0, 0, 0],
- // action: {
- // actionUuid,
- // actionName: `Action ${index}`,
- // actionType: 'default',
- // material: 'inherit',
- // delay: 0,
- // spawnInterval: 5,
- // spawnCount: 1,
- // triggers: []
- // }
- // };
- // });
-
- // points.forEach((point, index) => {
- // if (index < points.length - 1) {
- // const nextPoint = points[index + 1];
- // point.action.triggers.push({
- // triggerUuid: THREE.MathUtils.generateUUID(),
- // triggerName: `Trigger 1`,
- // triggerType: "onComplete",
- // delay: 0,
- // triggeredAsset: {
- // triggeredModel: {
- // modelName: item.modelname,
- // modelUuid: item.modeluuid
- // },
- // triggeredPoint: {
- // pointName: `Point ${index + 1}`,
- // pointUuid: nextPoint.uuid
- // },
- // triggeredAction: {
- // actionName: nextPoint.action.actionName,
- // actionUuid: nextPoint.action.actionUuid
- // }
- // }
- // });
- // }
- // });
-
- // const ConveyorEvent: ConveyorEventSchema = {
- // modelUuid: item.modeluuid,
- // modelName: item.modelname,
- // position: item.position,
- // rotation: [item.rotation.x, item.rotation.y, item.rotation.z],
- // state: "idle",
- // type: "transfer",
- // speed: 1,
- // points
- // };
- // addEvent(ConveyorEvent);
- } else if (item.modelfileID === "7dc04e36882e4debbc1a8e3d") {
- const data = PointsCalculator(
- 'Conveyor',
- gltf.clone(),
- new THREE.Vector3(...model.rotation)
- );
-
- if (!data || !data.points) return;
-
- const ConveyorEvent: ConveyorEventSchema = {
- modelUuid: item.modeluuid,
- modelName: item.modelname,
- position: item.position,
- rotation: [item.rotation.x, item.rotation.y, item.rotation.z],
- state: "idle",
- type: "transfer",
- speed: 1,
- points: data.points.map((point: THREE.Vector3, index: number) => ({
- uuid: THREE.MathUtils.generateUUID(),
- position: [point.x, point.y, point.z],
- rotation: [0, 0, 0],
- action: {
- actionUuid: THREE.MathUtils.generateUUID(),
- actionName: `Action ${index}`,
- actionType: 'default',
- material: 'inherit',
- delay: 0,
- spawnInterval: 5,
- spawnCount: 1,
- triggers: []
- }
- }))
- };
- addEvent(ConveyorEvent);
- } else if (item.modelfileID === "29dee78715ad5b853f5c346d") {
- const data = PointsCalculator(
- 'StaticMachine',
- gltf.clone(),
- new THREE.Vector3(...model.rotation)
- );
-
- if (!data || !data.points) return;
-
- const machineEvent: MachineEventSchema = {
- modelUuid: item.modeluuid,
- modelName: item.modelname,
- position: item.position,
- rotation: [item.rotation.x, item.rotation.y, item.rotation.z],
- state: "idle",
- type: "machine",
- point: {
- uuid: THREE.MathUtils.generateUUID(),
- position: [data.points[0].x, data.points[0].y, data.points[0].z],
- rotation: [0, 0, 0],
- action: {
- actionUuid: THREE.MathUtils.generateUUID(),
- actionName: "Process Action",
- actionType: "process",
- processTime: 10,
- swapMaterial: "material-id",
- triggers: []
- }
- }
- };
- addEvent(machineEvent);
- } else if (item.modelfileID === "52e6681fbb743a890d96c914") {
- const data = PointsCalculator(
- 'ArmBot',
- gltf.clone(),
- new THREE.Vector3(...model.rotation)
- );
-
- if (!data || !data.points) return;
-
- const roboticArmEvent: RoboticArmEventSchema = {
- modelUuid: item.modeluuid,
- modelName: item.modelname,
- position: item.position,
- rotation: [item.rotation.x, item.rotation.y, item.rotation.z],
- state: "idle",
- type: "roboticArm",
- speed: 1,
- point: {
- uuid: THREE.MathUtils.generateUUID(),
- position: [data.points[0].x, data.points[0].y, data.points[0].z],
- rotation: [0, 0, 0],
- actions: [
- {
+ if (item.eventData.type === "vehicle") {
+ const vehicleEvent: VehicleEventSchema = {
+ modelUuid: item.modelUuid,
+ modelName: item.modelName,
+ position: item.position,
+ rotation: [item.rotation.x, item.rotation.y, item.rotation.z],
+ state: "idle",
+ type: "vehicle",
+ speed: 1,
+ point: {
+ uuid: item.eventData.point?.uuid || THREE.MathUtils.generateUUID(),
+ position: [item.eventData.point?.position[0] || 0, item.eventData.point?.position[1] || 0, item.eventData.point?.position[2] || 0],
+ rotation: [item.eventData.point?.rotation[0] || 0, item.eventData.point?.rotation[1] || 0, item.eventData.point?.rotation[2] || 0],
+ action: {
actionUuid: THREE.MathUtils.generateUUID(),
- actionName: "Pick and Place",
- actionType: "pickAndPlace",
- process: {
- startPoint: [0, 0, 0],
- endPoint: [0, 0, 0]
- },
+ actionName: "Vehicle Action",
+ actionType: "travel",
+ unLoadDuration: 5,
+ loadCapacity: 10,
+ steeringAngle:0,
+ pickUpPoint: null,
+ unLoadPoint: null,
triggers: []
}
- ]
- }
- };
- addEvent(roboticArmEvent);
+ }
+ };
+ addEvent(vehicleEvent);
+ } else if (item.eventData.type === "Conveyor") {
+ const ConveyorEvent: ConveyorEventSchema = {
+ modelUuid: item.modelUuid,
+ modelName: item.modelName,
+ position: item.position,
+ rotation: [item.rotation.x, item.rotation.y, item.rotation.z],
+ state: "idle",
+ type: "transfer",
+ speed: 1,
+ points: item.eventData.points?.map((point: any, index: number) => ({
+ uuid: point.uuid || THREE.MathUtils.generateUUID(),
+ position: [point.position[0], point.position[1], point.position[2]],
+ rotation: [point.rotation[0], point.rotation[1], point.rotation[2]],
+ action: {
+ actionUuid: THREE.MathUtils.generateUUID(),
+ actionName: `Action ${index + 1}`,
+ actionType: 'default',
+ material: 'Default material',
+ delay: 0,
+ spawnInterval: 5,
+ spawnCount: 1,
+ triggers: []
+ }
+ })) || [],
+ };
+ addEvent(ConveyorEvent);
+ } else if (item.eventData.type === "StaticMachine") {
+ const machineEvent: MachineEventSchema = {
+ modelUuid: item.modelUuid,
+ modelName: item.modelName,
+ position: item.position,
+ rotation: [item.rotation.x, item.rotation.y, item.rotation.z],
+ state: "idle",
+ type: "machine",
+ point: {
+ uuid: item.eventData.point?.uuid || THREE.MathUtils.generateUUID(),
+ position: [item.eventData.point?.position[0] || 0, item.eventData.point?.position[1] || 0, item.eventData.point?.position[2] || 0],
+ rotation: [item.eventData.point?.rotation[0] || 0, item.eventData.point?.rotation[1] || 0, item.eventData.point?.rotation[2] || 0],
+ action: {
+ actionUuid: THREE.MathUtils.generateUUID(),
+ actionName: "Process Action",
+ actionType: "process",
+ processTime: 10,
+ swapMaterial: "material-id",
+ triggers: []
+ }
+ }
+ };
+ addEvent(machineEvent);
+ } else if (item.eventData.type === "ArmBot") {
+ const roboticArmEvent: RoboticArmEventSchema = {
+ modelUuid: item.modelUuid,
+ modelName: item.modelName,
+ position: item.position,
+ rotation: [item.rotation.x, item.rotation.y, item.rotation.z],
+ state: "idle",
+ type: "roboticArm",
+ speed: 1,
+ point: {
+ uuid: item.eventData.point?.uuid || THREE.MathUtils.generateUUID(),
+ position: [item.eventData.point?.position[0] || 0, item.eventData.point?.position[1] || 0, item.eventData.point?.position[2] || 0],
+ rotation: [item.eventData.point?.rotation[0] || 0, item.eventData.point?.rotation[1] || 0, item.eventData.point?.rotation[2] || 0],
+ actions: [
+ {
+ actionUuid: THREE.MathUtils.generateUUID(),
+ actionName: "Pick and Place",
+ actionType: "pickAndPlace",
+ process: {
+ startPoint: [0, 0, 0],
+ endPoint: [0, 0, 0]
+ },
+ triggers: []
+ }
+ ]
+ }
+ };
+ addEvent(roboticArmEvent);
+
+ }
+ } else {
+ setFloorItems((prevItems) => [
+ ...(prevItems || []),
+ {
+ modelUuid: item.modelUuid,
+ modelName: item.modelName,
+ position: item.position,
+ rotation: item.rotation,
+ modelfileID: item.modelfileID,
+ isLocked: item.isLocked,
+ isVisible: item.isVisible,
+ },
+ ]);
}
gsap.to(model.position, { y: item.position[1], duration: 1.5, ease: 'power2.out' });
diff --git a/app/src/modules/builder/IntialLoad/loadInitialWallItems.ts b/app/src/modules/builder/IntialLoad/loadInitialWallItems.ts
index 34273af..f9799a8 100644
--- a/app/src/modules/builder/IntialLoad/loadInitialWallItems.ts
+++ b/app/src/modules/builder/IntialLoad/loadInitialWallItems.ts
@@ -22,9 +22,9 @@ async function loadInitialWallItems(
const loadedWallItems = await Promise.all(storedWallItems.map(async (item) => {
const loader = new GLTFLoader();
return new Promise((resolve) => {
- loader.load(AssetConfigurations[item.modelname!].modelUrl, (gltf) => {
+ loader.load(AssetConfigurations[item.modelName!].modelUrl, (gltf) => {
const model = gltf.scene;
- model.uuid = item.modeluuid!;
+ model.uuid = item.modelUuid!;
model.children[0].children.forEach((child: any) => {
if (child.name !== "CSG_REF") {
@@ -36,7 +36,7 @@ async function loadInitialWallItems(
resolve({
type: item.type,
model: model,
- modelname: item.modelname,
+ modelName: item.modelName,
scale: item.scale,
csgscale: item.csgscale,
csgposition: item.csgposition,
diff --git a/app/src/modules/builder/geomentries/assets/addAssetModel.ts b/app/src/modules/builder/geomentries/assets/addAssetModel.ts
index d7c278c..0bc7352 100644
--- a/app/src/modules/builder/geomentries/assets/addAssetModel.ts
+++ b/app/src/modules/builder/geomentries/assets/addAssetModel.ts
@@ -117,7 +117,7 @@ async function handleModelLoad(
socket: Socket
) {
const model = gltf.scene.clone();
- model.userData = { name: selectedItem.name, modelId: selectedItem.id, modeluuid: model.uuid };
+ model.userData = { name: selectedItem.name, modelId: selectedItem.id, modelUuid: model.uuid };
model.position.set(intersectPoint!.x, 3 + intersectPoint!.y, intersectPoint!.z);
model.scale.set(...CONSTANTS.assetConfig.defaultScaleBeforeGsap);
@@ -137,8 +137,8 @@ async function handleModelLoad(
}
const newFloorItem: Types.FloorItemType = {
- modeluuid: model.uuid,
- modelname: selectedItem.name,
+ modelUuid: model.uuid,
+ modelName: selectedItem.name,
modelfileID: selectedItem.id,
position: [intersectPoint!.x, intersectPoint!.y, intersectPoint!.z],
rotation: { x: model.rotation.x, y: model.rotation.y, z: model.rotation.z },
@@ -153,8 +153,8 @@ async function handleModelLoad(
// await setFloorItemApi(
// organization,
- // newFloorItem.modeluuid,
- // newFloorItem.modelname,
+ // newFloorItem.modelUuid,
+ // newFloorItem.modelName,
// newFloorItem.modelfileID,
// newFloorItem.position,
// { x: model.rotation.x, y: model.rotation.y, z: model.rotation.z },
@@ -164,18 +164,6 @@ async function handleModelLoad(
// SOCKET
- const data = {
- organization,
- modeluuid: newFloorItem.modeluuid,
- modelname: newFloorItem.modelname,
- modelfileID: newFloorItem.modelfileID,
- position: newFloorItem.position,
- rotation: { x: model.rotation.x, y: model.rotation.y, z: model.rotation.z },
- isLocked: false,
- isVisible: true,
- socketId: socket.id
- };
-
if (selectedItem.type) {
const data = PointsCalculator(
selectedItem.type,
@@ -185,10 +173,14 @@ async function handleModelLoad(
if (!data || !data.points) return;
+ const eventData: any = {
+ type: selectedItem.type,
+ };
+
if (selectedItem.type === "Conveyor") {
const ConveyorEvent: ConveyorEventSchema = {
- modelUuid: newFloorItem.modeluuid,
- modelName: newFloorItem.modelname,
+ modelUuid: newFloorItem.modelUuid,
+ modelName: newFloorItem.modelName,
position: newFloorItem.position,
rotation: [newFloorItem.rotation.x, newFloorItem.rotation.y, newFloorItem.rotation.z],
state: "idle",
@@ -209,12 +201,18 @@ async function handleModelLoad(
triggers: []
}
}))
- }
+ };
addEvent(ConveyorEvent);
+ eventData.points = ConveyorEvent.points.map(point => ({
+ uuid: point.uuid,
+ position: point.position,
+ rotation: point.rotation
+ }));
+
} else if (selectedItem.type === "Vehicle") {
const vehicleEvent: VehicleEventSchema = {
- modelUuid: newFloorItem.modeluuid,
- modelName: newFloorItem.modelname,
+ modelUuid: newFloorItem.modelUuid,
+ modelName: newFloorItem.modelName,
position: newFloorItem.position,
rotation: [newFloorItem.rotation.x, newFloorItem.rotation.y, newFloorItem.rotation.z],
state: "idle",
@@ -230,6 +228,7 @@ async function handleModelLoad(
actionType: "travel",
unLoadDuration: 5,
loadCapacity: 10,
+ steeringAngle:0,
pickUpPoint: null,
unLoadPoint: null,
triggers: []
@@ -237,10 +236,16 @@ async function handleModelLoad(
}
};
addEvent(vehicleEvent);
+ eventData.point = {
+ uuid: vehicleEvent.point.uuid,
+ position: vehicleEvent.point.position,
+ rotation: vehicleEvent.point.rotation
+ };
+
} else if (selectedItem.type === "ArmBot") {
const roboticArmEvent: RoboticArmEventSchema = {
- modelUuid: newFloorItem.modeluuid,
- modelName: newFloorItem.modelname,
+ modelUuid: newFloorItem.modelUuid,
+ modelName: newFloorItem.modelName,
position: newFloorItem.position,
rotation: [newFloorItem.rotation.x, newFloorItem.rotation.y, newFloorItem.rotation.z],
state: "idle",
@@ -265,10 +270,17 @@ async function handleModelLoad(
}
};
addEvent(roboticArmEvent);
+ console.log('roboticArmEvent: ', roboticArmEvent);
+ eventData.point = {
+ uuid: roboticArmEvent.point.uuid,
+ position: roboticArmEvent.point.position,
+ rotation: roboticArmEvent.point.rotation
+ };
+
} else if (selectedItem.type === "StaticMachine") {
const machineEvent: MachineEventSchema = {
- modelUuid: newFloorItem.modeluuid,
- modelName: newFloorItem.modelname,
+ modelUuid: newFloorItem.modelUuid,
+ modelName: newFloorItem.modelName,
position: newFloorItem.position,
rotation: [newFloorItem.rotation.x, newFloorItem.rotation.y, newFloorItem.rotation.z],
state: "idle",
@@ -288,19 +300,65 @@ async function handleModelLoad(
}
};
addEvent(machineEvent);
+ eventData.point = {
+ uuid: machineEvent.point.uuid,
+ position: machineEvent.point.position,
+ rotation: machineEvent.point.rotation
+ };
}
+
+ const completeData = {
+ organization,
+ modelUuid: newFloorItem.modelUuid,
+ modelName: newFloorItem.modelName,
+ modelfileID: newFloorItem.modelfileID,
+ position: newFloorItem.position,
+ rotation: { x: model.rotation.x, y: model.rotation.y, z: model.rotation.z },
+ isLocked: false,
+ isVisible: true,
+ socketId: socket.id,
+ eventData: eventData
+ };
+
+ model.userData.eventData = eventData;
+
+ newFloorItem.eventData = eventData;
+
+ setFloorItems((prevItems) => {
+ const updatedItems = [...(prevItems || []), newFloorItem];
+ localStorage.setItem("FloorItems", JSON.stringify(updatedItems));
+ return updatedItems;
+ });
+
+ socket.emit("v2:model-asset:add", completeData);
+
+ gsap.to(model.position, { y: newFloorItem.position[1], duration: 1.5, ease: "power2.out" });
+ gsap.to(model.scale, { x: 1, y: 1, z: 1, duration: 1.5, ease: "power2.out", onComplete: () => { toast.success("Model Added!"); } });
+ } else {
+
+ const data = {
+ organization,
+ modelUuid: newFloorItem.modelUuid,
+ modelName: newFloorItem.modelName,
+ modelfileID: newFloorItem.modelfileID,
+ position: newFloorItem.position,
+ rotation: { x: model.rotation.x, y: model.rotation.y, z: model.rotation.z },
+ isLocked: false,
+ isVisible: true,
+ socketId: socket.id
+ };
+
+ setFloorItems((prevItems) => {
+ const updatedItems = [...(prevItems || []), newFloorItem];
+ localStorage.setItem("FloorItems", JSON.stringify(updatedItems));
+ return updatedItems;
+ });
+
+ socket.emit("v2:model-asset:add", data);
+
+ gsap.to(model.position, { y: newFloorItem.position[1], duration: 1.5, ease: "power2.out" });
+ gsap.to(model.scale, { x: 1, y: 1, z: 1, duration: 1.5, ease: "power2.out", onComplete: () => { toast.success("Model Added!"); } });
}
-
- setFloorItems((prevItems) => {
- const updatedItems = [...(prevItems || []), newFloorItem];
- localStorage.setItem("FloorItems", JSON.stringify(updatedItems));
- return updatedItems;
- });
-
- socket.emit("v2:model-asset:add", data);
-
- gsap.to(model.position, { y: newFloorItem.position[1], duration: 1.5, ease: "power2.out" });
- gsap.to(model.scale, { x: 1, y: 1, z: 1, duration: 1.5, ease: "power2.out", onComplete: () => { toast.success("Model Added!"); } });
}
export default addAssetModel;
diff --git a/app/src/modules/builder/geomentries/assets/assetManager.ts b/app/src/modules/builder/geomentries/assets/assetManager.ts
index 5ff75a3..5f7798e 100644
--- a/app/src/modules/builder/geomentries/assets/assetManager.ts
+++ b/app/src/modules/builder/geomentries/assets/assetManager.ts
@@ -58,7 +58,7 @@ export default async function assetManager(
// Check Three.js Cache
const cachedModel = THREE.Cache.get(item.modelfileID!);
if (cachedModel) {
- // console.log(`[Cache] Fetching ${item.modelname}`);
+ // console.log(`[Cache] Fetching ${item.modelName}`);
processLoadedModel(cachedModel.scene.clone(), item, itemsGroup, resolve);
return;
}
@@ -66,7 +66,7 @@ export default async function assetManager(
// Check IndexedDB
const indexedDBModel = await retrieveGLTF(item.modelfileID!);
if (indexedDBModel) {
- // console.log(`[IndexedDB] Fetching ${item.modelname}`);
+ // console.log(`[IndexedDB] Fetching ${item.modelName}`);
const blobUrl = URL.createObjectURL(indexedDBModel);
loader.load(
blobUrl,
@@ -78,7 +78,7 @@ export default async function assetManager(
},
undefined,
(error) => {
- toast.error(`[IndexedDB] Error loading ${item.modelname}:`);
+ toast.error(`[IndexedDB] Error loading ${item.modelName}:`);
resolve();
}
);
@@ -86,7 +86,7 @@ export default async function assetManager(
}
// Fetch from Backend
- // console.log(`[Backend] Fetching ${item.modelname}`);
+ // console.log(`[Backend] Fetching ${item.modelName}`);
loader.load(
modelUrl,
async (gltf) => {
@@ -97,7 +97,7 @@ export default async function assetManager(
},
undefined,
(error) => {
- toast.error(`[Backend] Error loading ${item.modelname}:`);
+ toast.error(`[Backend] Error loading ${item.modelName}:`);
resolve();
}
);
@@ -112,16 +112,16 @@ export default async function assetManager(
) {
if (!activePromises.get(taskId)) return; // Stop processing if task is canceled
- const existingModel = itemsGroup?.current?.getObjectByProperty("uuid", item.modeluuid);
+ const existingModel = itemsGroup?.current?.getObjectByProperty("uuid", item.modelUuid);
if (existingModel) {
- // console.log(`Model ${item.modelname} already exists in the scene.`);
+ // console.log(`Model ${item.modelName} already exists in the scene.`);
resolve();
return;
}
const model = gltf;
- model.uuid = item.modeluuid;
- model.userData = { name: item.modelname, modelId: item.modelfileID, modeluuid: item.modeluuid };
+ model.uuid = item.modelUuid;
+ model.userData = { name: item.modelName, modelId: item.modelfileID, modelUuid: item.modelUuid };
model.scale.set(...CONSTANTS.assetConfig.defaultScaleBeforeGsap);
model.position.set(...item.position);
model.rotation.set(item.rotation.x, item.rotation.y, item.rotation.z);
diff --git a/app/src/modules/builder/geomentries/assets/deleteFloorItems.ts b/app/src/modules/builder/geomentries/assets/deleteFloorItems.ts
index 18136b3..f13ebee 100644
--- a/app/src/modules/builder/geomentries/assets/deleteFloorItems.ts
+++ b/app/src/modules/builder/geomentries/assets/deleteFloorItems.ts
@@ -5,6 +5,8 @@ import * as Types from "../../../../types/world/worldTypes";
// import { deleteFloorItem } from '../../../../services/factoryBuilder/assest/floorAsset/deleteFloorItemApi';
import { Socket } from 'socket.io-client';
import { getFloorAssets } from '../../../../services/factoryBuilder/assest/floorAsset/getFloorItemsApi';
+import { useEventsStore } from "../../../../store/simulation/useEventsStore";
+import { useProductStore } from "../../../../store/simulation/useProductStore";
async function DeleteFloorItems(
itemsGroup: Types.RefGroup,
@@ -22,7 +24,7 @@ async function DeleteFloorItems(
const items = await getFloorAssets(organization);
const removedItem = items.find(
- (item: { modeluuid: string }) => item.modeluuid === hoveredDeletableFloorItem.current?.uuid
+ (item: { modelUuid: string }) => item.modelUuid === hoveredDeletableFloorItem.current?.uuid
);
if (!removedItem) {
@@ -31,26 +33,29 @@ async function DeleteFloorItems(
//REST
- // const response = await deleteFloorItem(organization, removedItem.modeluuid, removedItem.modelname);
+ // const response = await deleteFloorItem(organization, removedItem.modelUuid, removedItem.modelName);
//SOCKET
const data = {
organization: organization,
- modeluuid: removedItem.modeluuid,
- modelname: removedItem.modelname,
+ modelUuid: removedItem.modelUuid,
+ modelName: removedItem.modelName,
socketId: socket.id
}
const response = socket.emit('v2:model-asset:delete', data)
+ useEventsStore.getState().removeEvent(removedItem.modelUuid);
+ useProductStore.getState().deleteEvent(removedItem.modelUuid);
+
if (response) {
const updatedItems = items.filter(
- (item: { modeluuid: string }) => item.modeluuid !== hoveredDeletableFloorItem.current?.uuid
+ (item: { modelUuid: string }) => item.modelUuid !== hoveredDeletableFloorItem.current?.uuid
);
const storedItems = JSON.parse(localStorage.getItem("FloorItems") || '[]');
- const updatedStoredItems = storedItems.filter((item: { modeluuid: string }) => item.modeluuid !== hoveredDeletableFloorItem.current?.uuid);
+ const updatedStoredItems = storedItems.filter((item: { modelUuid: string }) => item.modelUuid !== hoveredDeletableFloorItem.current?.uuid);
localStorage.setItem("FloorItems", JSON.stringify(updatedStoredItems));
if (hoveredDeletableFloorItem.current) {
diff --git a/app/src/modules/builder/geomentries/walls/addWallItems.ts b/app/src/modules/builder/geomentries/walls/addWallItems.ts
index 9c578aa..fd9eb48 100644
--- a/app/src/modules/builder/geomentries/walls/addWallItems.ts
+++ b/app/src/modules/builder/geomentries/walls/addWallItems.ts
@@ -43,7 +43,7 @@ async function AddWallItems(
const newWallItem = {
type: config.type,
model: model,
- modelname: selected,
+ modelName: selected,
scale: config.scale,
csgscale: config.csgscale,
csgposition: config.csgposition,
@@ -59,7 +59,7 @@ async function AddWallItems(
// await setWallItem(
// organization,
// model.uuid,
- // newWallItem.modelname,
+ // newWallItem.modelName,
// newWallItem.type!,
// newWallItem.csgposition!,
// newWallItem.csgscale!,
@@ -72,8 +72,8 @@ async function AddWallItems(
const data = {
organization: organization,
- modeluuid: model.uuid,
- modelname: newWallItem.modelname,
+ modelUuid: model.uuid,
+ modelName: newWallItem.modelName,
type: newWallItem.type!,
csgposition: newWallItem.csgposition!,
csgscale: newWallItem.csgscale!,
@@ -92,7 +92,7 @@ async function AddWallItems(
const { model, ...rest } = item;
return {
...rest,
- modeluuid: model?.uuid,
+ modelUuid: model?.uuid,
};
});
diff --git a/app/src/modules/builder/geomentries/walls/deleteWallItems.ts b/app/src/modules/builder/geomentries/walls/deleteWallItems.ts
index abbf0c8..b5d40f4 100644
--- a/app/src/modules/builder/geomentries/walls/deleteWallItems.ts
+++ b/app/src/modules/builder/geomentries/walls/deleteWallItems.ts
@@ -28,14 +28,14 @@ function DeleteWallItems(
//REST
- // await deleteWallItem(organization, removedItem?.model?.uuid!, removedItem?.modelname!)
+ // await deleteWallItem(organization, removedItem?.model?.uuid!, removedItem?.modelName!)
//SOCKET
const data = {
organization: organization,
- modeluuid: removedItem?.model?.uuid!,
- modelname: removedItem?.modelname!,
+ modelUuid: removedItem?.model?.uuid!,
+ modelName: removedItem?.modelName!,
socketId: socket.id
}
@@ -45,7 +45,7 @@ function DeleteWallItems(
const { model, ...rest } = item;
return {
...rest,
- modeluuid: model?.uuid,
+ modelUuid: model?.uuid,
};
});
diff --git a/app/src/modules/builder/groups/wallItemsGroup.tsx b/app/src/modules/builder/groups/wallItemsGroup.tsx
index 43845e7..f993754 100644
--- a/app/src/modules/builder/groups/wallItemsGroup.tsx
+++ b/app/src/modules/builder/groups/wallItemsGroup.tsx
@@ -91,7 +91,7 @@ const WallItemsGroup = ({ currentWallItem, AssetConfigurations, hoveredDeletable
const { model, ...rest } = item;
return {
...rest,
- modeluuid: model?.uuid,
+ modelUuid: model?.uuid,
};
});
@@ -110,7 +110,7 @@ const WallItemsGroup = ({ currentWallItem, AssetConfigurations, hoveredDeletable
// await setWallItem(
// organization,
// currentItem?.model?.uuid,
- // currentItem.modelname,
+ // currentItem.modelName,
// currentItem.type!,
// currentItem.csgposition!,
// currentItem.csgscale!,
@@ -123,8 +123,8 @@ const WallItemsGroup = ({ currentWallItem, AssetConfigurations, hoveredDeletable
const data = {
organization: organization,
- modeluuid: currentItem.model?.uuid!,
- modelname: currentItem.modelname!,
+ modelUuid: currentItem.model?.uuid!,
+ modelName: currentItem.modelName!,
type: currentItem.type!,
csgposition: currentItem.csgposition!,
csgscale: currentItem.csgscale!,
diff --git a/app/src/modules/builder/groups/zoneGroup.tsx b/app/src/modules/builder/groups/zoneGroup.tsx
index d218534..1eadd24 100644
--- a/app/src/modules/builder/groups/zoneGroup.tsx
+++ b/app/src/modules/builder/groups/zoneGroup.tsx
@@ -69,7 +69,9 @@ const ZoneGroup: React.FC = () => {
},
transparent: true,
depthWrite: false,
- }), []);
+ }),
+ []
+ );
useEffect(() => {
const fetchZones = async () => {
@@ -148,6 +150,7 @@ const ZoneGroup: React.FC = () => {
}
}, [toolMode, toggleView]);
+ // eslint-disable-next-line react-hooks/exhaustive-deps
const addZoneToBackend = async (zone: {
zoneId: string;
zoneName: string;
@@ -503,6 +506,15 @@ const ZoneGroup: React.FC = () => {
draggedSphere,
movePoint,
activeLayer,
+ raycaster,
+ pointer,
+ controls,
+ plane,
+ setZones,
+ setZonePoints,
+ addZoneToBackend,
+ handleDeleteZone,
+ updateZoneToBackend,
]);
useFrame(() => {
@@ -551,6 +563,7 @@ const ZoneGroup: React.FC = () => {
key={index}
position={midpoint}
rotation={[0, -angle, 0]}
+ visible={false}
>
{
const navigate = useNavigate();
@@ -20,13 +20,14 @@ const CamModelsGroup = () => {
const { socket } = useSocketStore();
const { activeModule } = useModuleStore();
+ // eslint-disable-next-line react-hooks/exhaustive-deps
const loader = new GLTFLoader();
const dracoLoader = new DRACOLoader();
dracoLoader.setDecoderPath("three/examples/jsm/libs/draco/gltf/");
loader.setDRACOLoader(dracoLoader);
const [cams, setCams] = useState([]);
- const [models, setModels] = useState>({});
+ const [models, setModels] = useState>({});
const dedupeCams = (cams: any[]) => {
const seen = new Set();
@@ -102,6 +103,7 @@ const CamModelsGroup = () => {
});
socket.on("cameraUpdateResponse", (data: any) => {
+
if (
!groupRef.current ||
socket.id === data.socketId ||
@@ -122,6 +124,11 @@ const CamModelsGroup = () => {
data.data.rotation.y,
data.data.rotation.z
),
+ target: new THREE.Vector3(
+ data.data.target.x,
+ data.data.target.y,
+ data.data.target.z
+ ),
},
}));
});
@@ -131,7 +138,7 @@ const CamModelsGroup = () => {
socket.off("userDisConnectResponse");
socket.off("cameraUpdateResponse");
};
- }, [socket]);
+ }, [email, loader, navigate, setActiveUsers, socket]);
useFrame(() => {
if (!groupRef.current) return;
@@ -217,9 +224,11 @@ const CamModelsGroup = () => {
position={[-0.015, 0, 0.7]}
>