Skip to content

feat: long-press recognizer with duration timer and longpressup - #3

Merged
akoreh merged 3 commits into
mainfrom
feature/longpress
Apr 2, 2026
Merged

feat: long-press recognizer with duration timer and longpressup#3
akoreh merged 3 commits into
mainfrom
feature/longpress

Conversation

@akoreh

@akoreh akoreh commented Apr 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • LongPressRecognizer: timer-based recognition firing while pointer is still down
  • Emits longpress on timer fire and longpressup on subsequent pointer-up
  • Configurable duration (default 500ms) and movement threshold (default 10px)
  • Uses Date.now() for duration tracking (timer callbacks have no PointerEvent)
  • Convenience longPress() function with callback and options forms
  • CustomEvent dispatch (fngr:longpress, fngr:longpressup)

Test plan

  • npm test — 278 unit tests pass
  • npm run test:e2e — Playwright tests pass on chromium/firefox/webkit
  • npm run build — tsup builds cleanly
  • npm run lint — no ESLint errors
  • npm run test:mutate — Stryker score above 85%

akoreh added 3 commits April 2, 2026 20:01
- Add pointer ID guard to onPointerCancel (foreign pointer no longer aborts gesture)
- Add JSDoc to LongPressRecognizer, longPress(), LongPressEvent, LongPressOptions
- Fix test name "fails on movement at exactly threshold boundary" → does not fail
- Fix test name "srcEvent is the pointerdown event" → last pointer event before recognition
- Disambiguate Recognized→Idle cancel path in docs (silent reset, no longpressup)
- Fix contributing.md template: PointerTracker is optional, not required for all recognizers
@akoreh
akoreh merged commit 3a8d221 into main Apr 2, 2026
5 checks passed
@akoreh
akoreh deleted the feature/longpress branch April 3, 2026 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant