mirui 0.12.3

A lightweight, no_std ECS-driven UI framework for embedded, desktop, and WebAssembly
Documentation
use crate::ecs::Entity;
use crate::types::Fixed;

#[derive(Clone, Debug)]
pub enum GestureEvent {
    Tap {
        x: Fixed,
        y: Fixed,
        target: Entity,
    },
    LongPress {
        x: Fixed,
        y: Fixed,
        target: Entity,
    },
    DragStart {
        x: Fixed,
        y: Fixed,
        target: Entity,
    },
    DragMove {
        x: Fixed,
        y: Fixed,
        dx: Fixed,
        dy: Fixed,
        target: Entity,
    },
    DragEnd {
        x: Fixed,
        y: Fixed,
        vx: Fixed,
        vy: Fixed,
        target: Entity,
    },
}

impl GestureEvent {
    pub fn target(&self) -> Entity {
        match self {
            Self::Tap { target, .. }
            | Self::LongPress { target, .. }
            | Self::DragStart { target, .. }
            | Self::DragMove { target, .. }
            | Self::DragEnd { target, .. } => *target,
        }
    }
}