Another project
0

Configure Feed

Select the types of activity you want to include in your feed.

at main 1.3 kB View raw
1use bone_render::ViewportExtent; 2use bone_ui::input::{KeyCode, ModifierMask, PointerButton}; 3use serde::{Deserialize, Serialize}; 4 5#[derive(Copy, Clone, Debug, PartialEq)] 6pub struct WindowPoint { 7 pub x: f64, 8 pub y: f64, 9} 10 11impl WindowPoint { 12 #[must_use] 13 pub const fn new(x: f64, y: f64) -> Self { 14 Self { x, y } 15 } 16} 17 18#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] 19pub enum ScrollDelta { 20 Lines { x: f32, y: f32 }, 21 Pixels { x: f64, y: f64 }, 22} 23 24#[derive(Copy, Clone, Debug, PartialEq, Eq)] 25pub enum NavKey { 26 Left, 27 Right, 28 Up, 29 Down, 30 Zoom, 31 ZoomIn, 32 ZoomOut, 33} 34 35#[derive(Clone, Debug, PartialEq)] 36pub struct KeyDown { 37 pub code: Option<KeyCode>, 38 pub nav: Option<NavKey>, 39 pub text: Option<String>, 40 pub repeat: bool, 41} 42 43#[derive(Clone, Debug, PartialEq)] 44pub enum InputEvent { 45 Resize(ViewportExtent), 46 Focus(bool), 47 Modifiers(ModifierMask), 48 CursorMove(WindowPoint), 49 CursorLeft, 50 CursorEntered, 51 Pointer { 52 button: PointerButton, 53 pressed: bool, 54 }, 55 Wheel(ScrollDelta), 56 KeyDown(KeyDown), 57} 58 59#[must_use = "input dispatch must be acknowledged via the redraw scheduler"] 60pub struct InputDispatched(()); 61 62impl InputDispatched { 63 pub(crate) const fn after_input() -> Self { 64 Self(()) 65 } 66}