From 77e523a30279a01f892da9d709200680c589c697 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Sat, 24 Jan 2026 14:44:23 -0800 Subject: [PATCH] Position edge labels near their respective nodes --- static/index.html | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/static/index.html b/static/index.html index 4b44c96..ed776ce 100644 --- a/static/index.html +++ b/static/index.html @@ -114,16 +114,13 @@ const idB = idMap.get(link.node_b?.typeid); if (!idA || !idB) return; - let label = ''; - if (link.interface_a) label = link.interface_a; - if (link.interface_b) label += (label ? ' ↔ ' : '') + link.interface_b; - elements.push({ data: { id: 'e' + i, source: idA, target: idB, - label: label + sourceLabel: link.interface_a || '', + targetLabel: link.interface_b || '' } }); }); @@ -167,13 +164,17 @@ 'width': 2, 'line-color': '#666', 'curve-style': 'bezier', - 'label': 'data(label)', + 'source-label': 'data(sourceLabel)', + 'target-label': 'data(targetLabel)', + 'source-text-offset': 40, + 'target-text-offset': 40, + 'source-text-rotation': 'autorotate', + 'target-text-rotation': 'autorotate', 'font-size': 9, 'color': '#aaa', 'text-background-color': '#1a1a1a', 'text-background-opacity': 1, - 'text-background-padding': 2, - 'text-rotation': 'autorotate' + 'text-background-padding': 2 } } ],