ensure edge labels are always on top (#9908)

This commit is contained in:
qazal
2025-04-16 16:08:06 +03:00
committed by GitHub
parent 5265f25088
commit e8e43c6dad
2 changed files with 2 additions and 1 deletions

View File

@@ -191,6 +191,7 @@
<svg id="graph-svg" preserveAspectRatio="xMidYMid meet">
<g id="render">
<g id="edges"></g>
<g id="edge-labels"></g> <!-- NOTE: this ensures edge labels are always on top -->
<g id="nodes"></g>
<g id="bars"></g>
</g>

View File

@@ -54,7 +54,7 @@ async function renderDag(graph, additions, recenter=false) {
points.push(intersectRect(g.node(e.w), points[points.length-1]));
return line(points);
}).attr("marker-end", "url(#arrowhead)");
const edgeLabels = d3.select("#edges").selectAll("g").data(g.edges().filter(e => g.edge(e).label != null)).join("g").attr("transform", (e) => {
const edgeLabels = d3.select("#edge-labels").selectAll("g").data(g.edges().filter(e => g.edge(e).label != null)).join("g").attr("transform", (e) => {
// get a point near the end
const [p1, p2] = g.edge(e).points.slice(-2);
const dx = p2.x-p1.x;