From 64885f246e9cd130f31409da26372aa35352f941 Mon Sep 17 00:00:00 2001 From: Jerald-Golden-B Date: Wed, 16 Apr 2025 18:05:23 +0530 Subject: [PATCH] refactor: Improve error handling and variable naming in Assets and IKAnimationController components --- .../components/layout/sidebarLeft/Assets.tsx | 5 +++-- .../armbot/IKAnimationController.tsx | 20 +++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/app/src/components/layout/sidebarLeft/Assets.tsx b/app/src/components/layout/sidebarLeft/Assets.tsx index 1cdd9bd..5477790 100644 --- a/app/src/components/layout/sidebarLeft/Assets.tsx +++ b/app/src/components/layout/sidebarLeft/Assets.tsx @@ -73,7 +73,7 @@ const Assets: React.FC = () => { try { const filt = await fetchAssets(); setFiltereredAssets(filt); - } catch {} + } catch { } }; filteredAssets(); }, [categoryAssets]); @@ -135,7 +135,7 @@ const Assets: React.FC = () => { const res = await getCategoryAsset(asset); setCategoryAssets(res); setFiltereredAssets(res); - } catch (error) {} + } catch (error) { } } }; return ( @@ -234,6 +234,7 @@ const Assets: React.FC = () => { src={categoryInfo?.categoryImage || ""} alt={category} className="category-image" + draggable={false} />
{category}
diff --git a/app/src/modules/simulation/armbot/IKAnimationController.tsx b/app/src/modules/simulation/armbot/IKAnimationController.tsx index 6b77bac..a58e2d8 100644 --- a/app/src/modules/simulation/armbot/IKAnimationController.tsx +++ b/app/src/modules/simulation/armbot/IKAnimationController.tsx @@ -4,6 +4,8 @@ import * as THREE from "three"; import { usePlayButtonStore, useResetButtonStore } from "../../../store/usePlayButtonStore"; import { useSimulationStates } from "../../../store/store"; import MaterialInstances from "./MaterialInstances"; +import { Line } from "react-chartjs-2"; +import { QuadraticBezierLine } from "@react-three/drei"; interface StaticMachineState { @@ -124,7 +126,7 @@ const IKAnimationController = ({ ]); }; - const processCurves = useMemo(() => { + const processedCurves = useMemo(() => { if (!isPlaying) return []; return processes.map(process => { @@ -172,8 +174,8 @@ const IKAnimationController = ({ const activeProcess = useMemo(() => { if (!selectedTrigger) return null; - return processCurves.find(p => p?.triggerId === selectedTrigger); - }, [processCurves, selectedTrigger]); + return processedCurves.find(p => p?.triggerId === selectedTrigger); + }, [processedCurves, selectedTrigger]); // Initial movement to rest position useFrame((_, delta) => { @@ -364,11 +366,13 @@ const IKAnimationController = ({ } return ( - + <> + + ); };