Cleanup tooltips

This commit is contained in:
William Jeynes
2026-04-24 17:14:06 +01:00
parent 2deb454c23
commit 8fcba8d775
+11 -1
View File
@@ -239,9 +239,10 @@ export function App2() {
highlightedNodeIds.has(sourceId) && highlightedNodeIds.has(sourceId) &&
highlightedNodeIds.has(targetId); highlightedNodeIds.has(targetId);
return bothHighlighted ? "orange" : "white"; return bothHighlighted ? "orange" : "rgba(0,0,0,0)";
}} }}
linkWidth={2.5} linkWidth={2.5}
onNodeClick={(node) => setSelectedNode(node)} onNodeClick={(node) => setSelectedNode(node)}
nodeCanvasObject={(node, ctx) => { nodeCanvasObject={(node, ctx) => {
const label = node.label; const label = node.label;
@@ -290,8 +291,17 @@ export function App2() {
node.__bckgPos = { x, y }; node.__bckgPos = { x, y };
}} }}
nodePointerAreaPaint={(node, color, ctx) => { nodePointerAreaPaint={(node, color, ctx) => {
let isHighlighted = false;
if (parsedInputDate && node.avgDate) {
const diffMonths = monthsDiff(parsedInputDate, node.avgDate);
isHighlighted = diffMonths <= 6;
}
if (!isHighlighted) return;
const dims = node.__bckgDimensions; const dims = node.__bckgDimensions;
const pos = node.__bckgPos; const pos = node.__bckgPos;
if (!dims || !pos) return; if (!dims || !pos) return;
ctx.fillStyle = color; ctx.fillStyle = color;