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
This commit is contained in:
Malcolm Ramsay 2023-08-03 08:42:46 +09:30
parent dd6d887558
commit 004a1f3848

View file

@ -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;
};