Pointer area, captures mouse events on child content.
Wraps child content and emits click events for various mouse buttons, hover enter/exit, cursor movement, scroll, and double-click events. Optionally sets the mouse cursor when hovering the area.
Props
| Name | Type | Default | Description |
|---|---|---|---|
cursor | atom() | nil | Mouse cursor to show on hover (e.g. :pointer, :grab). |
on_press | String.t() | atom() | nil | Event tag for left mouse press events. |
on_release | String.t() | atom() | nil | Event tag for left mouse release events. |
on_right_press | boolean() | nil | Enable right mouse press events. |
on_right_release | boolean() | nil | Enable right mouse release events. |
on_middle_press | boolean() | nil | Enable middle mouse press events. |
on_middle_release | boolean() | nil | Enable middle mouse release events. |
on_double_click | boolean() | nil | Enable double-click events. |
on_enter | boolean() | nil | Enable cursor enter events. |
on_exit | boolean() | nil | Enable cursor exit events. |
on_move | boolean() | nil | Enable cursor move events. |
on_scroll | boolean() | nil | Enable scroll wheel events. |
event_rate | integer() | nil | Max events per second for coalescable events. |
a11y | %Plushie.Type.A11y{} | map() | keyword() | nil | Accessibility annotations. |
Summary
Functions
Accessibility annotations.
Converts this widget struct to a ui_node() map. Validates at most one child.
Mouse cursor to show on hover (e.g. :pointer, :grab).
Max events per second for coalescable events.
Appends multiple children to the widget.
Creates a new widget struct with the given ID and keyword options.
Enable double-click events.
Enable cursor enter events.
Enable cursor exit events.
Enable middle mouse press events.
Enable middle mouse release events.
Enable cursor move events.
Event tag for left mouse press events.
Event tag for left mouse release events.
Enable right mouse press events.
Enable right mouse release events.
Enable scroll wheel events.
Creates a :pointer_area widget.
Appends a child to the widget.
Applies keyword options to an existing widget struct.
Types
@type option() :: (((((((((((({:cursor, atom()} | {:on_press, String.t() | atom()}) | {:on_release, String.t() | atom()}) | {:on_right_press, boolean()}) | {:on_right_release, boolean()}) | {:on_middle_press, boolean()}) | {:on_middle_release, boolean()}) | {:on_double_click, boolean()}) | {:on_enter, boolean()}) | {:on_exit, boolean()}) | {:on_move, boolean()}) | {:on_scroll, boolean()}) | {:event_rate, integer()}) | {:a11y, %Plushie.Type.A11y{ active_descendant: term(), busy: term(), described_by: term(), description: term(), disabled: term(), error_message: term(), expanded: term(), has_popup: term(), hidden: term(), invalid: term(), label: term(), label_from: term(), labelled_by: term(), level: term(), live: term(), mnemonic: term(), modal: term(), orientation: term(), position_in_set: term(), radio_group: term(), read_only: term(), required: term(), role: term(), selected: term(), size_of_set: term(), toggled: term(), value: term() } | map() | keyword()}
@type t() :: %Plushie.Widget.PointerArea{ a11y: (%Plushie.Type.A11y{ active_descendant: term(), busy: term(), described_by: term(), description: term(), disabled: term(), error_message: term(), expanded: term(), has_popup: term(), hidden: term(), invalid: term(), label: term(), label_from: term(), labelled_by: term(), level: term(), live: term(), mnemonic: term(), modal: term(), orientation: term(), position_in_set: term(), radio_group: term(), read_only: term(), required: term(), role: term(), selected: term(), size_of_set: term(), toggled: term(), value: term() } | map() | keyword()) | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, children: [Plushie.Widget.ui_node()], cursor: atom() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, event_rate: integer() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, id: String.t(), on_double_click: boolean() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, on_enter: boolean() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, on_exit: boolean() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, on_middle_press: boolean() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, on_middle_release: boolean() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, on_move: boolean() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, on_press: (String.t() | atom()) | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, on_release: (String.t() | atom()) | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, on_right_press: boolean() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, on_right_release: boolean() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil, on_scroll: boolean() | Plushie.Animation.Transition.t() | Plushie.Animation.Spring.t() | Plushie.Animation.Sequence.t() | nil }
Functions
@spec a11y( widget :: t(), value :: (%Plushie.Type.A11y{ active_descendant: term(), busy: term(), described_by: term(), description: term(), disabled: term(), error_message: term(), expanded: term(), has_popup: term(), hidden: term(), invalid: term(), label: term(), label_from: term(), labelled_by: term(), level: term(), live: term(), mnemonic: term(), modal: term(), orientation: term(), position_in_set: term(), radio_group: term(), read_only: term(), required: term(), role: term(), selected: term(), size_of_set: term(), toggled: term(), value: term() } | map() | keyword()) | nil ) :: t()
Accessibility annotations.
Accepts %Plushie.Type.A11y{} | map() | keyword().
@spec build(widget :: t()) :: Plushie.Widget.ui_node()
Converts this widget struct to a ui_node() map. Validates at most one child.
Mouse cursor to show on hover (e.g. :pointer, :grab).
Accepts atom().
Max events per second for coalescable events.
Accepts integer().
@spec extend(widget :: t(), children :: [Plushie.Widget.child()]) :: t()
Appends multiple children to the widget.
Creates a new widget struct with the given ID and keyword options.
Enable double-click events.
Accepts boolean().
Enable cursor enter events.
Accepts boolean().
Enable cursor exit events.
Accepts boolean().
Enable middle mouse press events.
Accepts boolean().
Enable middle mouse release events.
Accepts boolean().
Enable cursor move events.
Accepts boolean().
Event tag for left mouse press events.
Accepts String.t() | atom().
Event tag for left mouse release events.
Accepts String.t() | atom().
Enable right mouse press events.
Accepts boolean().
Enable right mouse release events.
Accepts boolean().
Enable scroll wheel events.
Accepts boolean().
Creates a :pointer_area widget.
Shorthand for new/2. Import this macro to use the widget name
directly in view functions:
import Plushie.Widget.PointerArea, only: [pointer_area: 2]
pointer_area("my-id", prop: value)
@spec push(widget :: t(), child :: Plushie.Widget.child()) :: t()
Appends a child to the widget.
Applies keyword options to an existing widget struct.