Expand description
Press primitive: long-press detection + double-click recognizer.
Both signals are derived from existing low-level state:
- Long-press = entity carrying
Pressedcontinuously for more thanlong_press_threshold(default 500 ms). FiresLongPressEventonce per press cycle. The markerPressStartedAtis auto-attached onPressedinsertion and removed onPressedremoval so a fresh press always starts a fresh timer. - Double-click = two consecutive
ClickEvents on the same entity withindouble_click_threshold(default 300 ms). Tracked in theLastClickresource.
Apps consume LongPressEvent / DoubleClickEvent just like any
other Message - MessageReader<LongPressEvent> / MessageReader<DoubleClickEvent>.
Structs§
- Last
Click - Last accepted click - drives the double-click detector.
- Press
Config - Tunables. Re-read every frame so apps can mutate at runtime.
- Press
Plugin - Plugin: registers press-recognizer systems.
- Press
Started At - Auto-attached to every entity the moment it acquires
Pressed. Carries theInstantthe press began. Removed once the entity releases. Also marks whether aLongPressEventhas already fired for this press cycle so we don’t spam.
Constants§
- DEFAULT_
DOUBLE_ CLICK_ MS - Default double-click window. Matches GTK / Windows defaults (~300ms).
- DEFAULT_
LONG_ PRESS_ MS - Default long-press threshold. Matches the W3C touch UI guideline.
- DOUBLE_
CLICK_ RADIUS_ PX - Maximum pointer travel between two clicks for them to still count as a double-click. Matches the GTK / Qt double-click slop (~5px): two clicks at opposite corners of one large entity are two singles, not a double.
Functions§
- attach_
press_ timer - Maintain
PressStartedAt: attach on first frame an entity carriesPressedwithout a timer, remove whenPresseddisappears. - detect_
double_ click - Detect double-click by tracking the last-seen
ClickEventtarget + time. Two clicks on the same entity withincfg.double_clickfire aDoubleClickEvent; the cache resets so a third click within the window is a new first click. - detect_
long_ press - Emit
LongPressEventfor entities pressed past the threshold. Once per press cycle (gated byPressStartedAt::long_fired).