Request a redraw only on relevant events

This commit is contained in:
Héctor Ramón Jiménez 2020-06-09 15:45:57 +02:00
parent c0a5dc980e
commit 49dbf2c146
4 changed files with 27 additions and 13 deletions

View file

@ -119,16 +119,19 @@ pub fn main() {
}
}
Event::MainEventsCleared => {
// We update iced
let _ = state.update(
None,
viewport.logical_size(),
&mut renderer,
&mut debug,
);
// If there are events pending
if !state.is_queue_empty() {
// We update iced
let _ = state.update(
None,
viewport.logical_size(),
&mut renderer,
&mut debug,
);
// and request a redraw
window.request_redraw();
// and request a redraw
window.request_redraw();
}
}
Event::RedrawRequested(_) => {
if resized {