use-touch-target 0.0.1

Primitive touch and click target size helpers
Documentation
  • Coverage
  • 8.33%
    1 out of 12 items documented1 out of 10 items with examples
  • Size
  • Source code size: 5.13 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 382.85 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 36s Average build duration of successful builds.
  • all releases: 36s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-accessibility
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

Primitive touch and click target size helpers.

These helpers use a practical 44px minimum dimension for recommended target sizing.

Examples

use use_touch_target::{
    TouchTarget, is_touch_target_recommended, minimum_touch_target_px, touch_target_area,
};

let target = TouchTarget::new(48.0, 44.0).unwrap();

assert_eq!(minimum_touch_target_px(), 44.0);
assert_eq!(target.area_px(), 2_112.0);
assert_eq!(target.min_dimension_px(), 44.0);
assert!(target.is_recommended_size());
assert!(is_touch_target_recommended(48.0, 44.0).unwrap());
assert_eq!(touch_target_area(48.0, 44.0).unwrap(), 2_112.0);