Skip to content

feat(tap): add tap gesture recognition with multi-tap support#13

Merged
devjaewon merged 7 commits into
mainfrom
feat/tap
Jan 6, 2026
Merged

feat(tap): add tap gesture recognition with multi-tap support#13
devjaewon merged 7 commits into
mainfrom
feat/tap

Conversation

@devjaewon

Copy link
Copy Markdown
Owner

Summary

  • Add new @cereb/tap package for tap gesture recognition
  • Support multi-tap detection (single, double, triple taps, etc.)
  • Add double-tap zoom gesture to space adventure example

Features

Operators

  • tapRecognizer() - Full lifecycle operator emitting start, end, and cancel phases
  • tapEndOnly() - Simplified operator that only emits successful tap events
  • tap() - Convenience function that creates a tap stream from an element

Configuration Options

Option Default Description
movementThreshold 10px Max movement allowed during tap
durationThreshold 500ms Max duration for a valid tap
chainMovementThreshold movementThreshold Max distance between consecutive taps
chainIntervalThreshold durationThreshold / 2 Max interval between consecutive taps

TapSignal Value

  • phase: Tap lifecycle phase (start, end, cancel)
  • x, y: Client coordinates
  • pageX, pageY: Page coordinates
  • tapCount: Consecutive tap count (1=single, 2=double, etc.)
  • duration: How long the pointer was pressed (ms)
  • pointerType: Type of pointer (mouse, touch, pen)

Usage Example

import { tap } from "@cereb/tap";

tap(element, { chainIntervalThreshold: 300 })
  .on((signal) => {
    if (signal.value.tapCount === 2) {
      console.log("Double tap detected!");
    }
  });

devphilip21 added 3 commits December 31, 2025 12:43
…yles

- Add position: relative to .container for proper positioning context
- Constrain container width with max-width and center with margin: auto
- Remove duplicate .container style rule from layout.css
- Implement TapRecognizer for detecting single/multi-tap gestures
- Add tapRecognizer and tapEndOnly operators for stream integration
- Support double-tap, triple-tap detection with configurable thresholds
- Include comprehensive test coverage for recognizer, state, and geometry
- Add TypeScript configuration and build tooling
- Integrate tap gesture recognition with zoom operator
- Enable 2.5x zoom multiplier on double-tap, with smart reset near max scale
- Update tip text to indicate double-tap as zoom option
@devjaewon devjaewon self-assigned this Jan 4, 2026
devphilip21 added 4 commits January 4, 2026 21:47
- Add .npmignore to exclude source maps from npm package
- Add MIT license for @cereb/tap package
- Add comprehensive README with API documentation
- Update .gitignore to exclude tmp_docs directory
- Add comprehensive tap API documentation with examples
- Include multi-tap configuration and chaining behavior
- Add sidebar entry for tap gesture documentation
…ignal types

- Define PanSourceSignal, PinchSourceSignal, TapSourceSignal interfaces for recognizers
- Update panRecognizer, pinchRecognizer, tapRecognizer operators to accept generic signals
- Export source signal types for custom integrations (low-level API)
- Update documentation and README with low-level recognizer usage examples
@devjaewon
devjaewon merged commit 9ebf514 into main Jan 6, 2026
2 checks passed
@devjaewon
devjaewon deleted the feat/tap branch January 6, 2026 10:55
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