From 13732a5679ec2704bf394118d6b884a04c489e01 Mon Sep 17 00:00:00 2001 From: Jerald-Golden-B Date: Sat, 29 Mar 2025 12:58:54 +0530 Subject: [PATCH] added ui and integerated ui for the vehicle mechanics --- .../layout/sidebarRight/SideBarRight.tsx | 2 +- .../mechanics/ConveyorMechanics.tsx | 33 +- .../mechanics/VehicleMechanics.tsx | 590 +++--------------- app/src/components/ui/Tools.tsx | 3 + app/src/components/ui/inputs/EyeDropInput.tsx | 32 +- app/src/modules/builder/functions/draw.ts | 2 +- .../modules/scene/tools/measurementTool.tsx | 4 +- app/src/modules/scene/world/world.tsx | 7 +- .../simulation/behaviour/behaviour.tsx | 5 +- .../simulationtemp/path/pathCreator.tsx | 3 + app/src/store/store.ts | 14 + app/src/types/world/worldTypes.d.ts | 5 +- 12 files changed, 156 insertions(+), 544 deletions(-) diff --git a/app/src/components/layout/sidebarRight/SideBarRight.tsx b/app/src/components/layout/sidebarRight/SideBarRight.tsx index 3ba5595..f2f6695 100644 --- a/app/src/components/layout/sidebarRight/SideBarRight.tsx +++ b/app/src/components/layout/sidebarRight/SideBarRight.tsx @@ -109,7 +109,7 @@ const SideBarRight: React.FC = () => { {subModule === "mechanics" && selectedActionSphere && selectedActionSphere.path.type === "Vehicle" && (
- {/* */} +
)} diff --git a/app/src/components/layout/sidebarRight/mechanics/ConveyorMechanics.tsx b/app/src/components/layout/sidebarRight/mechanics/ConveyorMechanics.tsx index 2788c12..23b566b 100644 --- a/app/src/components/layout/sidebarRight/mechanics/ConveyorMechanics.tsx +++ b/app/src/components/layout/sidebarRight/mechanics/ConveyorMechanics.tsx @@ -8,9 +8,7 @@ import { import RenameInput from "../../../ui/inputs/RenameInput"; import InputWithDropDown from "../../../ui/inputs/InputWithDropDown"; import LabledDropdown from "../../../ui/inputs/LabledDropdown"; -import RegularDropDown from "../../../ui/inputs/RegularDropDown"; import { handleResize } from "../../../../functions/handleResizePannel"; -import EyeDropInput from "../../../ui/inputs/EyeDropInput"; import { useSelectedActionSphere, useSelectedPath, useSimulationPaths } from "../../../../store/store"; import * as THREE from 'three'; import * as Types from '../../../../types/world/worldTypes'; @@ -428,9 +426,18 @@ const ConveyorMechanics: React.FC = () => { return (
-
- {selectedActionSphere?.path?.modelName || "point name not found"} -
+ {!selectedPath && +
+ {selectedActionSphere?.path?.modelName || "point name not found"} +
+ } + + {selectedPath && + +
+ {selectedPath.path.modelName || "path name not found"} +
+ }
{!selectedPath && @@ -632,10 +639,18 @@ const ConveyorMechanics: React.FC = () => {
)}
-
- - By selecting points, you can create events and triggers. -
+ {!selectedPath && ( +
+ + Configure the point's action and trigger properties. +
+ )} + {selectedPath && ( +
+ + Configure the path properties. +
+ )} ); diff --git a/app/src/components/layout/sidebarRight/mechanics/VehicleMechanics.tsx b/app/src/components/layout/sidebarRight/mechanics/VehicleMechanics.tsx index de6eb8c..42ad965 100644 --- a/app/src/components/layout/sidebarRight/mechanics/VehicleMechanics.tsx +++ b/app/src/components/layout/sidebarRight/mechanics/VehicleMechanics.tsx @@ -1,562 +1,128 @@ -import React, { useRef, useState, useMemo, useEffect } from "react"; -import { - AddIcon, - InfoIcon, - RemoveIcon, - ResizeHeightIcon, -} from "../../../icons/ExportCommonIcons"; -import RenameInput from "../../../ui/inputs/RenameInput"; +import React, { useRef, useMemo } from "react"; +import { InfoIcon } from "../../../icons/ExportCommonIcons"; import InputWithDropDown from "../../../ui/inputs/InputWithDropDown"; -import LabledDropdown from "../../../ui/inputs/LabledDropdown"; -import RegularDropDown from "../../../ui/inputs/RegularDropDown"; -import { handleResize } from "../../../../functions/handleResizePannel"; import EyeDropInput from "../../../ui/inputs/EyeDropInput"; -import { useSelectedActionSphere, useSelectedPath, useSimulationPaths } from "../../../../store/store"; -import * as THREE from 'three'; +import { useSelectedActionSphere, useSimulationPaths } from "../../../../store/store"; import * as Types from '../../../../types/world/worldTypes'; -import InputToggle from "../../../ui/inputs/InputToggle"; const VehicleMechanics: React.FC = () => { const { selectedActionSphere } = useSelectedActionSphere(); - const { selectedPath, setSelectedPath } = useSelectedPath(); const { simulationPaths, setSimulationPaths } = useSimulationPaths(); - const actionsContainerRef = useRef(null); - const triggersContainerRef = useRef(null); + const propertiesContainerRef = useRef(null); const selectedPoint = useMemo(() => { - if (!selectedActionSphere) return null; - return simulationPaths - .filter((path): path is Types.ConveyorEventsSchema => path.type === "Conveyor") - .flatMap((path) => path.points) - .find((point) => point.uuid === selectedActionSphere.point.uuid); - }, [selectedActionSphere, simulationPaths]); + if (!selectedActionSphere?.point?.uuid) return null; - const handleAddAction = () => { - if (!selectedActionSphere) return; + const vehiclePaths = simulationPaths.filter( + (path): path is Types.VehicleEventsSchema => path.type === "Vehicle" + ); + + return vehiclePaths.find( + (path) => path.point.uuid === selectedActionSphere.point.uuid + )?.point; + }, [selectedActionSphere, simulationPaths, selectedActionSphere?.point?.uuid]); + + const handleActionUpdate = React.useCallback((updatedAction: Partial) => { + if (!selectedActionSphere?.point?.uuid) return; const updatedPaths = simulationPaths.map((path) => { - if (path.type === "Conveyor") { + if (path.type === "Vehicle" && path.point.uuid === selectedActionSphere.point.uuid) { return { ...path, - points: path.points.map((point) => { - if (point.uuid === selectedActionSphere.point.uuid) { - const actionIndex = point.actions.length; - const newAction = { - uuid: THREE.MathUtils.generateUUID(), - name: `Action ${actionIndex + 1}`, - type: 'Inherit', - material: 'Inherit', - delay: 'Inherit', - spawnInterval: 'Inherit', - isUsed: false - }; - - return { ...point, actions: [...point.actions, newAction] }; + point: { + ...path.point, + actions: { + ...path.point.actions, + ...updatedAction } - return point; - }), + } }; } return path; }); setSimulationPaths(updatedPaths); - }; + }, [selectedActionSphere?.point?.uuid, simulationPaths, setSimulationPaths]); - const handleDeleteAction = (uuid: string) => { - if (!selectedActionSphere) return; + const handleStartPositionChange = React.useCallback((position: string) => { + handleActionUpdate({ start: position }); + }, [handleActionUpdate]); - const updatedPaths = simulationPaths.map((path) => - path.type === "Conveyor" - ? { - ...path, - points: path.points.map((point) => - point.uuid === selectedActionSphere.point.uuid - ? { ...point, actions: point.actions.filter(action => action.uuid !== uuid) } - : point - ), - } - : path - ); + const handleEndPositionChange = React.useCallback((position: string) => { + handleActionUpdate({ end: position }); + }, [handleActionUpdate]); - setSimulationPaths(updatedPaths); - }; + const handleHitCountChange = React.useCallback((hitCount: number) => { + handleActionUpdate({ hitCount }); + }, [handleActionUpdate]); - const handleActionSelect = (uuid: string, actionType: string) => { - if (!selectedActionSphere) return; + const handleBufferChange = React.useCallback((buffer: number) => { + handleActionUpdate({ buffer }); + }, [handleActionUpdate]); - const updatedPaths = simulationPaths.map((path) => - path.type === "Conveyor" - ? { - ...path, - points: path.points.map((point) => - point.uuid === selectedActionSphere.point.uuid - ? { - ...point, - actions: point.actions.map((action) => - action.uuid === uuid - ? { - ...action, - type: actionType, - material: actionType === 'Spawn' || actionType === 'Swap' ? 'Inherit' : action.material, - delay: actionType === 'Delay' ? 'Inherit' : action.delay, - spawnInterval: actionType === 'Spawn' ? 'Inherit' : action.spawnInterval - } - : action - ), - } - : point - ), - } - : path - ); - - setSimulationPaths(updatedPaths); - - // Update the selected item to reflect changes - if (selectedItem?.type === "action" && selectedItem.item.uuid === uuid) { - const updatedAction = updatedPaths - .filter((path): path is Types.ConveyorEventsSchema => path.type === "Conveyor") - .flatMap(path => path.points) - .find(p => p.uuid === selectedActionSphere.point.uuid) - ?.actions.find(a => a.uuid === uuid); - - if (updatedAction) { - setSelectedItem({ - type: "action", - item: updatedAction - }); - } - } - }; - - // Modified handleMaterialSelect to ensure it only applies to relevant action types - const handleMaterialSelect = (uuid: string, material: string) => { - if (!selectedActionSphere) return; - - const updatedPaths = simulationPaths.map((path) => - path.type === "Conveyor" - ? { - ...path, - points: path.points.map((point) => - point.uuid === selectedActionSphere.point.uuid - ? { - ...point, - actions: point.actions.map((action) => - action.uuid === uuid && - (action.type === 'Spawn' || action.type === 'Swap') - ? { ...action, material } - : action - ), - } - : point - ), - } - : path - ); - - setSimulationPaths(updatedPaths); - - // Update selected item if it's the current action - if (selectedItem?.type === "action" && selectedItem.item.uuid === uuid) { - setSelectedItem({ - ...selectedItem, - item: { - ...selectedItem.item, - material - } - }); - } - }; - - const handleDelayChange = (uuid: string, delay: number | string) => { - if (!selectedActionSphere) return; - - const updatedPaths = simulationPaths.map((path) => - path.type === "Conveyor" - ? { - ...path, - points: path.points.map((point) => - point.uuid === selectedActionSphere.point.uuid - ? { - ...point, - actions: point.actions.map((action) => - action.uuid === uuid ? { ...action, delay } : action - ), - } - : point - ), - } - : path - ); - - setSimulationPaths(updatedPaths); - }; - - const handleSpawnIntervalChange = (uuid: string, spawnInterval: number | string) => { - if (!selectedActionSphere) return; - - const updatedPaths = simulationPaths.map((path) => - path.type === "Conveyor" - ? { - ...path, - points: path.points.map((point) => - point.uuid === selectedActionSphere.point.uuid - ? { - ...point, - actions: point.actions.map((action) => - action.uuid === uuid ? { ...action, spawnInterval } : action - ), - } - : point - ), - } - : path - ); - - setSimulationPaths(updatedPaths); - }; - - const handleSpeedChange = (speed: number) => { - if (!selectedPath) return; - - const updatedPaths = simulationPaths.map((path) => - path.modeluuid === selectedPath.path.modeluuid ? { ...path, speed } : path - ); - - setSimulationPaths(updatedPaths); - setSelectedPath({ ...selectedPath, path: { ...selectedPath.path, speed } }); - }; - - const handleAddTrigger = () => { - if (!selectedActionSphere) return; - - const updatedPaths = simulationPaths.map((path) => - path.type === "Conveyor" - ? { - ...path, - points: path.points.map((point) => { - if (point.uuid === selectedActionSphere.point.uuid) { - const triggerIndex = point.triggers.length; - const newTrigger = { - uuid: THREE.MathUtils.generateUUID(), - name: `Trigger ${triggerIndex + 1}`, - type: '', - bufferTime: 0, - isUsed: false - }; - - return { ...point, triggers: [...point.triggers, newTrigger] }; - } - return point; - }), - } - : path - ); - - setSimulationPaths(updatedPaths); - }; - - const handleDeleteTrigger = (uuid: string) => { - if (!selectedActionSphere) return; - - const updatedPaths = simulationPaths.map((path) => - path.type === "Conveyor" - ? { - ...path, - points: path.points.map((point) => - point.uuid === selectedActionSphere.point.uuid - ? { ...point, triggers: point.triggers.filter(trigger => trigger.uuid !== uuid) } - : point - ), - } - : path - ); - - setSimulationPaths(updatedPaths); - }; - - const handleTriggerSelect = (uuid: string, triggerType: string) => { - if (!selectedActionSphere) return; - - const updatedPaths = simulationPaths.map((path) => - path.type === "Conveyor" - ? { - ...path, - points: path.points.map((point) => - point.uuid === selectedActionSphere.point.uuid - ? { - ...point, - triggers: point.triggers.map((trigger) => - trigger.uuid === uuid ? { ...trigger, type: triggerType } : trigger - ), - } - : point - ), - } - : path - ); - - setSimulationPaths(updatedPaths); - }; - - // Update the toggle handlers to immediately update the selected item - const handleActionToggle = (uuid: string) => { - if (!selectedActionSphere) return; - const updatedPaths = simulationPaths.map((path) => - path.type === "Conveyor" - ? { - ...path, - points: path.points.map((point) => - point.uuid === selectedActionSphere.point.uuid - ? { - ...point, - actions: point.actions.map((action) => ({ - ...action, - isUsed: action.uuid === uuid ? !action.isUsed : false, - })), - } - : point - ), - } - : path - ); - - setSimulationPaths(updatedPaths); - - // Immediately update the selected item if it's the one being toggled - if (selectedItem?.type === "action" && selectedItem.item.uuid === uuid) { - setSelectedItem({ - ...selectedItem, - item: { - ...selectedItem.item, - isUsed: !selectedItem.item.isUsed - } - }); - } - }; - - // Do the same for trigger toggle - const handleTriggerToggle = (uuid: string) => { - if (!selectedActionSphere) return; - - const updatedPaths = simulationPaths.map((path) => - path.type === "Conveyor" - ? { - ...path, - points: path.points.map((point) => - point.uuid === selectedActionSphere.point.uuid - ? { - ...point, - triggers: point.triggers.map((trigger) => ({ - ...trigger, - isUsed: trigger.uuid === uuid ? !trigger.isUsed : false, - })), - } - : point - ), - } - : path - ); - - setSimulationPaths(updatedPaths); - - // Immediately update the selected item if it's the one being toggled - if (selectedItem?.type === "trigger" && selectedItem.item.uuid === uuid) { - setSelectedItem({ - ...selectedItem, - item: { - ...selectedItem.item, - isUsed: !selectedItem.item.isUsed - } - }); - } - }; - - const [selectedItem, setSelectedItem] = useState<{ type: "action" | "trigger"; item: any; } | null>(null); - - useEffect(() => { - setSelectedItem(null); // Reset selectedItem when selectedActionSphere changes - }, [selectedActionSphere]); + const handleSpeedChange = React.useCallback((speed: number) => { + + }, [selectedActionSphere?.point?.uuid, simulationPaths, setSimulationPaths]); return ( -
+
- {selectedActionSphere?.path?.modelName || "point name not found"} + {selectedActionSphere?.path?.modelName || "Vehicle point not found"}
-
-
-
Actions
-
- Add -
-
-
-
- <> - {console.log(selectedPoint)} - -
-
handleResize(e, actionsContainerRef)} - > - -
-
-
-
-
-
Triggers
-
- Add -
-
-
-
- {selectedPoint?.triggers.map((trigger) => ( -
-
setSelectedItem({ type: "trigger", item: trigger })} - > - -
-
handleDeleteTrigger(trigger.uuid)} - > - -
-
- ))} -
-
handleResize(e, triggersContainerRef)} - > - -
-
-
-
- {selectedItem && ( +
+
Vehicle Properties
+ + {selectedPoint && ( <> -
{selectedItem.item.name}
+ - {selectedItem.type === "action" && ( - <> - handleActionToggle(selectedItem.item.uuid)} - /> - handleActionSelect(selectedItem.item.uuid, option)} - /> + - {/* Only show material dropdown for Spawn/Swap actions */} - {(selectedItem.item.type === 'Spawn' || selectedItem.item.type === 'Swap') && ( - handleMaterialSelect(selectedItem.item.uuid, option)} - /> - )} + handleHitCountChange(parseInt(value))} + /> - {/* Only show delay input for Delay actions */} - {selectedItem.item.type === 'Delay' && ( - { - const numValue = parseInt(value); - handleDelayChange( - selectedItem.item.uuid, - !value ? 'Inherit' : numValue - ); - }} - /> - )} + handleBufferChange(parseInt(value))} + /> - {/* Only show spawn interval for Spawn actions */} - {selectedItem.item.type === 'Spawn' && ( - { - handleSpawnIntervalChange(selectedItem.item.uuid, (value === "") ? "Inherit" : parseInt(value)); - }} - /> - - )} - - )} - - {selectedItem.type === "trigger" && ( - <> - handleTriggerToggle(selectedItem.item.uuid)} - /> - - handleTriggerSelect(selectedItem.item.uuid, option)} - /> - - )} + handleSpeedChange(parseFloat(value))} + /> )} - {selectedPath && !selectedItem && ( -
- handleSpeedChange(parseFloat(value))} - /> -
- )}
+
- By selecting points, you can create events and triggers. + Configure vehicle's movement and interaction properties.
); }; -export default VehicleMechanics; \ No newline at end of file +export default React.memo(VehicleMechanics); \ No newline at end of file diff --git a/app/src/components/ui/Tools.tsx b/app/src/components/ui/Tools.tsx index 1f5438d..3e605a8 100644 --- a/app/src/components/ui/Tools.tsx +++ b/app/src/components/ui/Tools.tsx @@ -23,6 +23,7 @@ import { useDeleteModels, useDeletePointOrLine, useMovePoint, + useRefTextUpdate, useSelectedWallItem, useToggleView, useToolMode, @@ -53,6 +54,7 @@ const Tools: React.FC = () => { const { movePoint, setMovePoint } = useMovePoint(); const { toolMode, setToolMode } = useToolMode(); const { activeTool, setActiveTool } = useActiveTool(); + const { refTextupdate, setRefTextUpdate } = useRefTextUpdate(); // Reset activeTool whenever activeModule changes useEffect(() => { @@ -103,6 +105,7 @@ const Tools: React.FC = () => { setTransformMode(null); setMovePoint(false); setDeletePointOrLine(false); + setRefTextUpdate((prevUpdate) => prevUpdate - 1); switch (activeTool) { case "Move": diff --git a/app/src/components/ui/inputs/EyeDropInput.tsx b/app/src/components/ui/inputs/EyeDropInput.tsx index 2823392..d29613a 100644 --- a/app/src/components/ui/inputs/EyeDropInput.tsx +++ b/app/src/components/ui/inputs/EyeDropInput.tsx @@ -1,18 +1,30 @@ import React from "react"; -import RegularDropDown from "./RegularDropDown"; import { EyeDroperIcon } from "../../icons/ExportCommonIcons"; -const EyeDropInput: React.FC = () => { +interface EyeDropInputProps { + label: string; + value: string; + onChange: (value: string) => void; + options?: string[]; +} + +const EyeDropInput: React.FC = ({ + label = "Object", + onChange, +}) => { + const handleEyeDropClick = () => { + // Here you would typically implement the eye dropper functionality + // For now, we'll just simulate selecting a value + const simulatedValue = "picked_value"; // Replace with actual eye dropper logic + onChange(simulatedValue); + }; + return (
-
Object
+
{label}
- {}} - /> -
+ +
@@ -20,4 +32,4 @@ const EyeDropInput: React.FC = () => { ); }; -export default EyeDropInput; +export default EyeDropInput; \ No newline at end of file diff --git a/app/src/modules/builder/functions/draw.ts b/app/src/modules/builder/functions/draw.ts index fc4dafa..0172707 100644 --- a/app/src/modules/builder/functions/draw.ts +++ b/app/src/modules/builder/functions/draw.ts @@ -17,7 +17,7 @@ async function Draw( floorPlanGroup: Types.RefGroup, ReferenceLineMesh: Types.RefMesh, LineCreated: Types.RefBoolean, - setRefTextUpdate: Types.NumberIncrementState, + setRefTextUpdate: any, Tube: Types.RefTubeGeometry, anglesnappedPoint: Types.RefVector3, isAngleSnapped: Types.RefBoolean, diff --git a/app/src/modules/scene/tools/measurementTool.tsx b/app/src/modules/scene/tools/measurementTool.tsx index 3c56a21..f8054af 100644 --- a/app/src/modules/scene/tools/measurementTool.tsx +++ b/app/src/modules/scene/tools/measurementTool.tsx @@ -36,7 +36,7 @@ const MeasurementTool = () => { isLeftMouseDown = false; if (evt.button === 0 && !drag) { raycaster.setFromCamera(pointer, camera); - const intersects = raycaster.intersectObjects(scene.children, true).filter(intersect => !intersect.object.name.includes("Roof") && !intersect.object.name.includes("MeasurementReference") && !(intersect.object.type === "GridHelper")); + const intersects = raycaster.intersectObjects(scene.children, true).filter(intersect => !intersect.object.name.includes("Roof") && !intersect.object.name.includes("MeasurementReference") && !intersect.object.name.includes("agv-collider") && !(intersect.object.type === "GridHelper")); if (intersects.length > 0) { const intersectionPoint = intersects[0].point.clone(); @@ -83,7 +83,7 @@ const MeasurementTool = () => { useFrame(() => { if (points.length === 1) { raycaster.setFromCamera(pointer, camera); - const intersects = raycaster.intersectObjects(scene.children, true).filter(intersect => !intersect.object.name.includes("Roof") && !intersect.object.name.includes("MeasurementReference") && !(intersect.object.type === "GridHelper")); + const intersects = raycaster.intersectObjects(scene.children, true).filter(intersect => !intersect.object.name.includes("Roof") && !intersect.object.name.includes("MeasurementReference") && !intersect.object.name.includes("agv-collider") && !(intersect.object.type === "GridHelper")); if (intersects.length > 0) { updateMeasurement(points[0], intersects[0].point); diff --git a/app/src/modules/scene/world/world.tsx b/app/src/modules/scene/world/world.tsx index 16b4b53..eb7d555 100644 --- a/app/src/modules/scene/world/world.tsx +++ b/app/src/modules/scene/world/world.tsx @@ -29,6 +29,7 @@ import { useUpdateScene, useWalls, useToolMode, + useRefTextUpdate, } from "../../../store/store"; ////////// 3D Function Imports ////////// @@ -118,7 +119,7 @@ export default function World() { const { shadows, setShadows } = useShadows(); const { updateScene, setUpdateScene } = useUpdateScene(); const { walls, setWalls } = useWalls(); - const [RefTextupdate, setRefTextUpdate] = useState(-1000); + const { refTextupdate, setRefTextUpdate } = useRefTextUpdate(); // const loader = new GLTFLoader(); // const dracoLoader = new DRACOLoader(); @@ -158,7 +159,7 @@ export default function World() { ////////// All Toggle's ////////// useEffect(() => { - setRefTextUpdate((prevUpdate) => prevUpdate - 1); + setRefTextUpdate((prevUpdate: number) => prevUpdate - 1); if (dragPointControls.current) { dragPointControls.current.enabled = false; } @@ -241,7 +242,7 @@ export default function World() { diff --git a/app/src/modules/simulation/behaviour/behaviour.tsx b/app/src/modules/simulation/behaviour/behaviour.tsx index 868900a..fa976aa 100644 --- a/app/src/modules/simulation/behaviour/behaviour.tsx +++ b/app/src/modules/simulation/behaviour/behaviour.tsx @@ -67,12 +67,11 @@ function Behaviour() { point: { uuid: pointUUID, position: [pointPosition.x, pointPosition.y, pointPosition.z], - actions: [{ uuid: THREE.MathUtils.generateUUID(), name: 'Action 1', type: 'Start', start: '', hitCount: 1, end: '', buffer: 0, isUsed: false }], - triggers: [], + actions: { uuid: THREE.MathUtils.generateUUID(), name: 'Action 1', type: 'Start', start: '', hitCount: 1, end: '', buffer: 0 }, connections: { source: { pathUUID: item.modeluuid, pointUUID: pointUUID }, targets: [] }, + speed: 2, }, assetPosition: [...item.position], - speed: 2, }; newPaths.push(newVehiclePath); diff --git a/app/src/modules/simulation/simulationtemp/path/pathCreator.tsx b/app/src/modules/simulation/simulationtemp/path/pathCreator.tsx index 1c63289..c09b21c 100644 --- a/app/src/modules/simulation/simulationtemp/path/pathCreator.tsx +++ b/app/src/modules/simulation/simulationtemp/path/pathCreator.tsx @@ -93,6 +93,7 @@ const PathCreator = ({ simulationPaths, setSimulationPaths, connections, setConn intersects = intersects.filter( (intersect) => !intersect.object.name.includes("Roof") && + !intersect.object.name.includes("agv-collider") && !intersect.object.name.includes("MeasurementReference") && !intersect.object.userData.isPathObject && !(intersect.object.type === "GridHelper") @@ -146,6 +147,7 @@ const PathCreator = ({ simulationPaths, setSimulationPaths, connections, setConn const intersects = raycaster.intersectObjects(scene.children, true).filter( (intersect) => !intersect.object.name.includes("Roof") && + !intersect.object.name.includes("agv-collider") && !intersect.object.name.includes("MeasurementReference") && !intersect.object.userData.isPathObject && !(intersect.object.type === "GridHelper") @@ -262,6 +264,7 @@ const PathCreator = ({ simulationPaths, setSimulationPaths, connections, setConn const intersects = raycaster.intersectObjects(scene.children, true).filter( (intersect) => !intersect.object.name.includes("Roof") && + !intersect.object.name.includes("agv-collider") && !intersect.object.name.includes("MeasurementReference") && !intersect.object.userData.isPathObject && !(intersect.object.type === "GridHelper") diff --git a/app/src/store/store.ts b/app/src/store/store.ts index 388f9d0..b3dc67b 100644 --- a/app/src/store/store.ts +++ b/app/src/store/store.ts @@ -203,6 +203,20 @@ export const useActiveLayer = create((set: any) => ({ setActiveLayer: (x: any) => set({ activeLayer: x }), })); +interface RefTextUpdateState { + refTextupdate: number; + setRefTextUpdate: (callback: (currentValue: number) => number | number) => void; +} + +export const useRefTextUpdate = create((set) => ({ + refTextupdate: -1000, + setRefTextUpdate: (callback) => + set((state) => ({ + refTextupdate: + typeof callback === "function" ? callback(state.refTextupdate) : callback, + })), +})); + export const useResetCamera = create((set: any) => ({ resetCamera: false, setResetCamera: (x: any) => set({ resetCamera: x }), diff --git a/app/src/types/world/worldTypes.d.ts b/app/src/types/world/worldTypes.d.ts index 71c2528..39ebeeb 100644 --- a/app/src/types/world/worldTypes.d.ts +++ b/app/src/types/world/worldTypes.d.ts @@ -310,10 +310,9 @@ interface VehicleEventsSchema { point: { uuid: string; position: [number, number, number]; - actions: { uuid: string; name: string; type: string; start: string, hitCount: number, end: string, buffer: number; isUsed: boolean }[] | []; - triggers: { uuid: string; name: string; type: string; isUsed: boolean }[] | []; + actions: { uuid: string; name: string; type: string; start: string, hitCount: number, end: string, buffer: number }; connections: { source: { pathUUID: string; pointUUID: string }; targets: { pathUUID: string; pointUUID: string }[] }; + speed: number; }; assetPosition: [number, number, number]; - speed: number; } \ No newline at end of file