From f6349b83dbbd15f7ee0a19d10f4e94f387d69409 Mon Sep 17 00:00:00 2001 From: stroblme Date: Thu, 27 Aug 2026 16:15:39 +0200 Subject: [PATCH] Place brain neurons on whole pixels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The force simulation settles on arbitrary floats, and a neuron on a half pixel has its ring, its gap and its disc rounded one edge at a time — which on the smallest ones is a visibly off-centre ring. The size is already whole, so the position was the last fractional term. Co-Authored-By: Claude Opus 5 (1M context) --- frontend/src/components/Flow/BrainView.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/Flow/BrainView.tsx b/frontend/src/components/Flow/BrainView.tsx index 7af7b6f..31c61c0 100644 --- a/frontend/src/components/Flow/BrainView.tsx +++ b/frontend/src/components/Flow/BrainView.tsx @@ -124,9 +124,14 @@ function build(graph: BrainGraph): { nodes: Node[]; edges: Edge[] } { id: node.id, type: "brain", // React Flow places by the top-left corner; the layout means centres. + // Rounded, because the force simulation settles on arbitrary floats and + // a neuron on a half pixel has its ring, its gap and its disc rounded + // one edge at a time — which on the smallest ones is a visibly + // off-centre ring. `size` is already whole, so this is the last + // fractional term. position: { - x: (node.x ?? 0) - node.size / 2, - y: (node.y ?? 0) - node.size / 2, + x: Math.round((node.x ?? 0) - node.size / 2), + y: Math.round((node.y ?? 0) - node.size / 2), }, data: { label: source.label,