From efe7e14e888093e61d0eb4e115e4a2d80bdd7305 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Mon, 6 Oct 2025 09:45:45 +0800 Subject: [PATCH] menu: Unselect menu item when mouse move out. (#1328) --- crates/ui/src/menu/menu_item.rs | 6 +++--- themes/ayu.json | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/crates/ui/src/menu/menu_item.rs b/crates/ui/src/menu/menu_item.rs index dfac9bfc..5c2edc9c 100644 --- a/crates/ui/src/menu/menu_item.rs +++ b/crates/ui/src/menu/menu_item.rs @@ -111,6 +111,9 @@ impl RenderOnce for MenuItem { .items_center() .justify_between() .refine_style(&self.style) + .when_some(self.on_mouse_enter, |this, on_mouse_enter| { + this.on_mouse_move(move |ev, window, cx| (on_mouse_enter)(ev, window, cx)) + }) .when(!self.disabled, |this| { this.when(self.hovered, |this| { this.bg(cx.theme().accent) @@ -120,9 +123,6 @@ impl RenderOnce for MenuItem { this.bg(cx.theme().accent) .text_color(cx.theme().accent_foreground) }) - .when_some(self.on_mouse_enter, |this, on_mouse_enter| { - this.on_mouse_move(move |ev, window, cx| (on_mouse_enter)(ev, window, cx)) - }) .when_some(self.on_click, |this, on_click| { this.on_mouse_down(MouseButton::Left, move |_, _, cx| { cx.stop_propagation(); diff --git a/themes/ayu.json b/themes/ayu.json index 8c641e9a..be55246e 100644 --- a/themes/ayu.json +++ b/themes/ayu.json @@ -21,7 +21,6 @@ "list.head.background": "#E6E6E6", "muted.background": "#F3F4F5", "muted.foreground": "#99a0a6", - "sidebar.background": "#ECECED", "panel.background": "#F3F4F5", "popover.background": "#ECECED", "popover.foreground": "#5C6773", @@ -238,14 +237,13 @@ "accent.background": "#2D2F34", "accent.foreground": "#B3B1AD", "background": "#0D1016", - "border": "#3d3e40", + "border": "#333436", "ring": "#FFB454", "foreground": "#B3B1AD", "input.border": "#2D2F34", "list.active.background": "#36A3D922", "list.active.border": "#36A3D9", "list.even.background": "#191F2A99", - "sidebar.background": "#1F2127", "muted.background": "#1F2430", "muted.foreground": "#52514f", "panel.background": "#1F2126", @@ -264,7 +262,7 @@ "tab.active.foreground": "#B3B1AD", "tab.active.background": "#0D1016", "tab_bar.background": "#1F2127", - "title_bar.background": "#313337", + "title_bar.background": "#1F2127", "base.yellow": "#feb454", "base.red": "#ef7177", "base.blue": "#5ac1fe",