From c46600a69a11197f88b33f49bd076dd422d0575c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Sat, 2 Aug 2025 22:27:19 +0200 Subject: [PATCH] Make `Pop::on_resize` trigger when no `on_show` set --- widget/src/pop.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/widget/src/pop.rs b/widget/src/pop.rs index 44da6a4e..b580950c 100644 --- a/widget/src/pop.rs +++ b/widget/src/pop.rs @@ -215,7 +215,16 @@ where let distance = top_left_distance.min(bottom_right_distance); - if state.has_popped_in { + if self.on_show.is_none() { + if let Some(on_resize) = &self.on_resize { + let size = bounds.size(); + + if Some(size) != state.last_size { + state.last_size = Some(size); + shell.publish(on_resize(size)); + } + } + } else if state.has_popped_in { if distance <= self.anticipate.0 { if let Some(on_resize) = &self.on_resize { let size = bounds.size(); @@ -229,7 +238,7 @@ where state.has_popped_in = false; state.should_notify_at = Some((false, *now + self.delay)); } - } else if self.on_show.is_some() && distance <= self.anticipate.0 { + } else if distance <= self.anticipate.0 { let size = bounds.size(); state.has_popped_in = true;