viz: add CALL -> codegen link (#16044)

* work

* cleaner

* details

* rm
This commit is contained in:
qazal
2026-05-05 17:34:44 +03:00
committed by GitHub
parent 1c8cb0769a
commit d79bf356c2
2 changed files with 20 additions and 4 deletions

View File

@@ -122,6 +122,19 @@
font-size: 6px;
fill: #08090e;
}
g.tag.ref * {
cursor: pointer;
}
g.tag.ref circle {
fill: #9FDDE6;
stroke: #4a4b57;
}
g.tag.ref path {
fill: none;
stroke: #08090e;
stroke-width: 0.7;
stroke-linejoin: miter;
}
.label :is(text, p) {
font-weight: 350;
}

View File

@@ -56,9 +56,10 @@ function intersectRect(r1, r2) {
return {x:r1.x+dx*scale, y:r1.y+dy*scale};
}
function addTags(root) {
function addTags(root, path) {
root.selectAll("circle").data(d => [d]).join("circle").attr("r", 5);
root.selectAll("text").data(d => [d]).join("text").text(d => d).attr("dy", "0.35em");
if (path != null) root.selectAll("path").data(d => [d]).join("path").attr("d", path);
else root.selectAll("text").data(d => [d]).join("text").text(d => d).attr("dy", "0.35em");
}
const drawGraph = (data) => {
@@ -116,9 +117,11 @@ const drawGraph = (data) => {
});
addTags(nodes.selectAll("g.tag").data(d => d.tag != null ? [d] : []).join("g").attr("class", "tag")
.attr("transform", d => `translate(${-d.width/2+8}, ${-d.height/2+8})`).datum(e => e.tag));
addTags(nodes.selectAll("g.type").data(d => d.callNode ? [d] : []).join("g")
.attr("class", d => `tag ${d.collapsed ? 'collapsed' : 'expanded'}`)
addTags(nodes.selectAll("g.type").data(d => d.callNode ? [d] : []).join("g").attr("class", d => `tag ${d.collapsed ? 'collapsed' : 'expanded'}`)
.attr("transform", d => `translate(${-d.width/2}, ${0})`).datum(d => d.collapsed ? "+" : ""));
addTags(nodes.selectAll("g.ref").data(d => d.ref != null ? [d] : []).join("g").attr("class", "tag ref")
.attr("transform", d => `translate(${d.width/2-2}, ${-d.height/2+2})`).on("click", (e,d) => { e.stopPropagation(); switchCtx(d.ref); }),
"M-1.7 1.7 L1.7 -1.7 M-0.55 -1.7 H1.7 V0.55");
// draw edges
const line = d3.line().x(d => d.x).y(d => d.y).curve(d3.curveBasis), edges = g.edges();
d3.select("#edges").selectAll("path.edgePath").data(edges).join("path").attr("class", "edgePath").attr("d", (e) => {