Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use bevy::reflect::{FromReflect, Reflect};
/// Controls how the cursor interacts on a given node
#[derive(Debug, Reflect, FromReflect, Copy, Clone, PartialEq, Eq)]
pub enum PointerEvents {
/// Allow all pointer events on this node and its children
All,
/// Allow pointer events on this node but not on its children
SelfOnly,
/// Allow pointer events on this node's children but not on itself
ChildrenOnly,
/// Disallow all pointer events on this node and its children
None,
}
impl Default for PointerEvents {
fn default() -> Self {
Self::All
}
}
#[derive(Default, Debug, Copy, Clone, PartialEq)]
pub struct CursorEvent {
pub pressed: bool,
pub just_pressed: bool,
pub just_released: bool,
pub position: (f32, f32),
}
/// An event created on scroll
#[derive(Default, Debug, Copy, Clone, PartialEq)]
pub struct ScrollEvent {
/// The amount scrolled
pub delta: ScrollUnit,
}
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum ScrollUnit {
/// A scroll unit that goes by a "line of text"
Line { x: f32, y: f32 },
/// A scroll unit that goes by individual pixels
Pixel { x: f32, y: f32 },
}
impl Default for ScrollUnit {
fn default() -> Self {
ScrollUnit::Pixel { x: 0.0, y: 0.0 }
}
}