diff options
author | 2023-08-03 08:42:46 +0930 | |
---|---|---|
committer | 2023-08-03 08:42:46 +0930 | |
commit | 004a1f3848fe279a6222c960f84ab271b792a7a0 (patch) | |
tree | f1213345d451d44ca3d08790dd3ab18505e1baf4 | |
parent | dd6d8875585796252f6b54c950a1c9b143d00904 (diff) | |
download | iced-004a1f3848fe279a6222c960f84ab271b792a7a0.tar.gz iced-004a1f3848fe279a6222c960f84ab271b792a7a0.tar.bz2 iced-004a1f3848fe279a6222c960f84ab271b792a7a0.zip |
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
-rw-r--r-- | widget/src/image/viewer.rs | 3 |
1 files changed, 2 insertions, 1 deletions
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; }; |