use super::{ALL_MOUSE_BUTTONS, ALL_PHYSICAL_KEYS, MouseButton, PhysicalKeyCode};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum InputControl {
Key(PhysicalKeyCode),
MouseButton(MouseButton),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum InputCancellationReason {
PointerLeft,
FocusLost,
}
pub(super) fn cancelled_controls(
reason: InputCancellationReason,
) -> impl Iterator<Item = InputControl> {
let keys: &[PhysicalKeyCode] = match reason {
InputCancellationReason::PointerLeft => &[],
InputCancellationReason::FocusLost => &ALL_PHYSICAL_KEYS,
};
keys.iter()
.copied()
.map(InputControl::Key)
.chain(ALL_MOUSE_BUTTONS.into_iter().map(InputControl::MouseButton))
}