mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
Make Thumb use full-height track hitbox, remove OverlayTrack
Thumb-only hitboxes (covering just the thumb rectangle) always let clicks on the track area fall through to content underneath. There is no use case for this — the scrollbar strip should always intercept its own clicks. Fold OverlayTrack's behavior directly into Thumb by including it in needs_scroll_track(), then remove the now-redundant OverlayTrack variant and with_overlay_track_along() method. All vertical_scrollbar_for call sites get the correct behavior automatically. Settings and project panel callers are cleaned up: the settings main list reverts to vertical_scrollbar_for, and the now-redundant with_overlay_track_along calls are removed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
cc22aaadd6
commit
119ef17316
3 changed files with 6 additions and 25 deletions
|
|
@ -62,7 +62,7 @@ use theme_settings::ThemeSettings;
|
||||||
use ui::{
|
use ui::{
|
||||||
Color, ContextMenu, ContextMenuEntry, DecoratedIcon, Icon, IconDecoration, IconDecorationKind,
|
Color, ContextMenu, ContextMenuEntry, DecoratedIcon, Icon, IconDecoration, IconDecorationKind,
|
||||||
IndentGuideColors, IndentGuideLayout, Indicator, KeyBinding, Label, LabelSize, ListItem,
|
IndentGuideColors, IndentGuideLayout, Indicator, KeyBinding, Label, LabelSize, ListItem,
|
||||||
ListItemSpacing, ProjectEmptyState, ScrollAxes, ScrollableHandle, Scrollbars, StickyCandidate,
|
ListItemSpacing, ProjectEmptyState, ScrollableHandle, Scrollbars, StickyCandidate,
|
||||||
Tooltip, WithScrollbar, prelude::*, v_flex,
|
Tooltip, WithScrollbar, prelude::*, v_flex,
|
||||||
};
|
};
|
||||||
use util::{
|
use util::{
|
||||||
|
|
@ -7087,15 +7087,9 @@ impl Render for ProjectPanel {
|
||||||
)
|
)
|
||||||
.custom_scrollbars(
|
.custom_scrollbars(
|
||||||
{
|
{
|
||||||
let mut scrollbars =
|
Scrollbars::for_settings::<ProjectPanelScrollbarProxy>()
|
||||||
Scrollbars::for_settings::<ProjectPanelScrollbarProxy>()
|
.tracked_scroll_handle(&self.scroll_handle)
|
||||||
.tracked_scroll_handle(&self.scroll_handle)
|
.notify_content()
|
||||||
.with_overlay_track_along(ScrollAxes::Vertical);
|
|
||||||
if horizontal_scroll {
|
|
||||||
scrollbars =
|
|
||||||
scrollbars.with_overlay_track_along(ScrollAxes::Horizontal);
|
|
||||||
}
|
|
||||||
scrollbars.notify_content()
|
|
||||||
},
|
},
|
||||||
window,
|
window,
|
||||||
cx,
|
cx,
|
||||||
|
|
|
||||||
|
|
@ -3477,19 +3477,12 @@ impl SettingsWindow {
|
||||||
window.focus_prev(cx);
|
window.focus_prev(cx);
|
||||||
}))
|
}))
|
||||||
.when(current_sub_page.is_none(), |this| {
|
.when(current_sub_page.is_none(), |this| {
|
||||||
this.custom_scrollbars(
|
this.vertical_scrollbar_for(&self.list_state, window, cx)
|
||||||
Scrollbars::new(ui::ScrollAxes::Vertical)
|
|
||||||
.tracked_scroll_handle(&self.list_state)
|
|
||||||
.with_overlay_track_along(ui::ScrollAxes::Vertical),
|
|
||||||
window,
|
|
||||||
cx,
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
.when_some(current_sub_page, |this, current_sub_page| {
|
.when_some(current_sub_page, |this, current_sub_page| {
|
||||||
this.custom_scrollbars(
|
this.custom_scrollbars(
|
||||||
Scrollbars::new(ui::ScrollAxes::Vertical)
|
Scrollbars::new(ui::ScrollAxes::Vertical)
|
||||||
.tracked_scroll_handle(¤t_sub_page.scroll_handle)
|
.tracked_scroll_handle(¤t_sub_page.scroll_handle)
|
||||||
.with_overlay_track_along(ui::ScrollAxes::Vertical)
|
|
||||||
.id((current_sub_page.link.title.clone(), 42)),
|
.id((current_sub_page.link.title.clone(), 42)),
|
||||||
window,
|
window,
|
||||||
cx,
|
cx,
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,6 @@ enum ReservedSpace {
|
||||||
None,
|
None,
|
||||||
Thumb,
|
Thumb,
|
||||||
Track,
|
Track,
|
||||||
OverlayTrack,
|
|
||||||
StableTrack,
|
StableTrack,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -331,7 +330,7 @@ impl ReservedSpace {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn needs_scroll_track(&self) -> bool {
|
fn needs_scroll_track(&self) -> bool {
|
||||||
matches!(self, Self::Track | Self::OverlayTrack | Self::StableTrack)
|
matches!(self, Self::Thumb | Self::Track | Self::StableTrack)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn needs_space_reserved(&self, max_offset: Pixels) -> bool {
|
fn needs_space_reserved(&self, max_offset: Pixels) -> bool {
|
||||||
|
|
@ -474,11 +473,6 @@ impl<ScrollHandle: ScrollableHandle> Scrollbars<ScrollHandle> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_overlay_track_along(mut self, along: ScrollAxes) -> Self {
|
|
||||||
self.visibility = along.apply_to(self.visibility, ReservedSpace::OverlayTrack);
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn with_stable_track_along(mut self, along: ScrollAxes, background_color: Hsla) -> Self {
|
pub fn with_stable_track_along(mut self, along: ScrollAxes, background_color: Hsla) -> Self {
|
||||||
self.visibility = along.apply_to(self.visibility, ReservedSpace::StableTrack);
|
self.visibility = along.apply_to(self.visibility, ReservedSpace::StableTrack);
|
||||||
self.track_color = Some(background_color);
|
self.track_color = Some(background_color);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue