diff options
-rw-r--r-- | lazy/src/component.rs | 11 | ||||
-rw-r--r-- | lazy/src/responsive.rs | 6 |
2 files changed, 13 insertions, 4 deletions
diff --git a/lazy/src/component.rs b/lazy/src/component.rs index 2b729045..00c27989 100644 --- a/lazy/src/component.rs +++ b/lazy/src/component.rs @@ -263,12 +263,17 @@ where .build(), ); - cache.as_ref().unwrap().borrow_overlay().is_some() + cache + .as_ref() + .unwrap() + .borrow_overlay() + .as_ref() + .map(|overlay| overlay.position()) }); - has_overlay.then(|| { + has_overlay.map(|position| { overlay::Element::new( - layout.position(), + position, Box::new(Overlay { instance: self }), ) }) diff --git a/lazy/src/responsive.rs b/lazy/src/responsive.rs index 58d151ec..35ad6974 100644 --- a/lazy/src/responsive.rs +++ b/lazy/src/responsive.rs @@ -6,6 +6,7 @@ use iced_native::layout::{self, Layout}; use iced_native::mouse; use iced_native::overlay; use iced_native::renderer; +use iced_native::window; use iced_native::{ Clipboard, Element, Hasher, Length, Point, Rectangle, Shell, Size, Widget, }; @@ -100,7 +101,10 @@ where ) -> event::Status { let mut internal = self.0.borrow_mut(); - if internal.state.last_size != Some(internal.state.last_layout.size()) { + if matches!(event, Event::Window(window::Event::Resized { .. })) + || internal.state.last_size + != Some(internal.state.last_layout.size()) + { shell.invalidate_widgets(); } |