pub(crate) struct TouchState {
device_id: TouchDeviceId,
active_touches: BTreeMap<TouchId, ActiveTouch>,
gesture_state: Option<GestureState>,
}
Expand description
The current state (for a specific touch device) of touch events and gestures.
Fields§
§device_id: TouchDeviceId
Technical identifier of the touch device. This is used to identify relevant touch events
for this TouchState
instance.
active_touches: BTreeMap<TouchId, ActiveTouch>
Active touches, if any.
TouchId
is the unique identifier of the touch. It is valid as long as the finger/pen touches the surface. The
next touch will receive a new unique ID.
Refer to ActiveTouch
.
gesture_state: Option<GestureState>
If a gesture has been recognized (i.e. when exactly two fingers touch the surface), this holds state information
Implementations§
source§impl TouchState
impl TouchState
pub fn new(device_id: TouchDeviceId) -> Self
pub fn begin_pass( &mut self, time: f64, new: &RawInput, pointer_pos: Option<Pos2>, )
sourcepub fn any_touches(&self) -> bool
pub fn any_touches(&self) -> bool
Are there currently any fingers touching the surface?
pub fn info(&self) -> Option<MultiTouchInfo>
fn update_gesture(&mut self, time: f64, pointer_pos: Option<Pos2>)
sourcefn calc_dynamic_state(&self) -> Option<DynGestureState>
fn calc_dynamic_state(&self) -> Option<DynGestureState>
None
if less than two fingers
Trait Implementations§
source§impl Clone for TouchState
impl Clone for TouchState
source§fn clone(&self) -> TouchState
fn clone(&self) -> TouchState
Returns a copy 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 moreAuto Trait Implementations§
impl Freeze for TouchState
impl RefUnwindSafe for TouchState
impl Send for TouchState
impl Sync for TouchState
impl Unpin 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)