ink_stroke_modeler_rs/
input.rs

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
/// modeler Input event Type
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[allow(non_camel_case_types)]
#[allow(unused)]
pub enum ModelerInputEventType {
    /// For the first pen down event (pen touches the screen)
    Down,
    /// For events between the first (`Down`) and last (`Up`) event (pen moving on the screen)
    Move,
    /// For the last event (pen going up)
    Up,
}

/// struct holding all information for input event
#[derive(Clone, Debug, PartialEq)]
pub struct ModelerInput {
    pub event_type: ModelerInputEventType,
    pub pos: (f64, f64),
    pub time: f64,
    pub pressure: f64,
    // tilt and orientation are optional parameters, so we remove them here to
    // make our lives easier
}

impl Default for ModelerInput {
    fn default() -> Self {
        Self {
            event_type: ModelerInputEventType::Down,
            pos: (0.0, 0.0),
            time: 0.0,
            pressure: 1.0,
        }
    }
}