From 1fb2b9ccf25fd3c3a3e05c7ec191c7aef12099a7 Mon Sep 17 00:00:00 2001 From: Aleksander Date: Fri, 3 Jul 2026 20:50:09 +0200 Subject: [PATCH] wgui: bugfix: always recompute layout before refreshing the component This allows us to get computed widget boundaries inasted of bogus values --- wgui/src/layout.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wgui/src/layout.rs b/wgui/src/layout.rs index 1eb05876..22756a03 100644 --- a/wgui/src/layout.rs +++ b/wgui/src/layout.rs @@ -187,7 +187,7 @@ pub struct Layout { pub content_root_node: taffy::NodeId, pub prev_size: Vec2, - pub content_size: Vec2, + pub content_size: Vec2, // cached value pub needs_redraw: bool, pub haptics_triggered: bool, @@ -720,9 +720,10 @@ impl Layout { pub fn tick(&mut self) -> anyhow::Result<()> { let mut alterables = EventAlterables::default(); self.animations.tick(&self.state, &mut alterables); - self.process_pending_components(); self.process_pending_widget_ticks(&mut alterables); self.process_alterables(alterables)?; + self.try_recompute_layout(self.content_size /* cached value */)?; + self.process_pending_components(); Ok(()) }