2019-11-11 20:29:58 -08:00
|
|
|
//! Build touch events.
|
2020-03-19 12:17:16 +01:00
|
|
|
use crate::Point;
|
|
|
|
|
|
|
|
|
|
/// A touch interaction.
|
2019-11-11 20:29:58 -08:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
2020-03-19 12:17:16 +01:00
|
|
|
pub struct Touch {
|
|
|
|
|
/// The finger of the touch.
|
|
|
|
|
pub finger: Finger,
|
|
|
|
|
|
|
|
|
|
/// The position of the touch.
|
|
|
|
|
pub position: Point,
|
|
|
|
|
|
|
|
|
|
/// The state of the touch.
|
|
|
|
|
pub phase: Phase,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// A unique identifier representing a finger on a touch interaction.
|
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
|
|
|
|
pub struct Finger(pub u64);
|
|
|
|
|
|
|
|
|
|
/// The state of a touch interaction.
|
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
|
|
|
pub enum Phase {
|
|
|
|
|
/// A touch interaction was started.
|
|
|
|
|
Started,
|
|
|
|
|
|
|
|
|
|
/// An on-going touch interaction was moved.
|
|
|
|
|
Moved,
|
|
|
|
|
|
|
|
|
|
/// A touch interaction was ended.
|
|
|
|
|
Ended,
|
|
|
|
|
|
|
|
|
|
/// A touch interaction was canceled.
|
|
|
|
|
Canceled,
|
2019-11-11 20:29:58 -08:00
|
|
|
}
|