Merge remote-tracking branch 'origin/simulation' into simulation-agv

This commit is contained in:
2025-03-29 14:33:12 +05:30
17 changed files with 284 additions and 624 deletions

View File

@@ -18,7 +18,7 @@ const ModuleToggle: React.FC = () => {
className={`module-list ${activeModule === "builder" && "active"}`}
onClick={() => {
setActiveModule("builder");
setToggleUI(true);
setToggleUI(localStorage.getItem('navBarUi') ? localStorage.getItem('navBarUi') === 'true' : true)
}}
>
<div className="icon">
@@ -30,7 +30,7 @@ const ModuleToggle: React.FC = () => {
className={`module-list ${activeModule === "simulation" && "active"}`}
onClick={() => {
setActiveModule("simulation");
setToggleUI(true);
setToggleUI(localStorage.getItem('navBarUi') ? localStorage.getItem('navBarUi') === 'true' : true)
}}
>
<div className="icon">
@@ -39,12 +39,11 @@ const ModuleToggle: React.FC = () => {
<div className="module">Simulation</div>
</div>
<div
className={`module-list ${
activeModule === "visualization" && "active"
}`}
className={`module-list ${activeModule === "visualization" && "active"
}`}
onClick={() => {
setActiveModule("visualization");
setToggleUI(true);
setToggleUI(localStorage.getItem('navBarUi') ? localStorage.getItem('navBarUi') === 'true' : true)
}}
>
<div className="icon">

View File

@@ -25,6 +25,7 @@ import {
useDeleteModels,
useDeletePointOrLine,
useMovePoint,
useRefTextUpdate,
useSelectedWallItem,
useToggleView,
useToolMode,
@@ -57,12 +58,11 @@ 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(() => {
const storedNavBar: any = localStorage.getItem("navBarUi");
if (storedNavBar) {
const parsedNavBar = JSON.parse(storedNavBar);
setToggleUI(parsedNavBar);
}
setToggleUI(localStorage.getItem('navBarUi') ? localStorage.getItem('navBarUi') === 'true' : true)
}, []);
useEffect(() => {
@@ -76,13 +76,14 @@ const Tools: React.FC = () => {
setDeleteModels(false);
setAddAction(null);
setToggleView(true);
localStorage.setItem("navBarUi", JSON.stringify(!toggleThreeD));
// localStorage.setItem("navBarUi", JSON.stringify(!toggleThreeD));
} else {
setToggleView(false);
}
setToggleUI(localStorage.getItem('navBarUi') ? localStorage.getItem('navBarUi') === 'true' : true)
setToggleThreeD(!toggleThreeD);
setActiveSubTool("cursor");
setActiveTool("cursor");
setToggleThreeD(!toggleThreeD);
};
useEffect(() => {
@@ -112,6 +113,7 @@ const Tools: React.FC = () => {
setToggleUI(false);
}
}, [toggleThreeD]);
useEffect(() => {
setToolMode(null);
setDeleteModels(false);
@@ -119,6 +121,7 @@ const Tools: React.FC = () => {
setTransformMode(null);
setMovePoint(false);
setDeletePointOrLine(false);
setRefTextUpdate((prevUpdate) => prevUpdate - 1);
switch (activeTool) {
case "Move":
@@ -189,6 +192,7 @@ const Tools: React.FC = () => {
setActiveTool(activeTool);
}, [activeTool]);
return (
<>
{!isPlaying ? (
@@ -198,9 +202,8 @@ const Tools: React.FC = () => {
<div className="activeDropicon">
{activeSubTool == "cursor" && (
<div
className={`tool-button ${
activeTool === "cursor" ? "active" : ""
}`}
className={`tool-button ${activeTool === "cursor" ? "active" : ""
}`}
onClick={() => {
setActiveTool("cursor");
}}
@@ -210,9 +213,8 @@ const Tools: React.FC = () => {
)}
{activeSubTool == "free-hand" && (
<div
className={`tool-button ${
activeTool === "free-hand" ? "active" : ""
}`}
className={`tool-button ${activeTool === "free-hand" ? "active" : ""
}`}
onClick={() => {
setActiveTool("free-hand");
}}
@@ -222,9 +224,8 @@ const Tools: React.FC = () => {
)}
{activeSubTool == "delete" && (
<div
className={`tool-button ${
activeTool === "delete" ? "active" : ""
}`}
className={`tool-button ${activeTool === "delete" ? "active" : ""
}`}
onClick={() => {
setActiveTool("delete");
}}
@@ -296,9 +297,8 @@ const Tools: React.FC = () => {
<div className="split"></div>
<div className="draw-tools">
<div
className={`tool-button ${
activeTool === "draw-wall" ? "active" : ""
}`}
className={`tool-button ${activeTool === "draw-wall" ? "active" : ""
}`}
onClick={() => {
setActiveTool("draw-wall");
}}
@@ -307,9 +307,8 @@ const Tools: React.FC = () => {
<WallIcon isActive={activeTool === "draw-wall"} />
</div>
<div
className={`tool-button ${
activeTool === "draw-zone" ? "active" : ""
}`}
className={`tool-button ${activeTool === "draw-zone" ? "active" : ""
}`}
onClick={() => {
setActiveTool("draw-zone");
}}
@@ -318,9 +317,8 @@ const Tools: React.FC = () => {
<ZoneIcon isActive={activeTool === "draw-zone"} />
</div>
<div
className={`tool-button ${
activeTool === "draw-aisle" ? "active" : ""
}`}
className={`tool-button ${activeTool === "draw-aisle" ? "active" : ""
}`}
onClick={() => {
setActiveTool("draw-aisle");
}}
@@ -329,9 +327,8 @@ const Tools: React.FC = () => {
<AsileIcon isActive={activeTool === "draw-aisle"} />
</div>
<div
className={`tool-button ${
activeTool === "draw-floor" ? "active" : ""
}`}
className={`tool-button ${activeTool === "draw-floor" ? "active" : ""
}`}
onClick={() => {
setActiveTool("draw-floor");
}}
@@ -347,9 +344,8 @@ const Tools: React.FC = () => {
<div className="split"></div>
<div className="draw-tools">
<div
className={`tool-button ${
activeTool === "measure" ? "active" : ""
}`}
className={`tool-button ${activeTool === "measure" ? "active" : ""
}`}
onClick={() => {
setActiveTool("measure");
}}
@@ -365,9 +361,8 @@ const Tools: React.FC = () => {
<div className="split"></div>
<div className="draw-tools">
<div
className={`tool-button ${
activeTool === "pen" ? "active" : ""
}`}
className={`tool-button ${activeTool === "pen" ? "active" : ""
}`}
onClick={() => {
setActiveTool("pen");
}}
@@ -399,9 +394,8 @@ const Tools: React.FC = () => {
<div className="split"></div>
<div className="general-options">
<div
className={`tool-button ${
activeTool === "comment" ? "active" : ""
}`}
className={`tool-button ${activeTool === "comment" ? "active" : ""
}`}
onClick={() => {
setActiveTool("comment");
}}
@@ -410,9 +404,8 @@ const Tools: React.FC = () => {
</div>
{toggleThreeD && (
<div
className={`tool-button ${
activeTool === "play" ? "active" : ""
}`}
className={`tool-button ${activeTool === "play" ? "active" : ""
}`}
onClick={() => {
setIsPlaying(!isPlaying);
}}
@@ -423,9 +416,8 @@ const Tools: React.FC = () => {
</div>
<div className="split"></div>
<div
className={`toggle-threed-button${
toggleThreeD ? " toggled" : ""
}`}
className={`toggle-threed-button${toggleThreeD ? " toggled" : ""
}`}
onClick={toggleSwitch}
>
<div className={`toggle-option${!toggleThreeD ? " active" : ""}`}>

View File

@@ -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<EyeDropInputProps> = ({
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 (
<div className="eye-dropper-input-container">
<div className="label">Object</div>
<div className="label">{label}</div>
<div className="input-container">
<RegularDropDown
header="select object"
options={[]}
onSelect={() => {}}
/>
<div className="eye-picker-button">
<input disabled type="text" />
<div className="eye-picker-button" onClick={handleEyeDropClick}>
<EyeDroperIcon isActive={false} />
</div>
</div>
@@ -20,4 +32,4 @@ const EyeDropInput: React.FC = () => {
);
};
export default EyeDropInput;
export default EyeDropInput;