summaryrefslogtreecommitdiffstats
path: root/widget/src
diff options
context:
space:
mode:
authorLibravatar Malcolm Ramsay <m@malramsay.com>2023-08-03 08:42:46 +0930
committerLibravatar Malcolm Ramsay <m@malramsay.com>2023-08-03 08:42:46 +0930
commit004a1f3848fe279a6222c960f84ab271b792a7a0 (patch)
treef1213345d451d44ca3d08790dd3ab18505e1baf4 /widget/src
parentdd6d8875585796252f6b54c950a1c9b143d00904 (diff)
downloadiced-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
Diffstat (limited to 'widget/src')
-rw-r--r--widget/src/image/viewer.rs3
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;
};