Don't dispatch events to flex children outside of parent flex's bounds
This commit is contained in:
parent
d7342e2875
commit
0214bec7f4
2 changed files with 23 additions and 0 deletions
|
@ -61,3 +61,20 @@ pub enum Event {
|
|||
left_mouse_down: bool,
|
||||
},
|
||||
}
|
||||
|
||||
impl Event {
|
||||
pub fn position(&self) -> Option<Vector2F> {
|
||||
match self {
|
||||
Event::KeyDown { .. } => None,
|
||||
Event::ScrollWheel { position, .. }
|
||||
| Event::LeftMouseDown { position, .. }
|
||||
| Event::LeftMouseUp { position }
|
||||
| Event::LeftMouseDragged { position }
|
||||
| Event::RightMouseDown { position, .. }
|
||||
| Event::RightMouseUp { position }
|
||||
| Event::NavigateMouseDown { position, .. }
|
||||
| Event::NavigateMouseUp { position, .. }
|
||||
| Event::MouseMoved { position, .. } => Some(*position),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue