spacing static method

double spacing(
  1. GridOptions grid, {
  2. required DiagramRect visibleBounds,
  3. required double zoom,
})

Snap step for grid over a viewport: the finest visible grid layer while the grid is shown (hidden subdivisions never capture a point), otherwise the configured grid size.

Implementation

static double spacing(
  GridOptions grid, {
  required DiagramRect visibleBounds,
  required double zoom,
}) => grid.visible
    ? diagramVisibleGridSpacing(
            pattern: grid.pattern,
            bounds: visibleBounds,
            gridSize: grid.effectiveSize,
            zoom: zoom,
          ) *
          grid.pattern.layers
              .map((layer) => layer.spacingMultiple)
              .reduce(math.min)
    : grid.effectiveSize;