({
data,
missed = null,
highlightedIds,
cameraTarget,
showLabels,
display = DEFAULT_DISPLAY_SETTINGS,
onNodeClick,
onBackgroundClick,
}: GraphSceneProps)
| 129 | export type { CameraTarget }; |
| 130 | |
| 131 | export function GraphScene({ |
| 132 | data, |
| 133 | missed = null, |
| 134 | highlightedIds, |
| 135 | cameraTarget, |
| 136 | showLabels, |
| 137 | display = DEFAULT_DISPLAY_SETTINGS, |
| 138 | onNodeClick, |
| 139 | onBackgroundClick, |
| 140 | }: GraphSceneProps) { |
| 141 | const [hovered, setHovered] = useState<GraphNode | null>(null); |
| 142 | const controlsRef = useRef<OrbitControlsImpl | null>(null); |
| 143 | |
| 144 | /* Adaptive density defaults × user multipliers. The automatic scale keeps |
| 145 | * contrast roughly constant as the graph grows; the sliders nudge it. |
| 146 | * NodeCloud applies `nodeBoost` directly (no internal density scaling), |
| 147 | * whereas EdgeLines scales by edge density itself — so it receives only the |
| 148 | * user edge-brightness multiplier to avoid double-applying. */ |
| 149 | const nodeBoost = nodeBoostScale(data.nodes.length) * display.nodeGlow; |
| 150 | const bloomIntensity = |
| 151 | BASE_BLOOM_INTENSITY * bloomIntensityScale(data.nodes.length) * display.bloom; |
| 152 | |
| 153 | return ( |
| 154 | <Canvas |
| 155 | camera={{ position: [0, 0, 800], fov: 50, near: 0.1, far: 100000 }} |
| 156 | style={{ background: "#06090f" }} |
| 157 | dpr={GRAPH_CANVAS_DPR} |
| 158 | gl={{ |
| 159 | antialias: false, |
| 160 | alpha: false, |
| 161 | powerPreference: "high-performance", |
| 162 | }} |
| 163 | onPointerMissed={onBackgroundClick} |
| 164 | > |
| 165 | <color attach="background" args={["#06090f"]} /> |
| 166 | <ambientLight intensity={0.5} /> |
| 167 | <pointLight position={[500, 500, 500]} intensity={0.6} /> |
| 168 | <pointLight |
| 169 | position={[-300, -200, -300]} |
| 170 | intensity={0.4} |
| 171 | color="#6040ff" |
| 172 | /> |
| 173 | |
| 174 | <EdgeLines |
| 175 | nodes={data.nodes} |
| 176 | edges={data.edges} |
| 177 | highlightedIds={highlightedIds} |
| 178 | brightness={display.edgeBrightness} |
| 179 | /> |
| 180 | <NodeCloud |
| 181 | nodes={data.nodes} |
| 182 | highlightedIds={highlightedIds} |
| 183 | onHover={setHovered} |
| 184 | onClick={onNodeClick} |
| 185 | boost={nodeBoost} |
| 186 | /> |
| 187 | {showLabels && <NodeLabels nodes={data.nodes} highlightedIds={highlightedIds} />} |
| 188 |
nothing calls this directly
no test coverage detected