Add resize_events subscription to window module
This commit is contained in:
parent
1eabd38219
commit
a108b2eebe
3 changed files with 16 additions and 15 deletions
|
|
@ -194,6 +194,17 @@ pub fn close_events() -> Subscription<Id> {
|
|||
})
|
||||
}
|
||||
|
||||
/// Subscribes to all [`Event::Resized`] occurrences in the running application.
|
||||
pub fn resize_events() -> Subscription<(Id, Size)> {
|
||||
event::listen_with(|event, _status, id| {
|
||||
if let crate::core::Event::Window(Event::Resized(size)) = event {
|
||||
Some((id, size))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Subscribes to all [`Event::CloseRequested`] occurences in the running application.
|
||||
pub fn close_requests() -> Subscription<Id> {
|
||||
event::listen_with(|event, _status, id| {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue