Minimum hit-target sizing for one pointer type. More...
#include <hit_metrics.hpp>
Public Member Functions | |
| constexpr float | effective_target_pt () const noexcept |
| Effective target extent in points, resolving 0 to the type default. | |
| constexpr float | tolerance_px (float pixels_per_point=1.0f) const noexcept |
| One-sided tolerance in pixels for a distance-from-anchor hit test. | |
Static Public Member Functions | |
| static constexpr float | default_min_target_pt (PointerType type) noexcept |
| Minimum comfortable target extent for a pointer type, in points. | |
| static constexpr HitMetrics | for_pointer (PointerType type) noexcept |
| Metrics carrying this pointer type's default target extent. | |
Public Attributes | |
| PointerType | pointer_type = PointerType::mouse |
| float | min_target_pt = 0.0f |
| Full minimum target extent in points. Zero selects the per-type default. | |
Minimum hit-target sizing for one pointer type.
A 44pt touch target and a 4px mouse target are the SAME hit test evaluated with different metrics, not two hit tests with two code paths. Callers that used to hard-code a tolerance_px now carry a HitMetrics and project it, so widening touch targets never means duplicating the geometry.
min_target_pt is the full edge length the target must present to this pointer type. Hit tests measure distance from a target's anchor, so the usable tolerance is half that extent on each side: a mouse asking for an 8pt target accepts anything within 4px on a 1x surface, which is the value the waveform handle hit test carried literally before this existed.
|
inlinestaticconstexprnoexcept |
Minimum comfortable target extent for a pointer type, in points.
Touch uses the 44pt figure Apple's HIG specifies for finger targets. Pen sits between the two: more precise than a finger, less than a cursor.
|
inlinenodiscardconstexprnoexcept |
Effective target extent in points, resolving 0 to the type default.
|
inlinestaticconstexprnoexcept |
Metrics carrying this pointer type's default target extent.
|
inlinenodiscardconstexprnoexcept |
One-sided tolerance in pixels for a distance-from-anchor hit test.
pixels_per_point converts the point-space target to the surface's pixel space; it is 1.0 on a 1x surface, where the mouse default yields 4px.
| float pulp::view::HitMetrics::min_target_pt = 0.0f |
Full minimum target extent in points. Zero selects the per-type default.
| PointerType pulp::view::HitMetrics::pointer_type = PointerType::mouse |