From 5bf381fc59b88581c5e91f149b37b8faea9882e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Wed, 14 Aug 2024 18:18:07 +0200 Subject: [PATCH] Capture scrolling events in `opaque` widget --- widget/src/helpers.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/widget/src/helpers.rs b/widget/src/helpers.rs index c3ffea45cb..a622b46fdd 100644 --- a/widget/src/helpers.rs +++ b/widget/src/helpers.rs @@ -308,9 +308,12 @@ where shell: &mut Shell<'_, Message>, viewport: &Rectangle, ) -> event::Status { - let is_mouse_press = matches!( + let is_active_mouse_event = matches!( event, - core::Event::Mouse(mouse::Event::ButtonPressed(_)) + core::Event::Mouse( + mouse::Event::ButtonPressed(_) + | mouse::Event::WheelScrolled { .. } + ) ); if let core::event::Status::Captured = @@ -322,7 +325,7 @@ where return event::Status::Captured; } - if is_mouse_press && cursor.is_over(layout.bounds()) { + if is_active_mouse_event && cursor.is_over(layout.bounds()) { event::Status::Captured } else { event::Status::Ignored