MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / createEdgeGeometry

Function createEdgeGeometry

graph-ui/src/galaxy/EdgeLines.tsx:150–288  ·  view source on GitHub ↗
({
    nodes,
    edges,
    highlightedIds,
    emphasizeIncidentEdges = false,
    brightness = 1.0,
    targetNodes,
}: EdgeLinesProps)

Source from the content-addressed store, hash-verified

148}
149
150export function createEdgeGeometry({
151 nodes,
152 edges,
153 highlightedIds,
154 emphasizeIncidentEdges = false,
155 brightness = 1.0,
156 targetNodes,
157}: EdgeLinesProps): THREE.BufferGeometry {
158 /* Shrink per-edge glow as the edge count grows so the additively-blended
159 * center doesn't saturate to white; the user multiplier rides on top.
160 * Seit W9 nur noch fuer den abgedunkelten Rest einer Auswahl: der
161 * Grundwert bringt seine eigene Kurve mit (edgeIntensityFor).
162 * `edges.length` ist die Zahl der WIRKLICH gezeichneten Kanten, also
163 * die nach dem Kantenart-Filter: wer die Haelfte ausblendet, hat auch
164 * die Haelfte des Schleiers, und die uebrigen duerfen dafuer heller
165 * werden. */
166 const densityScale = edgeIntensityScale(edges.length) * brightness;
167 const srcMap = new Map<number, number>();
168 for (let i = 0; i < nodes.length; i++) {
169 srcMap.set(nodes[i].id, i);
170 }
171 const tgtArr = targetNodes ?? nodes;
172 const tgtMap = targetNodes ? new Map<number, number>() : srcMap;
173 if (targetNodes) {
174 for (let i = 0; i < targetNodes.length; i++) {
175 tgtMap.set(targetNodes[i].id, i);
176 }
177 }
178
179 const hasHighlight = highlightedIds && highlightedIds.size > 0;
180 const positions = new Float32Array(edges.length * 6);
181 const colors = new Float32Array(edges.length * 6);
182 const flow = new Float32Array(edges.length * 6);
183 const colorByType = new Map<string, THREE.Color>();
184 let validCount = 0;
185
186 for (const edge of edges) {
187 const si = srcMap.get(edge.source);
188 const ti = tgtMap.get(edge.target);
189 if (si === undefined || ti === undefined) continue;
190
191 const s = nodes[si];
192 const t = tgtArr[ti];
193
194 const sHL = !hasHighlight || highlightedIds.has(s.id);
195 const tHL = !hasHighlight || highlightedIds.has(t.id);
196 if (hasHighlight && !sHL && !tHL) continue;
197
198 const sameCluster =
199 getClusterKey(s.file_path) === getClusterKey(t.file_path);
200
201 /* Intensity based on cluster membership and highlight.
202 * With additive blending + dark background, these glow nicely.
203 * Seit W9 haengt der Grundwert an der Kantenzahl: siehe
204 * edgeIntensityFor. Der Fokus-Zweig ist der der Uebernahme. */
205 let intensity = edgeIntensityFor(sameCluster, edges.length) * brightness;
206 if (hasHighlight) {
207 /* A selection stays at full strength (never density-scaled) so it

Callers 2

edge-lines.test.tsFile · 0.90
EdgeLinesFunction · 0.85

Calls 7

edgeIntensityScaleFunction · 0.90
edgeColorFunction · 0.90
edgePhaseFunction · 0.90
isDirectedEdgeFunction · 0.90
getClusterKeyFunction · 0.85
edgeIntensityForFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected