stronger highlighting of selected nodes/edges

This commit is contained in:
David Mosbach 2023-05-28 14:21:26 +02:00
parent 0d770bf612
commit 5e46f0745b

View File

@ -584,7 +584,7 @@ const Graph = ForceGraph()
context.restore();
})
.linkLineDash(edge => edge.actionData.mode == 'automatic' && [2, 3]) //[dash, gap]
.linkWidth(edge => (isHighlightedEdge(edge)) ? 3 : 1)
.linkWidth(edge => (((edge === selection || edge === rightSelection) ? 1 : 0) + (isHighlightedEdge(edge)) ? 3 : 1))
.linkDirectionalParticles(2)
.linkDirectionalParticleColor(() => '#00000055')
.linkDirectionalParticleWidth(edge => (isHighlightedEdge(edge)) ? 3 : 0)
@ -593,6 +593,11 @@ const Graph = ForceGraph()
ctx.beginPath();
ctx.arc(node.x, node.y, 2*node.val, 0, 2 * Math.PI, false);
ctx.fill();
if (node === selection || node === rightSelection) {
ctx.strokeStyle = 'black';
ctx.lineWidth = 2;
ctx.stroke();
}
if (! (node.stateData && node.stateData.abbreviation)) return;