From 004a1f3848fe279a6222c960f84ab271b792a7a0 Mon Sep 17 00:00:00 2001 From: Malcolm Ramsay Date: Thu, 3 Aug 2023 08:42:46 +0930 Subject: fix: Check cursor in bounds when scrolling image::Viewer Ensure that the cursor is within the bounds of the image::Viewer when performing the scrolling. Fixes #1997 --- widget/src/image/viewer.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'widget/src') diff --git a/widget/src/image/viewer.rs b/widget/src/image/viewer.rs index 0038f858..c04ddfa6 100644 --- a/widget/src/image/viewer.rs +++ b/widget/src/image/viewer.rs @@ -154,7 +154,8 @@ where match event { Event::Mouse(mouse::Event::WheelScrolled { delta }) => { - let Some(cursor_position) = cursor.position() else { + // Ensure the cursor is within the bounds of the widget + let Some(cursor_position) = cursor.position_over(bounds) else { return event::Status::Ignored; }; -- cgit From 085842e7651d1ff7794417fe787727347315c3e5 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 3 Aug 2023 20:18:31 +0200 Subject: Remove unnecessary comment in `image::viewer` --- widget/src/image/viewer.rs | 1 - 1 file changed, 1 deletion(-) (limited to 'widget/src') diff --git a/widget/src/image/viewer.rs b/widget/src/image/viewer.rs index c04ddfa6..6e095667 100644 --- a/widget/src/image/viewer.rs +++ b/widget/src/image/viewer.rs @@ -154,7 +154,6 @@ where match event { Event::Mouse(mouse::Event::WheelScrolled { delta }) => { - // Ensure the cursor is within the bounds of the widget let Some(cursor_position) = cursor.position_over(bounds) else { return event::Status::Ignored; }; -- cgit