pub struct TouchState {
pub pinch_delta: Option<f64>,
pub rotation_delta: Option<f64>,
pub pan_delta: Option<(f64, f64)>,
/* private fields */
}Expand description
Multi-touch state tracker
Fields§
§pinch_delta: Option<f64>Pinch gesture: distance delta between two touches
rotation_delta: Option<f64>Rotation gesture: angle delta between two touches (radians)
pan_delta: Option<(f64, f64)>Two-finger pan: average movement of two touches
Implementations§
Source§impl TouchState
impl TouchState
Sourcepub fn update_touch(
&mut self,
id: TouchId,
x: f64,
y: f64,
time: f64,
force: Option<f64>,
)
pub fn update_touch( &mut self, id: TouchId, x: f64, y: f64, time: f64, force: Option<f64>, )
Add or update a touch point
Sourcepub fn touch_start(
&mut self,
id: TouchId,
x: f64,
y: f64,
time: f64,
force: Option<f64>,
)
pub fn touch_start( &mut self, id: TouchId, x: f64, y: f64, time: f64, force: Option<f64>, )
Start a new touch point (convenience wrapper)
Sourcepub fn touch_move(
&mut self,
id: TouchId,
x: f64,
y: f64,
time: f64,
force: Option<f64>,
)
pub fn touch_move( &mut self, id: TouchId, x: f64, y: f64, time: f64, force: Option<f64>, )
Move an existing touch point (convenience wrapper)
Sourcepub fn touch_cancel(&mut self, id: TouchId)
pub fn touch_cancel(&mut self, id: TouchId)
Cancel a touch point (convenience wrapper for touch_end)
Sourcepub fn remove_touch(&mut self, id: TouchId)
pub fn remove_touch(&mut self, id: TouchId)
Remove a touch point
Sourcepub fn clear_deltas(&mut self)
pub fn clear_deltas(&mut self)
Clear frame-specific gesture deltas
Sourcepub fn primary_touch(&self) -> Option<&Touch>
pub fn primary_touch(&self) -> Option<&Touch>
Get the primary touch (first touch that went down)
Sourcepub fn touch_count(&self) -> usize
pub fn touch_count(&self) -> usize
Get number of active touches
Sourcepub fn has_touches(&self) -> bool
pub fn has_touches(&self) -> bool
Check if any touches are active
Sourcepub fn is_two_finger_gesture(&self) -> bool
pub fn is_two_finger_gesture(&self) -> bool
Check if this is a two-finger gesture
Sourcepub fn is_pinching(&self) -> bool
pub fn is_pinching(&self) -> bool
Check if currently pinching
Sourcepub fn is_rotating(&self) -> bool
pub fn is_rotating(&self) -> bool
Check if currently rotating
Sourcepub fn is_two_finger_panning(&self) -> bool
pub fn is_two_finger_panning(&self) -> bool
Check if currently panning with two fingers
Trait Implementations§
Source§impl Clone for TouchState
impl Clone for TouchState
Source§fn clone(&self) -> TouchState
fn clone(&self) -> TouchState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TouchState
impl Debug for TouchState
Source§impl Default for TouchState
impl Default for TouchState
Source§fn default() -> TouchState
fn default() -> TouchState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TouchState
impl RefUnwindSafe for TouchState
impl Send for TouchState
impl Sync for TouchState
impl Unpin for TouchState
impl UnsafeUnpin for TouchState
impl UnwindSafe for TouchState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more