fix Draw (redraw)

This commit is contained in:
2026-02-21 00:19:39 -05:00
parent 426ff0adfc
commit 1aadef0e7e
3 changed files with 11 additions and 7 deletions

View File

@@ -28,7 +28,7 @@ pub trait UiRsc {
#[allow(unused_variables)]
fn on_remove(&mut self, id: WidgetId) {}
#[allow(unused_variables)]
fn on_draw(&mut self, active: &ActiveData) {}
fn on_draw(&mut self, active: &ActiveData, redrawn: bool) {}
#[allow(unused_variables)]
fn on_undraw(&mut self, active: &ActiveData) {}

View File

@@ -81,10 +81,12 @@ impl UiRenderState {
old_children: Option<Vec<WidgetId>>,
rsc: &mut dyn UiRsc,
) {
let mut redrawn = old_children.is_some();
let mut old_children = old_children.unwrap_or_default();
if let Some(active) = self.active.get_mut(&id)
&& !rsc.widgets().needs_redraw.contains(&id)
{
redrawn = true;
// check to see if we can skip drawing first
if active.region == region {
return;
@@ -149,7 +151,7 @@ impl UiRenderState {
}
}
rsc.on_draw(&active);
rsc.on_draw(&active, redrawn);
self.active.insert(id, active);
}