55 Step feed(
float dx,
float dy, std::uint64_t timestamp_ns);
61 void suppress(std::uint64_t timestamp_ns);
70 [[nodiscard]]
float progress(std::uint64_t now_ns)
const;
84 [[nodiscard]]
bool expired(std::uint64_t now_ns)
const;
Recognises a two-finger sideways swipe from wheel samples.
Definition swipe_gesture.h:42
Phase phase
Definition swipe_gesture.h:87
SwipeGesture(const SwipeTuning &settings)
Definition swipe_gesture.h:52
std::uint64_t last_ns
Definition swipe_gesture.h:90
SwipeTuning tuning
Definition swipe_gesture.h:86
Step feed(float dx, float dy, std::uint64_t timestamp_ns)
Adds a wheel sample; returns the step it completes, if any.
Definition swipe_gesture.cpp:20
float progress(std::uint64_t now_ns) const
How far the gesture has gone at now_ns: 0 when none, up to 1 towards Back and down to -1 towards Forw...
Definition swipe_gesture.cpp:68
void reset()
Forgets the gesture in progress.
Definition swipe_gesture.cpp:59
Step
Definition swipe_gesture.h:45
const SwipeTuning & getTuning() const
Definition swipe_gesture.h:72
void suppress(std::uint64_t timestamp_ns)
Ignores the rest of the current gesture, e.g. while it runs over a list that scrolls sideways or whil...
Definition swipe_gesture.cpp:51
Phase
Definition swipe_gesture.h:76
float travel_x
Definition swipe_gesture.h:88
bool expired(std::uint64_t now_ns) const
Definition swipe_gesture.cpp:14
float travel_y
Definition swipe_gesture.h:89
Thresholds of the sideways swipe, in mouse-wheel units.
Definition swipe_gesture.h:21
float dominance
Definition swipe_gesture.h:27
float threshold
Definition swipe_gesture.h:23
float slop
Definition swipe_gesture.h:25
std::uint64_t idle_ns
Definition swipe_gesture.h:29