diff options
Diffstat (limited to 'native/src')
-rw-r--r-- | native/src/widget/image/viewer.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/native/src/widget/image/viewer.rs b/native/src/widget/image/viewer.rs index 3e8430f3..d9eccfad 100644 --- a/native/src/widget/image/viewer.rs +++ b/native/src/widget/image/viewer.rs @@ -281,6 +281,24 @@ where } } + fn mouse_interaction( + &self, + layout: Layout<'_>, + _viewport: &Rectangle, + cursor_position: Point, + ) -> mouse::Interaction { + let bounds = layout.bounds(); + let is_mouse_over = bounds.contains(cursor_position); + + if self.state.is_cursor_grabbed() { + mouse::Interaction::Grabbing + } else if is_mouse_over { + mouse::Interaction::Grab + } else { + mouse::Interaction::Idle + } + } + fn draw( &self, renderer: &mut Renderer, |