LivePanels.Canvas.Geometry (livepanels v0.1.0)

Copy Markdown View Source

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()
360

Coercion

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

canvas_min_height()

@spec canvas_min_height() :: pos_integer()

Returns the baseline canvas height used before viewport measurement.

canvas_min_width()

@spec canvas_min_width() :: pos_integer()

Returns the baseline canvas width used before viewport measurement.

default_ad_hoc_item_height()

@spec default_ad_hoc_item_height() :: pos_integer()

Returns the default height for ad-hoc item frames.

default_ad_hoc_item_width()

@spec default_ad_hoc_item_width() :: pos_integer()

Returns the default width for ad-hoc item frames.

default_item_frame_height()

@spec default_item_frame_height() :: pos_integer()

Returns the default height for content-backed item frames.

default_item_frame_width()

@spec default_item_frame_width() :: pos_integer()

Returns the default width for content-backed item frames.

edge_threshold()

@spec edge_threshold() :: pos_integer()

Returns the edge threshold used by connector and autoscroll interactions.

interaction_sync_ms(arg1)

@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.

max_autopan_step()

@spec max_autopan_step() :: pos_integer()

Returns the maximum autopan step per interaction tick.

max_frame_height(arg1)

@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.

max_frame_width(arg1)

@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.

max_item_frame_height()

@spec max_item_frame_height() :: pos_integer()

Returns the upper bound for item frame height.

max_item_frame_width()

@spec max_item_frame_width() :: pos_integer()

Returns the upper bound for item frame width.

min_frame_height(arg1)

@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.

min_frame_width(arg1)

@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.

min_item_frame_height()

@spec min_item_frame_height() :: pos_integer()

Returns the lower bound for item frame height.

min_item_frame_width()

@spec min_item_frame_width() :: pos_integer()

Returns the lower bound for item frame width.

nudge_debounce_ms()

@spec nudge_debounce_ms() :: pos_integer()

Returns the debounce window for keyboard nudging in milliseconds.

snap_grid()

@spec snap_grid() :: pos_integer()

Returns the grid interval used by canvas nudging and snapping.

viewport_snap_threshold()

@spec viewport_snap_threshold() :: pos_integer()

Returns the viewport anchoring snap threshold.