Skip to content

Commit d59ecf7

Browse files
authored
ui: Don't show scrollbar track in too many cases (#41455)
Follow-up to #41354 which introduced a small regression. Release Notes: - N/A
1 parent bde7e55 commit d59ecf7

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

crates/ui/src/components/scrollbar.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,19 +1171,22 @@ impl<T: ScrollableHandle> Element for ScrollbarElement<T> {
11711171
.apply_along(axis, |_| thumb_end - thumb_offset),
11721172
);
11731173

1174+
let needs_scroll_track = reserved_space.needs_scroll_track();
1175+
11741176
ScrollbarLayout {
11751177
thumb_bounds,
11761178
track_bounds: padded_bounds,
11771179
axis,
11781180
cursor_hitbox: window.insert_hitbox(
1179-
if reserved_space.needs_scroll_track() {
1181+
if needs_scroll_track {
11801182
padded_bounds
11811183
} else {
11821184
thumb_bounds
11831185
},
11841186
HitboxBehavior::BlockMouseExceptScroll,
11851187
),
11861188
track_background: track_color
1189+
.filter(|_| needs_scroll_track)
11871190
.map(|color| (padded_bounds.dilate(SCROLLBAR_PADDING), color)),
11881191
reserved_space,
11891192
}
@@ -1292,10 +1295,15 @@ impl<T: ScrollableHandle> Element for ScrollbarElement<T> {
12921295
}
12931296

12941297
if let Some((track_bounds, color)) = track_background {
1298+
let mut color = *color;
1299+
if let Some(fade) = autohide_fade {
1300+
color.fade_out(fade);
1301+
}
1302+
12951303
window.paint_quad(quad(
12961304
*track_bounds,
12971305
Corners::default(),
1298-
*color,
1306+
color,
12991307
Edges::default(),
13001308
Hsla::transparent_black(),
13011309
BorderStyle::default(),

0 commit comments

Comments
 (0)