mirror of
https://github.com/emilk/egui.git
synced 2026-09-03 15:20:05 -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,
|
&mut self,
|
||||||
viewport_id: ViewportId,
|
viewport_id: ViewportId,
|
||||||
viewports: &[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
|
// 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.
|
// repaint. if there's no repaint requests, then we can use the actual repaint_after instead.
|
||||||
let repaint_after = if self
|
let repaint_after = if self
|
||||||
@@ -166,10 +166,7 @@ impl Repaint {
|
|||||||
self.repaint_requests
|
self.repaint_requests
|
||||||
.retain(|id, repaints| viewports.contains(id) && *repaints != 0);
|
.retain(|id, repaints| viewports.contains(id) && *repaints != 0);
|
||||||
|
|
||||||
self.repaint_after
|
self.repaint_after.clone()
|
||||||
.iter()
|
|
||||||
.map(|(id, time)| (*id, *time))
|
|
||||||
.collect()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
//! All the data egui returns to the backend at the end of each frame.
|
//! All the data egui returns to the backend at the end of each frame.
|
||||||
|
|
||||||
|
use ahash::HashMap;
|
||||||
|
|
||||||
use crate::ViewportId;
|
use crate::ViewportId;
|
||||||
use crate::{ViewportCommand, ViewportOutput, WidgetType};
|
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,
|
/// 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
|
/// 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.
|
/// 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).
|
/// Texture changes since last frame (including the font texture).
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user