From 5e39d5aaf44d377a91c135576a0c22b15790e7c7 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 24 四月 2024 16:25:37 +0800
Subject: [PATCH] #

---
 src/components/text.jsx |    4 ++--
 src/assets/data/area.js |    2 +-
 src/components/area.jsx |   38 ++++++--------------------------------
 3 files changed, 9 insertions(+), 35 deletions(-)

diff --git a/src/assets/data/area.js b/src/assets/data/area.js
index 8bba4c9..1714151 100644
--- a/src/assets/data/area.js
+++ b/src/assets/data/area.js
@@ -7,7 +7,7 @@
     name: 'selected-rect1684723196047',
     type: 'area',
     strokeColor: 'rgb(255, 0, 14)',
-    areaNumber: 'AGV',
+    textContent: 'AGV',
     textHeight: 400,
   },
 ];
diff --git a/src/components/area.jsx b/src/components/area.jsx
index 3505595..5294bbc 100644
--- a/src/components/area.jsx
+++ b/src/components/area.jsx
@@ -2,19 +2,11 @@
 import { useFrame, useThree } from '@react-three/fiber';
 import * as THREE from 'three';
 import { CameraControls } from '@react-three/drei';
-import Text2 from './text';
-// import Annotation, { IAnnotationDataItem, IAnnotationRef } from './annotation';
+import Text from './text';
 
 const Y = 1;
-const Area = ({
-  x,
-  y,
-  width,
-  height,
-  areaNumber,
-  textHeight,
-  strokeColor,
-}) => {
+const Area = (props) => {
+  const { x, y, width, height, textContent, textHeight, strokeColor } = props;
   const [hovered, setHover] = useState(false);
   const [clicked, setClicked] = useState(false);
   const meshRef = useRef(null);
@@ -65,18 +57,6 @@
     }
   });
 
-  // const annotationRef = useRef(null);
-  const annotationData = [
-    {
-      label: '闀�',
-      value: width + '绫�',
-    },
-    {
-      label: '瀹�',
-      value: height + '绫�',
-    },
-  ];
-
   return (
     <group
       onClick={handleClick}
@@ -94,20 +74,14 @@
         <meshBasicMaterial attach="material" color={strokeColor} transparent opacity={0.2} />
       </mesh>
 
-      {areaNumber && (
-        <Text2
+      {textContent && (
+        <Text
           position={new THREE.Vector3(position.x, textHeight, position.z)}
-          text={areaNumber}
+          text={textContent}
           scale={new THREE.Vector3(100, 100, 100)}
           fontSize={100}
         />
       )}
-      {/* <Annotation
-        ref={annotationRef}
-        title={areaNumber}
-        position={position}
-        data={annotationData}
-      ></Annotation> */}
     </group>
   );
 };
diff --git a/src/components/text.jsx b/src/components/text.jsx
index d5dfdaa..6d35cfd 100644
--- a/src/components/text.jsx
+++ b/src/components/text.jsx
@@ -18,7 +18,7 @@
   return canvas;
 }
 
-const Text2 = ({
+const Text = ({
   text,
   position,
   scale = new THREE.Vector3(100, 100, 100),
@@ -37,4 +37,4 @@
   return <sprite material={material} position={position} scale={scale} />;
 }
 
-export default Text2;
+export default Text;

--
Gitblit v1.9.1