diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 02aa6cddf28..585cfa2dfc3 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -62,7 +62,7 @@ use theme_settings::ThemeSettings; use ui::{ Color, ContextMenu, ContextMenuEntry, DecoratedIcon, Icon, IconDecoration, IconDecorationKind, IndentGuideColors, IndentGuideLayout, Indicator, KeyBinding, Label, LabelSize, ListItem, - ListItemSpacing, ProjectEmptyState, ScrollAxes, ScrollableHandle, Scrollbars, StickyCandidate, + ListItemSpacing, ProjectEmptyState, ScrollableHandle, Scrollbars, StickyCandidate, Tooltip, WithScrollbar, prelude::*, v_flex, }; use util::{ @@ -7087,16 +7087,9 @@ impl Render for ProjectPanel { ) .custom_scrollbars( { - let mut scrollbars = - Scrollbars::for_settings::() - .tracked_scroll_handle(&self.scroll_handle); - if horizontal_scroll { - scrollbars = scrollbars.with_track_along( - ScrollAxes::Horizontal, - cx.theme().colors().panel_background, - ); - } - scrollbars.notify_content() + Scrollbars::for_settings::() + .tracked_scroll_handle(&self.scroll_handle) + .notify_content() }, window, cx, diff --git a/crates/ui/src/components/scrollbar.rs b/crates/ui/src/components/scrollbar.rs index 3e2c8c8b9ac..22bb47c6fd8 100644 --- a/crates/ui/src/components/scrollbar.rs +++ b/crates/ui/src/components/scrollbar.rs @@ -330,7 +330,7 @@ impl ReservedSpace { } fn needs_scroll_track(&self) -> bool { - matches!(self, Self::Track | Self::StableTrack) + matches!(self, Self::Thumb | Self::Track | Self::StableTrack) } fn needs_space_reserved(&self, max_offset: Pixels) -> bool { @@ -779,21 +779,26 @@ impl ScrollbarState { window: &mut Window, cx: &mut Context, ) { - self.set_thumb_state( - if let Some(&ScrollbarLayout { axis, .. }) = - self.last_prepaint_state.as_ref().and_then(|state| { - state - .thumb_for_position(position) - .filter(|thumb| thumb.cursor_hitbox.is_hovered(window)) - }) - { - ThumbState::Hover(axis) - } else { - ThumbState::Inactive - }, - window, - cx, - ); + let thumb_state = if let Some(&ScrollbarLayout { axis, .. }) = + self.last_prepaint_state.as_ref().and_then(|state| { + state + .thumb_for_position(position) + .filter(|thumb| thumb.cursor_hitbox.is_hovered(window)) + }) { + ThumbState::Hover(axis) + } else if let Some(&ScrollbarLayout { axis, .. }) = + self.last_prepaint_state.as_ref().and_then(|state| { + state + .thumbs + .iter() + .find(|thumb| thumb.cursor_hitbox.is_hovered(window)) + }) + { + ThumbState::Hover(axis) + } else { + ThumbState::Inactive + }; + self.set_thumb_state(thumb_state, window, cx); } fn set_thumb_state(&mut self, state: ThumbState, window: &mut Window, cx: &mut Context) { @@ -829,9 +834,13 @@ impl ScrollbarState { } fn parent_hovered(&self, window: &Window) -> bool { - self.last_prepaint_state - .as_ref() - .is_some_and(|state| state.parent_bounds_hitbox.is_hovered(window)) + self.last_prepaint_state.as_ref().is_some_and(|state| { + state.parent_bounds_hitbox.is_hovered(window) + || state + .thumbs + .iter() + .any(|thumb| thumb.cursor_hitbox.is_hovered(window)) + }) } fn hit_for_position(&self, position: &Point) -> Option<&ScrollbarLayout> {