Snap guide policy
Loading interactive example…Open in new tab ↗
Choose Sides and centers, Sides only, or Centers only, then move a card beside the other. Sides use the left, right, top and bottom of resolved bounds; centers use their horizontal and vertical midpoints.
The candidate menu compares limits of 8 and 24 nearby shapes. The spatial index finds shapes intersecting the viewport, then the nearest candidates are ranked and limited before alignment comparisons. A smaller limit reduces comparisons but may skip a useful alignment. It does not cap the spatial query or its ranking cost.
The visible viewport defines the candidate pool. Zooming out includes more world space and potentially more candidates; panning changes the pool. The snap tolerance stays at 6 screen pixels as you zoom. The candidate cap defaults to 24; the API accepts 1–256. Policy changes preserve other settings and do not enter document undo history.
See Snap guides, grid snapping, and configuration.
Guide appearance is configured with DiagramSnapGuidesExtension(color: const Color(0xFF5260FF)). You can supply any Flutter color. The example controls preserve the configured color when changing policy or toggling guides.