Search documentation of Plushie

# Plushie.Type.Pointer (Plushie v0.7.2)

Copy Markdown View Source

Event field types for unified pointer events.

Provides pointer type and button parsing for the unified pointer event model that replaces the old canvas*/mouse/sensor_ event families.

## Pointer types

- `:mouse` - standard mouse input
- `:touch` - touchscreen finger
- `:pen` - stylus or pen tablet

## Buttons

- `:left`, `:right`, `:middle` - standard three-button mouse
- `:back`, `:forward` - extended navigation buttons

## Examples

    iex> Plushie.Type.Pointer.parse_pointer("mouse")
    {:ok, :mouse}

    iex> Plushie.Type.Pointer.parse_button("right")
    {:ok, :right}

## Summary

### Types

button()
pointer_type()

### Functions

parse(value)
parse_button(value)

Parses a wire-format button string into an atom.

parse_pointer(value)

Parses a wire-format pointer type string into an atom.

## Types

# button()

    @type button() :: :left | :right | :middle | :back | :forward

# pointer_type()

    @type pointer_type() :: :mouse | :touch | :pen

## Functions

# parse(value)

    @spec parse(value :: term()) :: {:ok, pointer_type()} | :error

# parse_button(value)

    @spec parse_button(value :: term()) :: {:ok, button()} | :error

Parses a wire-format button string into an atom.

Returns `{:ok, button}` or `:error`. Defaults to `:left` when nil (press/release events without an explicit button are left clicks).

# parse_pointer(value)

    @spec parse_pointer(value :: term()) :: {:ok, pointer_type()} | :error

Parses a wire-format pointer type string into an atom.

Returns `{:ok, pointer_type}` or `:error`.