From dfa3c9a29e0408134215cc42911a9b60ea6c027f Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Tue, 24 Jun 2025 19:33:22 +0800 Subject: [PATCH] menu: Fix sub menu gap. (#1006) image --- crates/ui/src/menu/popup_menu.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/ui/src/menu/popup_menu.rs b/crates/ui/src/menu/popup_menu.rs index a15423ec..c1a21f2f 100644 --- a/crates/ui/src/menu/popup_menu.rs +++ b/crates/ui/src/menu/popup_menu.rs @@ -813,10 +813,10 @@ impl PopupMenu { ) .when(hovered, |this| { let (anchor, left) = - if window.bounds().size.width - bounds.origin.x < max_width { - (Corner::TopRight, -px(12.)) + if max_width + bounds.origin.x > window.bounds().size.width { + (Corner::TopRight, -px(14.)) } else { - (Corner::TopLeft, bounds.size.width + px(4.)) + (Corner::TopLeft, bounds.size.width) }; let is_bottom_pos = @@ -829,7 +829,7 @@ impl PopupMenu { div() .occlude() .when(is_bottom_pos, |this| this.bottom_0()) - .when(!is_bottom_pos, |this| this.top(-px(4.))) + .when(!is_bottom_pos, |this| this.top_neg_1()) .left(left) .child(menu.clone()), )