From 306fc1973906077b5a30b4768b79c0df45961884 Mon Sep 17 00:00:00 2001 From: tims <0xtimsb@gmail.com> Date: Sat, 21 Dec 2024 02:54:38 +0530 Subject: [PATCH] Fix knockout icon background to match hovered entry background in project panel (#22258) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No issue attached, as this is something trivial and should have been part of my merged PR [here](https://github.com/zed-industries/zed/pull/22073). For context, in the above-mentioned PR, I removed the hover color from selected/marked entries in the Project Panel. The reasoning behind this change is already explained in that PR, but to reiterate: > This change was inspired by the behavior in VSCode, the Firefox sidebar, and Dolphin (KDE File Manager). When an item is selected, it doesn’t display a separate hover state to avoid confusing users about whether the item is selected or merely hovered over. @nilskch mentioned in the comments of the above PR that I should have also changed the background of the knockout icon, which appears on entries, to match the entry background color on hover. This PR addresses that. Before: ![Screenshot_20241219_230005](https://github.com/user-attachments/assets/fd517e01-1a1e-4e63-9320-ba24bf3d4c64) After: ![Screenshot_20241219_225853](https://github.com/user-attachments/assets/35fb146f-83e4-409b-8061-0efbdbba5cf9) Release Notes: - N/A --- crates/project_panel/src/project_panel.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 34f7cc84f6..f03bbe8468 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -3200,7 +3200,7 @@ impl ProjectPanel { item_colors.default }; - let bg_hover_color = if self.mouse_down { + let bg_hover_color = if self.mouse_down || is_marked || is_active { item_colors.marked_active } else { item_colors.hover @@ -3224,9 +3224,7 @@ impl ProjectPanel { .border_1() .border_r_2() .border_color(border_color) - .when(!is_marked && !is_active, |div| { - div.hover(|style| style.bg(bg_hover_color)) - }) + .hover(|style| style.bg(bg_hover_color)) .when(is_local, |div| { div.on_drag_move::(cx.listener( move |this, event: &DragMoveEvent, cx| {