LivePanels.Graph.Bounds (livepanels v0.1.0)

Copy Markdown View Source

Headless graph bounds helpers for viewport fitting and application controls.

Summary

Functions

Returns the world-space bounds for graph-participating items.

Returns the world-space bounds for a graph selection.

Types

selection()

@type selection() :: LivePanels.Canvas.Selection.t()

viewport_target()

@type viewport_target() :: %{
  left: number(),
  top: number(),
  width: number(),
  height: number(),
  right: number(),
  bottom: number()
}

Functions

bounds(state, opts \\ [])

@spec bounds(
  LivePanels.Canvas.State.t(),
  keyword()
) :: viewport_target() | nil

Returns the world-space bounds for graph-participating items.

selection_bounds(state, selection_or_client_id, opts \\ [])

@spec selection_bounds(
  LivePanels.Canvas.State.t(),
  selection() | map() | String.t(),
  keyword()
) ::
  viewport_target() | nil

Returns the world-space bounds for a graph selection.