summaryrefslogtreecommitdiffstats
path: root/native/src/touch.rs
blob: 88bd83bb93206dd6aa258f40ed79d995bde85801 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//! Build touch events.
use crate::Point;

/// A touch interaction.
#[derive(Debug, Clone, Copy, PartialEq)]
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,
}