Tuix.Runtime.Click (tuix v0.1.5)

Copy Markdown View Source

Synthesizes :click events from raw press/release pairs.

The runtime threads the pressed-button state through track/2 for every mouse event it delivers: a :press records {button, target}, and a :release on the same target completes the click — a %Tuix.Event.Mouse{kind: :click} delivered after the release event itself. Releasing over a different target cancels the click; drags in between do not (terminal cells are coarse, and this matches the browser model).

X10-encoded releases do not report which button went up (button: nil); they complete the click for whatever button is tracked, and the synthesized event carries the pressed button.

Summary

Types

The tracked press: {button, target}, or nil when no button is down.

Functions

Threads a mouse event through the click tracker.

Types

pressed()

@type pressed() :: {Tuix.Event.Mouse.button(), term() | nil} | nil

The tracked press: {button, target}, or nil when no button is down.

Functions

track(pressed, event)

@spec track(pressed(), Tuix.Event.Mouse.t()) ::
  {pressed(), Tuix.Event.Mouse.t() | nil}

Threads a mouse event through the click tracker.

Returns {pressed, click} — the updated tracking state and the synthesized :click event (or nil).