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

---
 src/utils/common.js |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/utils/common.js b/src/utils/common.js
index 25d76a5..b3ba740 100644
--- a/src/utils/common.js
+++ b/src/utils/common.js
@@ -28,6 +28,14 @@
     return (targetTheta - originTheta > 180) ? targetTheta - 360 : targetTheta;
 }
 
+export const normalizeAngle = (angle) => {
+    let newAngle = angle % 360;
+    if (newAngle < 0) {
+        newAngle += 360;
+    }
+    return newAngle;
+}
+
 export const calculateMappedPosition = (realPos) => {
     return [
         realPos[0] * REAL_COMPARE_MAP_SCALE + REAL_COMPARE_MAP_OFFSET_X,
@@ -47,13 +55,13 @@
     }
 };
 
-export const setColor = (obj) => {
+export const setColor = (obj, color = 0x4680BF) => {
     if (obj.material) {
-        obj.material.color.set(0x4680BF);
+        obj.material.color.set(color);
     }
     if (obj.children) {
         obj.children.forEach((child) => {
-            setColor(child);
+            setColor(child, color);
         });
     }
 };

--
Gitblit v1.9.1