From d026e41e49dc17eaaefd96b0c69f560ffc728483 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 08 五月 2024 10:14:12 +0800
Subject: [PATCH] #

---
 src/components/agv.jsx |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/components/agv.jsx b/src/components/agv.jsx
index c3fb231..c96cf8c 100644
--- a/src/components/agv.jsx
+++ b/src/components/agv.jsx
@@ -14,9 +14,10 @@
 } from '../config/setting'
 
 const Agv = (props) => {
-    const { agvNo, position, theta, loaderTheta, trayList, hasBox } = props;
-    const height = props.height * 0.06;
+    const { agvNo, position, theta, trayList, hasBox } = props;
+    const height = props.height * 0.04;
     const forkLength = props.forkLength * 0.1;
+    const loaderTheta = Number(props.loaderTheta?.toFixed(1));
 
     const [groupPos, setGroupPos] = useState({ x: 0, y: 0, z: 0 });
     const [groupTheta, setGroupTheta] = useState(0);
@@ -36,7 +37,7 @@
             y: position?.[1] * REAL_COMPARE_MAP_SCALE,
             z: position?.[0] * REAL_COMPARE_MAP_SCALE + REAL_COMPARE_MAP_OFFSET_Z,
         }
-        if (!Common.deepEqual(groupPos, pos) && props.position) {
+        if (!Common.deepEqual(groupPos, pos) && props.position !== null) {
             new TWEEN.Tween(groupPos)
                 .to(pos, INTERVAL_TIME)
                 .easing(TWEEN.Easing.Linear.None)
@@ -49,8 +50,8 @@
         }
 
         // group theta
-        if (groupTheta !== theta && props.theta) {
-            const minTheta = Common.minDiffTheta(groupTheta, theta);
+        if (groupTheta !== -theta && props.theta !== null) {
+            const minTheta = Common.minDiffTheta(groupTheta, -theta);
             new TWEEN.Tween({ value: groupTheta })
                 .to({ value: minTheta }, INTERVAL_TIME)
                 .easing(TWEEN.Easing.Linear.None)
@@ -63,7 +64,7 @@
         }
 
         // loader height
-        if (loaderHeight !== height && props.height) {
+        if (loaderHeight !== height && props.height !== null) {
             new TWEEN.Tween({ value: loaderHeight })
                 .to({ value: height }, INTERVAL_TIME)
                 .easing(TWEEN.Easing.Linear.None)
@@ -77,10 +78,14 @@
 
         // loader theta
         const loaderAbsoluteAngle = (theta + loaderTheta) % 360;
-        if (integrateTheta !== loaderAbsoluteAngle && props.loaderTheta) {
-            const minTheta = Common.minDiffTheta(integrateTheta, loaderAbsoluteAngle);
+        // console.log("integrateTheta", integrateTheta);
+        // console.log("theta", theta);
+        // console.log("loaderTheta", loaderTheta);
+        // console.log("loaderAbsoluteAngle", loaderAbsoluteAngle);
+        if (integrateTheta !== loaderAbsoluteAngle && props.loaderTheta !== null) {
+            // const minTheta = Common.minDiffTheta(integrateTheta, loaderAbsoluteAngle);
             new TWEEN.Tween({ value: integrateTheta })
-                .to({ value: minTheta }, INTERVAL_TIME)
+                .to({ value: loaderAbsoluteAngle }, INTERVAL_TIME)
                 .easing(TWEEN.Easing.Linear.None)
                 .onUpdate((e) => {
                     setIntegrateTheta(e.value)
@@ -91,7 +96,9 @@
         }
 
         // fork lenght
-        if (forkDis !== forkLength && props.forkLength) {
+        // console.log("forkDis", forkDis);
+        // console.log("forkLength", forkLength);
+        if (forkDis !== forkLength && props.forkLength !== null) {
             new TWEEN.Tween({ value: forkDis })
                 .to({ value: forkLength }, INTERVAL_TIME)
                 .easing(TWEEN.Easing.Linear.None)

--
Gitblit v1.9.1