MCPcopy
hub / github.com/opentrace/opentrace / redrawAllEdges3D

Method redrawAllEdges3D

ui/src/components/pixi/PixiRenderer.ts:3050–3125  ·  view source on GitHub ↗

* Edge redraw for 3D mode — uses projected positions instead of stored (x, y).

()

Source from the content-addressed store, hash-verified

3048 * Edge redraw for 3D mode — uses projected positions instead of stored (x, y).
3049 */
3050 private redrawAllEdges3D(): void {
3051 if (!this.edgeBgGfx || !this.edgeFgGfx) return;
3052 this.edgeBgGfx.clear();
3053 this.edgeFgGfx.clear();
3054 if (!this.edgesEnabled) return;
3055
3056 const bgAlpha = this.hasHighlight
3057 ? EDGE_OPACITY_DIMMED
3058 : EDGE_OPACITY_DEFAULT;
3059 const edgeWidth = 0.5 * this.zoomInvScale();
3060
3061 for (const [color, indices] of this.edgeColorGroups) {
3062 let drawn = false;
3063 for (const i of indices) {
3064 const e = this.edges[i];
3065 if (this.hiddenLinkTypes.has(e.label)) continue;
3066 const s = this.nodes.get(e.sourceId);
3067 const t = this.nodes.get(e.targetId);
3068 if (!s?.visible || !t?.visible) continue;
3069 // Use projected positions (already set on sprites)
3070 const sx = s.sprite.position.x;
3071 const sy = s.sprite.position.y;
3072 const tx = t.sprite.position.x;
3073 const ty = t.sprite.position.y;
3074 this.drawEdge(this.edgeBgGfx, sx, sy, tx, ty);
3075 drawn = true;
3076 }
3077 if (drawn) {
3078 this.edgeBgGfx.stroke({
3079 width: edgeWidth,
3080 color: hexToNum(color),
3081 alpha: bgAlpha,
3082 });
3083 }
3084 }
3085
3086 // Foreground highlight edges (same logic as 2D redrawAllEdges)
3087 if (this.hasHighlight) {
3088 const hlColorGroups = new Map<
3089 string,
3090 { sx: number; sy: number; tx: number; ty: number }[]
3091 >();
3092 for (let i = 0; i < this.edges.length; i++) {
3093 const e = this.edges[i];
3094 if (this.hiddenLinkTypes.has(e.label)) continue;
3095 const linkKey = `${e.sourceId}-${e.targetId}`;
3096 if (!this.highlightLinks.has(linkKey)) continue;
3097 const s = this.nodes.get(e.sourceId);
3098 const t = this.nodes.get(e.targetId);
3099 if (!s?.visible || !t?.visible) continue;
3100 let group = hlColorGroups.get(e.color);
3101 if (!group) {
3102 group = [];
3103 hlColorGroups.set(e.color, group);
3104 }
3105 group.push({
3106 sx: s.sprite.position.x,
3107 sy: s.sprite.position.y,

Callers 1

update3DMethod · 0.95

Calls 5

zoomInvScaleMethod · 0.95
drawEdgeMethod · 0.95
hexToNumFunction · 0.85
pushMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected