Helpers for working with scrollable viewport metrics.
Implicit event payloads include an %Breeze.Viewport{} struct in the
"element" key.
Summary
Functions
Clamps a horizontal scroll offset to the viewport's valid range.
Clamps a vertical scroll offset to the viewport's valid range.
Returns the vertical scroll offset needed to reveal a range of rows.
Returns the vertical scroll offset needed to reveal a row.
Builds viewport metrics from a dimensions map.
Returns the largest valid horizontal scroll offset.
Returns the largest valid vertical scroll offset.
Types
@type t() :: %Breeze.Viewport{ content_height: non_neg_integer(), content_width: non_neg_integer() | nil, height: non_neg_integer(), left: integer(), top: integer(), viewport_height: non_neg_integer(), viewport_width: non_neg_integer() | nil, width: non_neg_integer() | nil }
Dimensions and scroll metrics for a rendered viewport.
Functions
@spec clamp_scroll_x(integer(), t() | map()) :: non_neg_integer()
Clamps a horizontal scroll offset to the viewport's valid range.
@spec clamp_scroll_y(integer(), t() | map()) :: non_neg_integer()
Clamps a vertical scroll offset to the viewport's valid range.
@spec ensure_range_visible(integer(), integer(), integer(), t() | map(), keyword()) :: non_neg_integer()
Returns the vertical scroll offset needed to reveal a range of rows.
Set :padding to keep additional rows visible above and below the range.
Returns the vertical scroll offset needed to reveal a row.
Builds viewport metrics from a dimensions map.
@spec max_scroll_x(t() | map()) :: non_neg_integer()
Returns the largest valid horizontal scroll offset.
@spec max_scroll_y(t() | map()) :: non_neg_integer()
Returns the largest valid vertical scroll offset.