Canvas-domain spatial geometry utilities for LivePanels.
Provides dimension constants, coercion helpers, and normalization functions
used throughout the runtime. Applications can reference the constants
when building custom add controls or validating item-frame dimensions before
calling LivePanels.Canvas.Item.add/3.
Constants
The boundary values exposed here are the same ones the JS runtime enforces client-side. Keeping them in sync via these functions avoids hardcoded magic numbers in application code:
iex> LivePanels.Canvas.Geometry.min_item_frame_width()
360Coercion
Runtime boundary modules use the coercion helpers here when processing JS events, which send geometry values as strings.
Summary
Functions
Returns the baseline canvas height used before viewport measurement.
Returns the baseline canvas width used before viewport measurement.
Returns the default height for ad-hoc item frames.
Returns the default width for ad-hoc item frames.
Returns the default height for content-backed item frames.
Returns the default width for content-backed item frames.
Returns the edge threshold used by connector and autoscroll interactions.
Returns the browser-to-server interaction throttle in milliseconds.
Returns the maximum autopan step per interaction tick.
Returns the effective max frame height for an item.
Returns the effective max frame width for an item.
Returns the upper bound for item frame height.
Returns the upper bound for item frame width.
Returns the effective min frame height for an item.
Returns the effective min frame width for an item.
Returns the lower bound for item frame height.
Returns the lower bound for item frame width.
Returns the debounce window for keyboard nudging in milliseconds.
Returns the grid interval used by canvas nudging and snapping.
Returns the viewport anchoring snap threshold.
Functions
@spec canvas_min_height() :: pos_integer()
Returns the baseline canvas height used before viewport measurement.
@spec canvas_min_width() :: pos_integer()
Returns the baseline canvas width used before viewport measurement.
@spec default_ad_hoc_item_height() :: pos_integer()
Returns the default height for ad-hoc item frames.
@spec default_ad_hoc_item_width() :: pos_integer()
Returns the default width for ad-hoc item frames.
@spec default_item_frame_height() :: pos_integer()
Returns the default height for content-backed item frames.
@spec default_item_frame_width() :: pos_integer()
Returns the default width for content-backed item frames.
@spec edge_threshold() :: pos_integer()
Returns the edge threshold used by connector and autoscroll interactions.
@spec interaction_sync_ms(:local | :shared | term()) :: pos_integer()
Returns the browser-to-server interaction throttle in milliseconds.
The bundled JS runtime uses this value to coalesce drag and resize updates
before they hit the server. Shared canvases use a lower default network
cadence while the browser continues moving the active item locally at
pointer-event speed. Shared canvases may also apply
:interaction_broadcast_sync_ms for server-to-participant fanout.
@spec max_autopan_step() :: pos_integer()
Returns the maximum autopan step per interaction tick.
@spec max_frame_height(LivePanels.Item.t() | map()) :: pos_integer()
Returns the effective max frame height for an item.
Mirrors max_frame_width/1 against the :max_h resize constraint and
max_item_frame_height/0 global cap.
@spec max_frame_width(LivePanels.Item.t() | map()) :: pos_integer()
Returns the effective max frame width for an item.
An item without :resize capability is pinned at its current width.
A resizable item with a :max_w constraint clamps to that constraint; with
no constraint, the global max_item_frame_width/0 cap applies.
@spec max_item_frame_height() :: pos_integer()
Returns the upper bound for item frame height.
@spec max_item_frame_width() :: pos_integer()
Returns the upper bound for item frame width.
@spec min_frame_height(LivePanels.Item.t() | map()) :: pos_integer()
Returns the effective min frame height for an item.
Mirrors min_frame_width/1 against the :min_h resize constraint and the
global min_item_frame_height/0 fallback.
@spec min_frame_width(LivePanels.Item.t() | map()) :: pos_integer()
Returns the effective min frame width for an item.
A resizable item with a :min_w constraint clamps to that item-specific
constraint. With no item constraint, the global min_item_frame_width/0
fallback applies.
@spec min_item_frame_height() :: pos_integer()
Returns the lower bound for item frame height.
@spec min_item_frame_width() :: pos_integer()
Returns the lower bound for item frame width.
@spec nudge_debounce_ms() :: pos_integer()
Returns the debounce window for keyboard nudging in milliseconds.
@spec snap_grid() :: pos_integer()
Returns the grid interval used by canvas nudging and snapping.
@spec viewport_snap_threshold() :: pos_integer()
Returns the viewport anchoring snap threshold.