Skip to content

Commit

Permalink
Capture scrolling events in opaque widget
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Aug 14, 2024
1 parent 5d7d74f commit 5bf381f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions widget/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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
Expand Down

0 comments on commit 5bf381f

Please sign in to comment.