SetData computes the layout immediately and sets a needsCenter flag — the viewport centers on the first draw when terminal dimensions are available. Use SetFit(true) to center on the bounding box of all nodes instead of the focused node.
NodeGraph is a 2D node graph visualization component.
SetData sets the graph data and triggers layout computation. The viewport
centers on the first draw after this call — on FocusID if set, or on the
bounding box of all nodes if SetFit(true) was called.
SetFit
func (g *NodeGraph) SetFit(fit bool) *NodeGraph
SetFit controls the initial viewport centering strategy. When true, the
viewport centers on the bounding box of all nodes. When false (default),
it centers on NodeGraphData.FocusID instead.