diff --git a/app/src/components/layout/scenes/ComparisonScene.tsx b/app/src/components/layout/scenes/ComparisonScene.tsx index d823d5b..237ab7f 100644 --- a/app/src/components/layout/scenes/ComparisonScene.tsx +++ b/app/src/components/layout/scenes/ComparisonScene.tsx @@ -6,21 +6,24 @@ import useModuleStore from '../../../store/useModuleStore'; import CompareLayOut from '../../ui/compareVersion/CompareLayOut'; import ComparisonResult from '../../ui/compareVersion/ComparisonResult'; import { useComparisonProduct } from '../../../store/simulation/useSimulationStore'; -import { usePlayButtonStore } from '../../../store/usePlayButtonStore'; +import { usePauseButtonStore, usePlayButtonStore } from '../../../store/usePlayButtonStore'; function ComparisonScene() { - const { isPlaying } = usePlayButtonStore(); + const { isPlaying, setIsPlaying } = usePlayButtonStore(); const { products } = useProductStore(); const { isVersionSaved } = useSaveVersion(); const { activeModule } = useModuleStore(); const { selectedProductStore } = useProductContext(); const { selectedProduct } = selectedProductStore(); const { comparisonProduct, setComparisonProduct } = useComparisonProduct(); + const { setIsPaused } = usePauseButtonStore(); const handleSelectLayout = (option: string) => { const product = products.find((product) => product.productName === option); if (product) { setComparisonProduct(product.productId, product.productName); + setIsPlaying(true); + setIsPaused(true); } }; return ( diff --git a/app/src/components/layout/scenes/MainScene.tsx b/app/src/components/layout/scenes/MainScene.tsx index 8effa1f..9348bd0 100644 --- a/app/src/components/layout/scenes/MainScene.tsx +++ b/app/src/components/layout/scenes/MainScene.tsx @@ -3,7 +3,6 @@ import { useLoadingProgress, useSaveVersion, useSocketStore, - useViewSceneStore, useWidgetSubOption, } from "../../../store/builder/store"; import useModuleStore, { useThreeDStore } from "../../../store/useModuleStore"; @@ -31,7 +30,6 @@ import { import { useProductContext } from "../../../modules/simulation/products/productContext"; import { useProductStore } from "../../../store/simulation/useProductStore"; import RegularDropDown from "../../ui/inputs/RegularDropDown"; -import InputToggle from "../../ui/inputs/InputToggle"; function MainScene() { const { products } = useProductStore(); @@ -48,7 +46,6 @@ function MainScene() { const { visualizationSocket } = useSocketStore(); const { selectedZone } = useSelectedZoneStore(); const { setFloatingWidget } = useFloatingWidget(); - const { viewSceneLabels, setViewSceneLabels } = useViewSceneStore(); const { comparisonProduct } = useComparisonProduct(); const handleSelectLayout = (option: string) => { @@ -76,20 +73,11 @@ function MainScene() { {activeModule !== "market" && !isPlaying && !isVersionSaved && ( )} - {isPlaying && activeModule === "simulation" && ( -
- setViewSceneLabels(!viewSceneLabels)} - /> -
- )} {(isPlaying || comparisonProduct !== null) && activeModule === "simulation" && loadingProgress == 0 && } - {isPlaying && activeModule !== "simulation" && } + {(isPlaying || comparisonProduct !== null) && + activeModule !== "simulation" && } {/* remove this later */} {activeModule === "builder" && !toggleThreeD && } diff --git a/app/src/components/ui/compareVersion/CompareLayOut.tsx b/app/src/components/ui/compareVersion/CompareLayOut.tsx index db8b17c..fc3a5d8 100644 --- a/app/src/components/ui/compareVersion/CompareLayOut.tsx +++ b/app/src/components/ui/compareVersion/CompareLayOut.tsx @@ -13,6 +13,7 @@ import OuterClick from "../../../utils/outerClick"; import { useProductStore } from "../../../store/simulation/useProductStore"; import Scene from "../../../modules/scene/scene"; import { useComparisonProduct } from "../../../store/simulation/useSimulationStore"; +import { usePauseButtonStore, usePlayButtonStore } from "../../../store/usePlayButtonStore"; const CompareLayOut = () => { const { comparisonProduct, setComparisonProduct, clearComparisonProduct } = @@ -27,6 +28,8 @@ const CompareLayOut = () => { const startXRef = useRef(0); const { setIsVersionSaved } = useSaveVersion(); const { loadingProgress } = useLoadingProgress(); + const { setIsPlaying } = usePlayButtonStore(); + const { setIsPaused } = usePauseButtonStore(); OuterClick({ contextClassName: ["displayLayouts-container", "selectLayout"], @@ -69,6 +72,7 @@ const CompareLayOut = () => { setWidth("0px"); setIsVersionSaved(false); clearComparisonProduct(); + setIsPlaying(false); } else { setWidth(`${finalWidthVw}vw`); } @@ -114,6 +118,8 @@ const CompareLayOut = () => { if (product) { setComparisonProduct(product.productId, product.productName); setLoadingProgress(1); + setIsPlaying(true); + setIsPaused(true); } }; diff --git a/app/src/components/ui/simulation/simulationPlayer.tsx b/app/src/components/ui/simulation/simulationPlayer.tsx index 2825014..e2f1c9d 100644 --- a/app/src/components/ui/simulation/simulationPlayer.tsx +++ b/app/src/components/ui/simulation/simulationPlayer.tsx @@ -24,6 +24,7 @@ import ProductionCapacity from "../analysis/ThroughputSummary"; import ThroughputSummary from "../analysis/ProductionCapacity"; import ROISummary from "../analysis/ROISummary"; import { usePlayerStore } from "../../../store/useUIToggleStore"; +import { useComparisonProduct } from "../../../store/simulation/useSimulationStore"; const SimulationPlayer: React.FC = () => { const MAX_SPEED = 4; // Maximum speed @@ -31,7 +32,6 @@ const SimulationPlayer: React.FC = () => { const isDragging = useRef(false); const sliderRef = useRef(null); const [expand, setExpand] = useState(true); - const [playSimulation, setPlaySimulation] = useState(false); const { hidePlayer, setHidePlayer } = usePlayerStore(); const { speed, setSpeed } = useAnimationPlaySpeed(); @@ -40,6 +40,7 @@ const SimulationPlayer: React.FC = () => { const { isPaused, setIsPaused } = usePauseButtonStore(); const { isReset, setReset } = useResetButtonStore(); const { subModule } = useSubModuleStore(); + const { clearComparisonProduct } = useComparisonProduct(); useEffect(() => { if (isReset) { @@ -55,17 +56,15 @@ const SimulationPlayer: React.FC = () => { setIsPaused(false); setSpeed(1); echo.info("Simulation RESET....."); - setPlaySimulation(false); // local state reset }; const handlePlayStop = () => { setIsPaused(!isPaused); echo.warn(`Simulation is ${isPaused ? "Resumed" : "Paused"}`); - setPlaySimulation(!playSimulation); }; const handleExit = () => { - setPlaySimulation(false); setIsPlaying(false); setIsPaused(false); + clearComparisonProduct(); setActiveTool("cursor"); echo.info("Exit Simulation"); }; @@ -210,7 +209,7 @@ const SimulationPlayer: React.FC = () => { {!hidePlayer && subModule !== "analysis" && (
- {playSimulation + {isPaused ? "Paused - system idle." : "Running simulation..."}
@@ -237,7 +236,7 @@ const SimulationPlayer: React.FC = () => { }} > - {playSimulation ? "Play" : "Stop"} + {isPaused ? "Play" : "Stop"} )}