All gesture thresholds are defined in js/core/constants.js and can be easily tuned based on physical device testing.
// Long Press
export const LONG_PRESS_DURATION_MS = 600; // Time to hold before triggering reset
// Double Tap
export const DOUBLE_TAP_MAX_DELAY_MS = 350; // Max time between taps
export const DOUBLE_TAP_MAX_DISTANCE_PX = 20; // Max distance between taps
// Pinch
export const PINCH_MIN_DISTANCE_CHANGE_PX = 30; // Min finger distance change to trigger
// Swipe
export const SWIPE_MIN_DISTANCE = 60; // Min swipe distance to register as gesture| Gesture | Action | Threshold |
|---|---|---|
| Double Tap | Cycle theme | 2 taps within 350ms, <20px apart |
| Long Press | Reset to defaults | Hold for 600ms |
| Pinch | Randomize everything | Finger distance change >30px |
| Swipe Horizontal | Cycle theme | Swipe >60px horizontally |
| Swipe Vertical | Randomize | Swipe >60px vertically |
- Too short (<400ms): Accidental triggers during normal taps
- Too long (>800ms): Feels unresponsive, users give up
- Current (600ms): Balance between precision and responsiveness
- Recommended range: 500-700ms
- Too short (<250ms): Hard to achieve consistently
- Too long (>500ms): Conflicts with single tap actions
- Current (350ms): iOS/Android standard
- Recommended range: 300-400ms
- Too small (<15px): Difficult on small screens
- Too large (>30px): False positives from drag attempts
- Current (20px): Standard touch target tolerance
- Recommended range: 18-25px
- Too small (<20px): Triggers during hand tremor
- Too large (>50px): Requires exaggerated gesture
- Current (30px): Natural pinch motion
- Recommended range: 25-40px
- Too short (<40px): Conflicts with scroll/drag
- Too long (>100px): Tiring on small screens
- Current (60px): Deliberate but easy gesture
- Recommended range: 50-80px
When adjusting thresholds, test on:
- Large phone (6.5"+)
- Standard phone (5.5-6.5")
- Small phone (<5.5")
- Tablet (7"+)
- Tablet (10"+)
- One-handed use
- Two-handed use
- While walking
- With gloves (winter)
- With screen protector
- In bright sunlight (less precise taps)
- Motor impairment simulation
- Tremor simulation (increase thresholds)
- Limited dexterity (larger tap tolerance)
Solution: Increase DOUBLE_TAP_MAX_DISTANCE_PX or decrease DOUBLE_TAP_MAX_DELAY_MS
Solution: Already handled - long press cancels on move
Solution: Increase PINCH_MIN_DISTANCE_CHANGE_PX
Solution: Increase SWIPE_MIN_DISTANCE
Solution: Decrease all distance thresholds by ~20%
- Device-specific profiles (phone vs tablet)
- User preference settings UI
- Adaptive thresholds based on usage patterns
- Gesture training/tutorial on first use
- Analytics to track false positive rates
To quickly adjust for your device:
// js/core/constants.js
// For smaller devices, make gestures more forgiving:
export const DOUBLE_TAP_MAX_DISTANCE_PX = 25; // was 20
export const SWIPE_MIN_DISTANCE = 50; // was 60
// For larger devices, tighten precision:
export const DOUBLE_TAP_MAX_DISTANCE_PX = 15; // was 20
export const LONG_PRESS_DURATION_MS = 550; // was 600If implementing analytics:
- Metric: Gesture success rate
- Track: Attempts vs successful triggers
- Goal: >90% success rate, <5% false positives
- Test variants: ±20% threshold adjustments
- Sample size: 100+ users per variant