Skip to content

Commit

Permalink
Fix PopupMenu position after scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Apr 13, 2024
1 parent c25e37b commit f2ebbae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/gui/popup_menu.rs
Expand Up @@ -158,12 +158,13 @@ where
tree: &'b mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
_translation: Vector,
translation: Vector,
) -> Option<overlay::Element<'b, Message, Theme, Renderer>> {
let state = tree.state.downcast_mut::<State<T>>();

overlay(
layout,
translation,
state,
self.padding,
self.text_size,
Expand Down Expand Up @@ -321,6 +322,7 @@ pub fn mouse_interaction(layout: Layout<'_>, cursor: mouse::Cursor, usable: bool
/// Returns the current overlay of a [`PopupMenu`].
pub fn overlay<'a, T, Message, Theme, Renderer>(
layout: Layout<'_>,
translation: Vector,
state: &'a mut State<T>,
padding: Padding,
text_size: Option<f32>,
Expand Down Expand Up @@ -360,7 +362,7 @@ where
menu = menu.text_size(text_size);
}

Some(menu.overlay(layout.position(), bounds.height))
Some(menu.overlay(layout.position() + translation, bounds.height))
} else {
None
}
Expand Down

0 comments on commit f2ebbae

Please sign in to comment.