mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 21:00:03 -04:00
now using a HashMap insted of a Vec to store repaint_after
This commit is contained in:
@@ -136,7 +136,7 @@ impl Repaint {
|
||||
&mut self,
|
||||
viewport_id: ViewportId,
|
||||
viewports: &[ViewportId],
|
||||
) -> Vec<(ViewportId, std::time::Duration)> {
|
||||
) -> HashMap<ViewportId, std::time::Duration> {
|
||||
// if repaint_requests is greater than zero. just set the duration to zero for immediate
|
||||
// repaint. if there's no repaint requests, then we can use the actual repaint_after instead.
|
||||
let repaint_after = if self
|
||||
@@ -166,10 +166,7 @@ impl Repaint {
|
||||
self.repaint_requests
|
||||
.retain(|id, repaints| viewports.contains(id) && *repaints != 0);
|
||||
|
||||
self.repaint_after
|
||||
.iter()
|
||||
.map(|(id, time)| (*id, *time))
|
||||
.collect()
|
||||
self.repaint_after.clone()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
//! All the data egui returns to the backend at the end of each frame.
|
||||
|
||||
use ahash::HashMap;
|
||||
|
||||
use crate::ViewportId;
|
||||
use crate::{ViewportCommand, ViewportOutput, WidgetType};
|
||||
|
||||
@@ -19,7 +21,7 @@ pub struct FullOutput {
|
||||
/// duration elapses. when in reactive mode, egui spends forever waiting for input and only then,
|
||||
/// will it repaint itself. this can be used to make sure that backend will only wait for a
|
||||
/// specified amount of time, and repaint egui without any new input.
|
||||
pub repaint_after: Vec<(ViewportId, std::time::Duration)>,
|
||||
pub repaint_after: HashMap<ViewportId, std::time::Duration>,
|
||||
|
||||
/// Texture changes since last frame (including the font texture).
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user