summaryrefslogtreecommitdiffstats
path: root/lazy
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-01-20 13:43:45 +0700
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-01-20 13:43:45 +0700
commit0e475b008f8d0c9e9033fcee0dc405e3b9970aea (patch)
tree47cbc88645cd1e899404231c50669b43e0077b87 /lazy
parenta3744ec97a462557ab9a3d2509f02263f425fd28 (diff)
downloadiced-0e475b008f8d0c9e9033fcee0dc405e3b9970aea.tar.gz
iced-0e475b008f8d0c9e9033fcee0dc405e3b9970aea.tar.bz2
iced-0e475b008f8d0c9e9033fcee0dc405e3b9970aea.zip
Invalidate widget tree in `Responsive` after a `window::Event::Resized`
This is a pessimistic approach! Ideally, we should be able to recreate only the contents of the `Responsive` widget in `Widget::layout`, but given `view` is impure we have to trigger a brand new `view` call. The persistent widget tree should make this easier.
Diffstat (limited to 'lazy')
-rw-r--r--lazy/src/responsive.rs6
1 files changed, 5 insertions, 1 deletions
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();
}