MCPcopy Create free account
hub / github.com/cartesiancs/map3d / Building

Function Building

src/three/Space.tsx:13–313  ·  view source on GitHub ↗
({
  shape,
  extrudeSettings,
  tags,
}: {
  shape: THREE.Shape;
  extrudeSettings: any;
  tags: any;
})

Source from the content-addressed store, hash-verified

11const scale = 51000;
12
13function Building({
14 shape,
15 extrudeSettings,
16 tags,
17}: {
18 shape: THREE.Shape;
19 extrudeSettings: any;
20 tags: any;
21}) {
22 const [hovered, setHovered] = useState(false);
23 const [clicked, setClicked] = useState(false);
24 const [hoverPos, setHoverPos] = useState<THREE.Vector3 | null>(null);
25 const [showTranslations, setShowTranslations] = useState(false);
26 const [showAdditionalInfo, setShowAdditionalInfo] = useState(false);
27 return (
28 <mesh
29 onPointerOver={(e) => {
30 setHovered(true);
31 e.stopPropagation();
32 }}
33 onPointerOut={(e) => {
34 setHovered(false);
35 e.stopPropagation();
36 }}
37 onPointerMove={(e) => {
38 setHoverPos(e.point.clone());
39 e.stopPropagation();
40 }}
41 onClick={(e) => {
42 setClicked(!clicked);
43 e.stopPropagation();
44 }}
45 rotation={[-Math.PI / 2, 0, 0]}
46 userData={{ exportToGLB: true }}
47 >
48 <extrudeGeometry args={[shape, extrudeSettings]} />
49 <meshStandardMaterial color={hovered || clicked ? "#007bff" : "#9da0a3"} />
50 {(hovered || clicked) && hoverPos && (
51 <Html position={[hoverPos.x, hoverPos.y + extrudeSettings.depth + 0.5, hoverPos.z]} center>
52 <div
53 role="dialog"
54 aria-label={tags.name || "Building Information"}
55 style={{
56 color: "#000000",
57 backgroundColor: "#ffffff96",
58 backdropFilter: "blur(8px)",
59 border: "none",
60 padding: "14px",
61 borderRadius: "10px",
62 fontFamily: "system-ui, -apple-system, sans-serif",
63 fontSize: "13px",
64 width: "200px",
65 boxShadow: "0 2px 14px rgba(0, 0, 0, 0.16)",
66 transition: "all 0.2s ease-in-out",
67 }}
68 >
69 <div
70 style={{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected