menu: Unselect menu item when mouse move out. (#1328)

This commit is contained in:
Jason Lee 2025-10-06 09:45:45 +08:00 committed by GitHub
parent 794f4d6397
commit efe7e14e88
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 7 deletions

View file

@ -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();

View file

@ -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",