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') 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