mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-13 06:18:27 +00:00
Don't request redraw every frame
This commit is contained in:
parent
4390d6d088
commit
05e52cbdcc
@ -82,6 +82,8 @@ impl ApplicationHandler for DisplayState {
|
|||||||
window.handle_input_event(input_event);
|
window.handle_input_event(input_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut drawn = false;
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
WindowEvent::Resized(size) => {
|
WindowEvent::Resized(size) => {
|
||||||
window.on_screen_resize(size);
|
window.on_screen_resize(size);
|
||||||
@ -135,20 +137,19 @@ impl ApplicationHandler for DisplayState {
|
|||||||
WindowEvent::MouseWheel { .. } => window.add_focus_point(),
|
WindowEvent::MouseWheel { .. } => window.add_focus_point(),
|
||||||
WindowEvent::RedrawRequested => {
|
WindowEvent::RedrawRequested => {
|
||||||
window.draw();
|
window.draw();
|
||||||
|
drawn = true;
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn about_to_wait(&mut self, _: &ActiveEventLoop) {
|
|
||||||
let Some(window) = &self.window else {
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
if !drawn {
|
||||||
window.window().request_redraw();
|
window.window().request_redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn about_to_wait(&mut self, _: &ActiveEventLoop) {}
|
||||||
|
}
|
||||||
|
|
||||||
fn input_event(event: &WindowEvent, invert_zoom: bool) -> Option<InputEvent> {
|
fn input_event(event: &WindowEvent, invert_zoom: bool) -> Option<InputEvent> {
|
||||||
match event {
|
match event {
|
||||||
WindowEvent::MouseWheel { delta, .. } => {
|
WindowEvent::MouseWheel { delta, .. } => {
|
||||||
|
Loading…
Reference in New Issue
Block a user