diff options
author | 2021-10-28 16:47:52 +0700 | |
---|---|---|
committer | 2021-10-28 16:47:52 +0700 | |
commit | 1ec667920a792dbe96786a44b8b3064cae7eaea2 (patch) | |
tree | a2d0c574ae760ed564483110f72a09c342e807c3 /native/src/overlay | |
parent | 9c7e340b28d11ede50b494f5341acd94673feb5d (diff) | |
download | iced-1ec667920a792dbe96786a44b8b3064cae7eaea2.tar.gz iced-1ec667920a792dbe96786a44b8b3064cae7eaea2.tar.bz2 iced-1ec667920a792dbe96786a44b8b3064cae7eaea2.zip |
Implement `Overlay::mouse_interaction` for `overlay::Menu`
Diffstat (limited to 'native/src/overlay')
-rw-r--r-- | native/src/overlay/menu.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/native/src/overlay/menu.rs b/native/src/overlay/menu.rs index 8f91e4b7..1ba953f3 100644 --- a/native/src/overlay/menu.rs +++ b/native/src/overlay/menu.rs @@ -233,6 +233,16 @@ where ) } + fn mouse_interaction( + &self, + layout: Layout<'_>, + viewport: &Rectangle, + cursor_position: Point, + ) -> mouse::Interaction { + self.container + .mouse_interaction(layout, viewport, cursor_position) + } + fn draw( &self, renderer: &mut Renderer, @@ -374,6 +384,21 @@ where event::Status::Ignored } + fn mouse_interaction( + &self, + layout: Layout<'_>, + _viewport: &Rectangle, + cursor_position: Point, + ) -> mouse::Interaction { + let is_mouse_over = layout.bounds().contains(cursor_position); + + if is_mouse_over { + mouse::Interaction::Pointer + } else { + mouse::Interaction::default() + } + } + fn draw( &self, renderer: &mut Renderer, |