Phosphor::TouchEvent
Inherits Phosphor::Event < Reference < Object
A touch action (press, drag, or lift) received from the terminal.
Terminal touch input arrives over the same SGR mouse protocol as
MouseEvent — see .from_sgr? for how the two are told apart on the
wire. x and y are 0-based, matching Frame coordinates. id
identifies one touch point for multi-touch tracking; always 0 for
single-touch input or a mouse standing in for touch. zone_id is nil
on every raw TouchEvent — View#dispatch_touch sets it to the matched
Zone#id before calling Widget#on_event, so widgets can pattern-match
on the semantic zone name instead of resolving coordinates themselves.
Constructors
Class methods
Parses an SGR extended mouse sequence into a TouchEvent, or returns
nil if bytes isn't a touch-shaped report — every other SGR report
(any button besides 0, any motion besides button 0's, and both wheel
directions) is left for MouseEvent.from_sgr? to parse instead. See
StdinPort#poll, which tries this first for that reason.
Cx/Cy are 1-based in the wire format; subtracted by 1 here so the
resulting TouchEvent#x/#y are 0-based, matching Frame coordinates.