Place brain neurons on whole pixels
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user