pub struct Touch<F: Debug + Eq, const N: usize = 10> { /* private fields */ }Expand description
Touch gestures inducing slide, orbit, scale, and focus.
Implements Default and can be created with Touch::default(). Recognizes up to N fingers,
ten by default.
All methods except Self::fingers() must be invoked on matching events fired by your 3D
graphics library of choice.
Implementations§
Source§impl<F: Debug + Copy + Eq, const N: usize> Touch<F, N>
impl<F: Debug + Copy + Eq, const N: usize> Touch<F, N>
Sourcepub fn compute(
&mut self,
fid: F,
pos: Vec2,
mvs: usize,
) -> Option<(usize, Vec2, f32, f32)>
pub fn compute( &mut self, fid: F, pos: Vec2, mvs: usize, ) -> Option<(usize, Vec2, f32, f32)>
Computes centroid position, roll angle, and scale ratio from finger gestures.
Parameters are:
fidas generic finger ID likeSome(id)for touch andNonefor mouse events,posas current cursor/finger position in screen space,mvsas number of finger moves for debouncing potential finger tap gesture with zero resulting in no delay of non-tap gestures while tap gesture can still be recognized. Use zero unless tap gestures are hardly recognized.
Returns number of fingers, centroid position, roll angle, and scale ratio in screen space in
the order mentioned or None when debouncing tap gesture with non-vanishing mvs. See
Self::discard() for tap gesture result.
§Panics
Panics with more than N fingers.
Sourcepub fn discard(&mut self, fid: F) -> Option<(usize, Vec2)>
pub fn discard(&mut self, fid: F) -> Option<(usize, Vec2)>
Removes finger position and returns number of fingers and centroid position of tap gesture.
Returns None as long as there are finger positions or no tap gesture has been recognized.
Discards finger positions and tap gesture if generic finger ID fid is unknown.