pub struct Touch {
pub kind: TouchKind,
pub id: usize,
pub x: usize,
pub y: usize,
}Fields§
§kind: TouchKind§id: usize§x: usize§y: usizeImplementations§
Source§impl Touch
impl Touch
pub fn translate_pos(&self, origin_x: usize, origin_y: usize) -> Touch
pub fn with_offset(&self, offset_x: i32, offset_y: i32) -> Touch
pub fn is_within_area(&self, x: usize, y: usize, w: usize, h: usize) -> bool
pub fn is_press(&self) -> bool
pub fn is_drag(&self) -> bool
pub fn is_release(&self) -> bool
Sourcepub fn as_input_message(&self, msg_id: usize) -> Message
pub fn as_input_message(&self, msg_id: usize) -> Message
Used by gui-server to convert Touch message into InputMessage format for the
use in GUI apps.
Sourcepub fn try_from_input_message(msg: &Message) -> Option<Self>
pub fn try_from_input_message(msg: &Message) -> Option<Self>
To be used by GUI apps to parse an InputMessage from the gui-server’s
receive_input().
pub fn diff(&self, other: &Touch) -> (isize, isize)
Sourcepub fn distance_to(&self, other: &Touch) -> f32
pub fn distance_to(&self, other: &Touch) -> f32
Calculate the distance between two touches.
Trait Implementations§
Source§impl FromScalar<4> for Touch
impl FromScalar<4> for Touch
fn from_scalar([kind, id, x, y]: [u32; 4]) -> Self
impl Copy for Touch
Auto Trait Implementations§
impl Freeze for Touch
impl RefUnwindSafe for Touch
impl Send for Touch
impl Sync for Touch
impl Unpin for Touch
impl UnwindSafe for Touch
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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,
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.