From a3bfa0724c5e7fca72231f751619901c71007b13 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 30 Jan 2023 03:41:03 +0100 Subject: Fix widget-driven animations for `Component` --- lazy/src/component.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lazy/src') diff --git a/lazy/src/component.rs b/lazy/src/component.rs index d8f21f8a..d3c52df5 100644 --- a/lazy/src/component.rs +++ b/lazy/src/component.rs @@ -227,6 +227,10 @@ where local_shell.revalidate_layout(|| shell.invalidate_layout()); + if let Some(redraw_request) = local_shell.redraw_request() { + shell.request_redraw(redraw_request); + } + if !local_messages.is_empty() { let mut heads = self.state.take().unwrap().into_heads(); -- cgit From a50cc32d09ddff1d061701074908c28d5c5509ba Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 30 Jan 2023 05:01:28 +0100 Subject: Fix layout translation in `overlay::Group` This bug produced improper positioning of overlays of elements inside a `Scrollable`. --- lazy/src/component.rs | 4 ++-- lazy/src/lazy.rs | 4 ++-- lazy/src/responsive.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'lazy/src') diff --git a/lazy/src/component.rs b/lazy/src/component.rs index d3c52df5..94263274 100644 --- a/lazy/src/component.rs +++ b/lazy/src/component.rs @@ -455,9 +455,9 @@ where position: Point, ) -> layout::Node { self.with_overlay_maybe(|overlay| { - let vector = position - overlay.position(); + let translation = position - overlay.position(); - overlay.layout(renderer, bounds).translate(vector) + overlay.layout(renderer, bounds, translation) }) .unwrap_or_default() } diff --git a/lazy/src/lazy.rs b/lazy/src/lazy.rs index 933def96..9795afa4 100644 --- a/lazy/src/lazy.rs +++ b/lazy/src/lazy.rs @@ -313,9 +313,9 @@ where position: Point, ) -> layout::Node { self.with_overlay_maybe(|overlay| { - let vector = position - overlay.position(); + let translation = position - overlay.position(); - overlay.layout(renderer, bounds).translate(vector) + overlay.layout(renderer, bounds, translation) }) .unwrap_or_default() } diff --git a/lazy/src/responsive.rs b/lazy/src/responsive.rs index 52badda2..e399e7b0 100644 --- a/lazy/src/responsive.rs +++ b/lazy/src/responsive.rs @@ -356,9 +356,9 @@ where position: Point, ) -> layout::Node { self.with_overlay_maybe(|overlay| { - let vector = position - overlay.position(); + let translation = position - overlay.position(); - overlay.layout(renderer, bounds).translate(vector) + overlay.layout(renderer, bounds, translation) }) .unwrap_or_default() } -- cgit From 8fe851057df0df113aaac6b8dc067b3a75d18d65 Mon Sep 17 00:00:00 2001 From: Nick Senger Date: Fri, 10 Feb 2023 12:08:22 -0800 Subject: fix: lazy widgets overlay is_over --- lazy/src/component.rs | 7 +++++++ lazy/src/lazy.rs | 7 +++++++ lazy/src/responsive.rs | 7 +++++++ 3 files changed, 21 insertions(+) (limited to 'lazy/src') diff --git a/lazy/src/component.rs b/lazy/src/component.rs index 94263274..4c03e2a3 100644 --- a/lazy/src/component.rs +++ b/lazy/src/component.rs @@ -563,4 +563,11 @@ where event_status } + + fn is_over(&self, layout: Layout<'_>, cursor_position: Point) -> bool { + self.with_overlay_maybe(|overlay| { + overlay.is_over(layout, cursor_position) + }) + .unwrap_or_default() + } } diff --git a/lazy/src/lazy.rs b/lazy/src/lazy.rs index 9795afa4..5e909a49 100644 --- a/lazy/src/lazy.rs +++ b/lazy/src/lazy.rs @@ -372,6 +372,13 @@ where }) .unwrap_or(iced_native::event::Status::Ignored) } + + fn is_over(&self, layout: Layout<'_>, cursor_position: Point) -> bool { + self.with_overlay_maybe(|overlay| { + overlay.is_over(layout, cursor_position) + }) + .unwrap_or_default() + } } impl<'a, Message, Renderer, Dependency, View> diff --git a/lazy/src/responsive.rs b/lazy/src/responsive.rs index e399e7b0..93069493 100644 --- a/lazy/src/responsive.rs +++ b/lazy/src/responsive.rs @@ -415,4 +415,11 @@ where }) .unwrap_or(iced_native::event::Status::Ignored) } + + fn is_over(&self, layout: Layout<'_>, cursor_position: Point) -> bool { + self.with_overlay_maybe(|overlay| { + overlay.is_over(layout, cursor_position) + }) + .unwrap_or_default() + } } -- cgit From 2201f33c65e8bf85265ee1e996b36cbc5b43257e Mon Sep 17 00:00:00 2001 From: Nick Senger Date: Sun, 12 Feb 2023 11:07:08 -0800 Subject: fix: diff widget sub-tree after rebuilding component with operation --- lazy/src/component.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lazy/src') diff --git a/lazy/src/component.rs b/lazy/src/component.rs index 94263274..e29ccca8 100644 --- a/lazy/src/component.rs +++ b/lazy/src/component.rs @@ -311,6 +311,8 @@ where } self.with_element(|element| { + tree.diff_children(std::slice::from_ref(&element)); + element.as_widget().operate( &mut tree.children[0], layout, -- cgit