#
luxiaotao1123
2024-04-19 5c6d7b33b73a34d226a91541c446db0c2d6227d9
#
2个文件已修改
28 ■■■■■ 已修改文件
src/assets/data/tunnel.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/tunnel.jsx 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/data/tunnel.js
@@ -4,9 +4,6 @@
    y: -1000,
    width: 200,
    height: 2000,
    name: 'selected-rect1684723196047',
    type: 'tunnel',
    strokeColor: 'yellow',
    tunnelNumber: 'T1',
  },
  {
@@ -14,9 +11,6 @@
    y: -50,
    width: 1300,
    height: 100,
    name: 'selected-rect1684723196047',
    type: 'tunnel',
    strokeColor: 'yellow',
    tunnelNumber: 'T2',
  },
];
src/components/tunnel.jsx
@@ -2,15 +2,7 @@
import { Vector3 } from 'three';
import { MeshReflectorMaterial, Html } from '@react-three/drei';
// export interface ITunnelProps {
//   x: number;
//   y: number;
//   width: number;
//   height: number;
//   tunnelNumber: string;
// }
const Tunnel = ({ x, y, width, height, tunnelNumber }) => {
  // 巷道的位置
  const innerPosition = new Vector3(x + width / 2, 1.1, y + height / 2);
  const outerPosition = new Vector3(x + width / 2, 1, y + height / 2);
  const textPosition = new Vector3(x + width / 2, 1.2, y + height / 2);
@@ -38,20 +30,6 @@
        ></planeGeometry>
        <meshBasicMaterial color="rgb(221, 165, 15)"></meshBasicMaterial>
      </mesh>
      {/* <Text
                fontSize={24}
                color="white"
                anchorX="center"
                anchorY="middle"
                position={textPosition}
                rotation={[-Math.PI / 2, 0, 0]}
                matrixWorldAutoUpdate
                getObjectsByProperty={null}
                getVertexPosition={null}
            >
                {tunnelNumber}
                <meshPhongMaterial color={"white"}></meshPhongMaterial>
            </Text> */}
      <Html scale={100} rotation={[-Math.PI / 2, 0, 0]} position={textPosition} transform occlude>
        {tunnelNumber}
      </Html>