Boxart.Layout.Placement (Boxart v0.3.1)

Copy Markdown View Source

Node placement and sizing for the layout engine.

Handles placing nodes on the grid, computing column widths and row heights based on label content, and normalizing sizes within layers.

Summary

Functions

Compute column widths and row heights based on node content.

Normalize node dimensions within the same layer, capped at a maximum.

Place nodes on the grid based on layer assignments.

Functions

compute_sizes(layout, graph, padding_x, padding_y, gap, opts \\ [])

@spec compute_sizes(
  Boxart.Layout.t(),
  Boxart.Graph.t(),
  integer(),
  integer(),
  integer(),
  keyword()
) ::
  Boxart.Layout.t()

Compute column widths and row heights based on node content.

normalize_sizes(layout, graph)

@spec normalize_sizes(Boxart.Layout.t(), Boxart.Graph.t()) :: Boxart.Layout.t()

Normalize node dimensions within the same layer, capped at a maximum.

Nodes at the same flow level are normalized to the same perpendicular dimension so side-by-side nodes look consistent.

place_nodes(layout, graph, layer_order, direction, gap_expansions \\ %{})

@spec place_nodes(Boxart.Layout.t(), Boxart.Graph.t(), [[String.t()]], atom(), %{
  required(non_neg_integer()) => non_neg_integer()
}) :: Boxart.Layout.t()

Place nodes on the grid based on layer assignments.

gap_expansions maps gap index to the number of extra grid cells to insert between that gap's adjacent layers, giving the pathfinder more room to route crossing edges without overlap.