mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -04:00
Fix Context::repaint_causes returning no causes (#4248)
It would return the causes for repainting again collected this frame, instead of the cause for repainting the current frame. * Part of https://github.com/emilk/egui/issues/3931
This commit is contained in:
@@ -252,7 +252,7 @@ struct ViewportState {
|
||||
}
|
||||
|
||||
/// What called [`Context::request_repaint`]?
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone)]
|
||||
pub struct RepaintCause {
|
||||
/// What file had the call that requested the repaint?
|
||||
pub file: &'static str,
|
||||
@@ -261,6 +261,12 @@ pub struct RepaintCause {
|
||||
pub line: u32,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for RepaintCause {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}:{}", self.file, self.line)
|
||||
}
|
||||
}
|
||||
|
||||
impl RepaintCause {
|
||||
/// Capture the file and line number of the call site.
|
||||
#[allow(clippy::new_without_default)]
|
||||
@@ -1465,7 +1471,7 @@ impl Context {
|
||||
self.read(|ctx| {
|
||||
ctx.viewports
|
||||
.get(&ctx.viewport_id())
|
||||
.map(|v| v.repaint.causes.clone())
|
||||
.map(|v| v.repaint.prev_causes.clone())
|
||||
})
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user