Plushie.Event.KeyEvent (Plushie v0.6.0)

Copy Markdown View Source

Keyboard press and release events.

Pattern matching

def update(model, %KeyEvent{type: :press, key: :escape, captured: false}), do: ...
def update(model, %KeyEvent{type: :press, key: "s", modifiers: %{command: true}}), do: ...

Summary

Types

key()

@type key() :: atom() | String.t()

location()

@type location() :: :standard | :left | :right | :numpad

t()

@type t() :: %Plushie.Event.KeyEvent{
  captured: boolean(),
  key: key(),
  location: location(),
  modified_key: key() | nil,
  modifiers: Plushie.KeyModifiers.t(),
  physical_key: key() | nil,
  repeat: boolean(),
  text: String.t() | nil,
  type: :press | :release,
  window_id: String.t() | nil
}