use crate::*;
#[derive(Clone, Debug)]
pub enum Event {
TouchBegin {
id: usize,
position: LocalPoint,
},
TouchMove {
id: usize,
position: LocalPoint,
delta: LocalOffset,
},
TouchEnd {
id: usize,
position: LocalPoint,
},
Command(String),
Key(Key),
Anim,
}
impl Event {
pub fn offset(&self, offset: LocalOffset) -> Event {
let mut event = self.clone();
match &mut event {
Event::TouchBegin { position, .. } => *position += offset,
Event::TouchMove { position, .. } => *position += offset,
Event::TouchEnd { position, .. } => *position += offset,
_ => (),
}
event
}
}
#[derive(Copy, Clone, Debug)]
pub enum MouseButton {
Left,
Right,
Center,
}
#[derive(Copy, Clone, Debug, Default)]
pub struct KeyboardModifiers {
pub shift: bool,
pub control: bool,
pub alt: bool,
pub command: bool,
}
#[derive(Copy, Clone, Debug)]
pub enum Key {
Character(char),
Enter,
Tab,
Space,
ArrowDown,
ArrowLeft,
ArrowRight,
ArrowUp,
End,
Home,
PageDown,
PageUp,
Backspace,
Delete,
Escape,
F1,
F2,
F3,
F4,
F5,
F6,
F7,
F8,
F9,
F10,
F11,
F12,
}
#[derive(Clone, Debug, Eq, PartialEq, Copy)]
pub enum HotKey {
KeyA,
KeyB,
KeyC,
KeyD,
KeyE,
KeyF,
KeyG,
KeyH,
KeyI,
KeyJ,
KeyK,
KeyL,
KeyM,
KeyN,
KeyO,
KeyP,
KeyQ,
KeyR,
KeyS,
KeyT,
KeyU,
KeyV,
KeyW,
KeyX,
KeyY,
KeyZ,
}