mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 05:40:03 -04:00
Add an option to limit the repaint rate in the web runner (#7482)
Co-authored-by: Lucas Meurer <hi@lucasmerlin.me> Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
committed by
GitHub
parent
9db03983dd
commit
ec5bc35c38
@@ -509,6 +509,10 @@ pub struct WebOptions {
|
||||
///
|
||||
/// Defaults to true.
|
||||
pub should_prevent_default: Box<dyn Fn(&egui::Event) -> bool>,
|
||||
|
||||
/// Maximum rate at which to repaint. This can be used to artificially reduce the repaint rate below
|
||||
/// vsync in order to save resources.
|
||||
pub max_fps: Option<u32>,
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
@@ -527,6 +531,8 @@ impl Default for WebOptions {
|
||||
|
||||
should_stop_propagation: Box::new(|_| true),
|
||||
should_prevent_default: Box::new(|_| true),
|
||||
|
||||
max_fps: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user