fix(menu): only draw within intersection of viewport bounds
This commit is contained in:
parent
a85b369399
commit
7fb514bfac
1 changed files with 9 additions and 3 deletions
|
|
@ -781,7 +781,7 @@ impl<'b, Message: Clone + 'static> Menu<'b, Message> {
|
||||||
// println!("color: {:?}\n", styling.background);
|
// println!("color: {:?}\n", styling.background);
|
||||||
let menu_quad = renderer::Quad {
|
let menu_quad = renderer::Quad {
|
||||||
bounds: pad_rectangle(
|
bounds: pad_rectangle(
|
||||||
children_bounds,
|
children_bounds.intersection(&viewport).unwrap_or_default(),
|
||||||
styling.background_expand.into(),
|
styling.background_expand.into(),
|
||||||
),
|
),
|
||||||
border: Border {
|
border: Border {
|
||||||
|
|
@ -800,7 +800,10 @@ impl<'b, Message: Clone + 'static> Menu<'b, Message> {
|
||||||
.nth(active.saturating_sub(start_index))
|
.nth(active.saturating_sub(start_index))
|
||||||
{
|
{
|
||||||
let path_quad = renderer::Quad {
|
let path_quad = renderer::Quad {
|
||||||
bounds: active_layout.bounds(),
|
bounds: active_layout
|
||||||
|
.bounds()
|
||||||
|
.intersection(&viewport)
|
||||||
|
.unwrap_or_default(),
|
||||||
border: Border {
|
border: Border {
|
||||||
radius: styling.menu_border_radius.into(),
|
radius: styling.menu_border_radius.into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
@ -824,7 +827,10 @@ impl<'b, Message: Clone + 'static> Menu<'b, Message> {
|
||||||
style,
|
style,
|
||||||
clo,
|
clo,
|
||||||
view_cursor,
|
view_cursor,
|
||||||
&children_layout.bounds(),
|
&children_layout
|
||||||
|
.bounds()
|
||||||
|
.intersection(&viewport)
|
||||||
|
.unwrap_or_default(),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue