Plushie.Canvas.Group (Plushie v0.7.2)

Copy Markdown View Source

Canvas group: a structural container for transforms, clips, and visual grouping.

Groups carry an ordered transforms list and an optional clip rect. The optional id is for tree diffing and targeting, not interactivity.

For interactive canvas elements (click, hover, drag, focus, a11y), use Plushie.Canvas.Interactive via the interactive macro.

Summary

Functions

Converts this widget struct to a ui_node() map.

Clip rectangle for the group.

Appends multiple children to the widget.

Creates a new element without an explicit ID (auto-assigned by parent container).

Creates a new element with the given ID and keyword options.

Appends a child to the widget.

List of transform descriptors (translate, rotate, scale).

Returns the element type string for the wire protocol.

Applies keyword options to an existing widget struct.

Types

option()

@type option() :: {:transforms, term()} | {:clip, term()}

t()

Functions

build(widget)

@spec build(widget :: t()) :: Plushie.Widget.ui_node()

Converts this widget struct to a ui_node() map.

clip(widget, descriptor)

@spec clip(widget :: t(), value :: term() | nil) :: t()

Clip rectangle for the group.

Accepts term().

extend(widget, children)

@spec extend(widget :: t(), children :: [Plushie.Widget.child()]) :: t()

Appends multiple children to the widget.

new(id)

@spec new(opts :: [option()]) :: t()

Creates a new element without an explicit ID (auto-assigned by parent container).

new(id, opts)

@spec new(id :: String.t(), opts :: [option()]) :: t()

Creates a new element with the given ID and keyword options.

push(widget, child)

@spec push(widget :: t(), child :: Plushie.Widget.child()) :: t()

Appends a child to the widget.

transforms(widget, descriptor)

@spec transforms(widget :: t(), value :: term() | nil) :: t()

List of transform descriptors (translate, rotate, scale).

Accepts term().

type_name()

@spec type_name() :: String.t()

Returns the element type string for the wire protocol.

with_options(widget, opts)

@spec with_options(widget :: t(), opts :: [option()]) :: t()

Applies keyword options to an existing widget struct.