Politur: nodePointerAreaPaint fuer pixelgenaues Hovern und Klicken im Graphen implementiert

This commit is contained in:
Hitonabi
2026-07-09 12:37:58 +02:00
parent 64f45ed0ff
commit 103b277643
4 changed files with 18 additions and 12 deletions
+9 -3
View File
@@ -154,9 +154,15 @@ export function GraphView({ data, selectedNodeId, onNodeSelect }: {
backgroundColor="rgba(0,0,0,0)"
cooldownTicks={120}
// Hit-Detection an die gezeichnete Knotengröße anpassen
nodeVal={(node: any) => {
return 6 + Math.min(degree[node.id] || 0, 15) * 0.8
// Exakte Hit-Map auf unsichtbarem Canvas zeichnen für 100% zuverlässiges Hovern und Klicken
nodePointerAreaPaint={(node: any, color: string, ctx: CanvasRenderingContext2D) => {
const x = node.x ?? 0
const y = node.y ?? 0
const size = 6 + Math.min(degree[node.id] || 0, 15) * 0.8
ctx.fillStyle = color
ctx.beginPath()
ctx.arc(x, y, size + 5, 0, 2 * Math.PI, false) // 5px Puffer für einfaches Treffen
ctx.fill()
}}
// Hover- und Klick-Logik