use kurbo::Point;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PointerButton {
Primary,
Secondary,
Middle,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PointerPhase {
Down,
Move,
Up,
Cancel,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct PointerEvent {
pub phase: PointerPhase,
pub position: Point,
pub button: PointerButton,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum PointerSource {
Mouse,
Touch,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct PointerId {
pub source: PointerSource,
pub slot: u32,
}
impl PointerId {
pub const MOUSE: PointerId = PointerId {
source: PointerSource::Mouse,
slot: 0,
};
pub const fn touch(slot: u32) -> PointerId {
PointerId {
source: PointerSource::Touch,
slot,
}
}
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum CursorIcon {
#[default]
Default,
Pointer,
Text,
Grab,
Grabbing,
ColResize,
RowResize,
NotAllowed,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ScrollDelta {
Lines(f64, f64),
Pixels(f64, f64),
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ScalePhase {
Begin,
Update,
End,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct ScaleEvent {
pub phase: ScalePhase,
pub scale_delta: f64,
pub focal: Point,
pub velocity: f64,
}