fix: apply translation to dropdown position
This commit is contained in:
parent
fcc0c91dd6
commit
59407552b6
2 changed files with 8 additions and 1 deletions
|
|
@ -200,6 +200,7 @@ impl<'a, S: AsRef<str>, Message: 'a, Item: Clone + PartialEq + 'static>
|
|||
self.text_line_height,
|
||||
self.selections,
|
||||
&self.on_selected,
|
||||
translation,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -392,6 +393,7 @@ pub fn overlay<'a, S: AsRef<str>, Message: 'a, Item: Clone + PartialEq + 'static
|
|||
text_line_height: text::LineHeight,
|
||||
selections: &'a super::Model<S, Item>,
|
||||
on_selected: &'a dyn Fn(Item) -> Message,
|
||||
translation: Vector,
|
||||
) -> Option<overlay::Element<'a, Message, crate::Theme, crate::Renderer>> {
|
||||
if state.is_open {
|
||||
let description_line_height = text::LineHeight::Absolute(Pixels(
|
||||
|
|
@ -474,7 +476,8 @@ pub fn overlay<'a, S: AsRef<str>, Message: 'a, Item: Clone + PartialEq + 'static
|
|||
|
||||
let mut position = layout.position();
|
||||
position.x -= padding.left;
|
||||
|
||||
position.x += translation.x;
|
||||
position.y += translation.y;
|
||||
Some(menu.overlay(position, bounds.height))
|
||||
} else {
|
||||
None
|
||||
|
|
|
|||
|
|
@ -243,6 +243,7 @@ impl<'a, S: AsRef<str>, Message: 'a> Widget<Message, crate::Theme, crate::Render
|
|||
self.selections,
|
||||
self.selected,
|
||||
&self.on_selected,
|
||||
translation,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -439,6 +440,7 @@ pub fn overlay<'a, S: AsRef<str>, Message: 'a>(
|
|||
selections: &'a [S],
|
||||
selected_option: Option<usize>,
|
||||
on_selected: &'a dyn Fn(usize) -> Message,
|
||||
translation: Vector,
|
||||
) -> Option<overlay::Element<'a, Message, crate::Theme, crate::Renderer>> {
|
||||
if state.is_open {
|
||||
let bounds = layout.bounds();
|
||||
|
|
@ -475,6 +477,8 @@ pub fn overlay<'a, S: AsRef<str>, Message: 'a>(
|
|||
|
||||
let mut position = layout.position();
|
||||
position.x -= padding.left;
|
||||
position.x += translation.x;
|
||||
position.y += translation.y;
|
||||
Some(menu.overlay(position, bounds.height))
|
||||
} else {
|
||||
None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue