use super::keys::*;
use crate::Vector;
use strum_macros::EnumIter;
use wasm_bindgen::prelude::wasm_bindgen;
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct PointerEvent(pub PointerEventType, pub Vector);
impl PointerEvent {
pub fn event_type(&self) -> PointerEventType {
self.0
}
pub fn pos(&self) -> Vector {
self.1
}
}
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)]
pub struct KeyEvent(pub KeyEventType, pub Key);
impl KeyEvent {
pub fn event_type(&self) -> KeyEventType {
self.0
}
pub fn key(&self) -> Key {
self.1
}
}
#[wasm_bindgen]
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, EnumIter)]
#[repr(u8)]
pub enum KeyEventType {
KeyDown,
KeyPress,
KeyUp,
}
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)]
#[repr(u8)]
pub enum PointerEventType {
PrimaryClick,
SecondaryClick,
DoubleClick,
Up,
Down,
Move,
Enter,
Leave,
}