From 7fb514bfac0ebf6ae6a1f045e8bdb976544d69b5 Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Wed, 25 Jun 2025 17:51:08 -0400 Subject: [PATCH] fix(menu): only draw within intersection of viewport bounds --- src/widget/menu/menu_inner.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/widget/menu/menu_inner.rs b/src/widget/menu/menu_inner.rs index 6a3eb093..18b4433f 100644 --- a/src/widget/menu/menu_inner.rs +++ b/src/widget/menu/menu_inner.rs @@ -781,7 +781,7 @@ impl<'b, Message: Clone + 'static> Menu<'b, Message> { // println!("color: {:?}\n", styling.background); let menu_quad = renderer::Quad { bounds: pad_rectangle( - children_bounds, + children_bounds.intersection(&viewport).unwrap_or_default(), styling.background_expand.into(), ), border: Border { @@ -800,7 +800,10 @@ impl<'b, Message: Clone + 'static> Menu<'b, Message> { .nth(active.saturating_sub(start_index)) { let path_quad = renderer::Quad { - bounds: active_layout.bounds(), + bounds: active_layout + .bounds() + .intersection(&viewport) + .unwrap_or_default(), border: Border { radius: styling.menu_border_radius.into(), ..Default::default() @@ -824,7 +827,10 @@ impl<'b, Message: Clone + 'static> Menu<'b, Message> { style, clo, view_cursor, - &children_layout.bounds(), + &children_layout + .bounds() + .intersection(&viewport) + .unwrap_or_default(), ); }); }