diff --git a/crates/ui/src/components/scrollbar.rs b/crates/ui/src/components/scrollbar.rs index eb1d210280872a8b1606439c04c1f67954e50373..d3d33a296bbd65edb24371d8f5f1e6462e77e3fe 100644 --- a/crates/ui/src/components/scrollbar.rs +++ b/crates/ui/src/components/scrollbar.rs @@ -1171,12 +1171,14 @@ impl Element for ScrollbarElement { .apply_along(axis, |_| thumb_end - thumb_offset), ); + let needs_scroll_track = reserved_space.needs_scroll_track(); + ScrollbarLayout { thumb_bounds, track_bounds: padded_bounds, axis, cursor_hitbox: window.insert_hitbox( - if reserved_space.needs_scroll_track() { + if needs_scroll_track { padded_bounds } else { thumb_bounds @@ -1184,6 +1186,7 @@ impl Element for ScrollbarElement { HitboxBehavior::BlockMouseExceptScroll, ), track_background: track_color + .filter(|_| needs_scroll_track) .map(|color| (padded_bounds.dilate(SCROLLBAR_PADDING), color)), reserved_space, } @@ -1292,10 +1295,15 @@ impl Element for ScrollbarElement { } if let Some((track_bounds, color)) = track_background { + let mut color = *color; + if let Some(fade) = autohide_fade { + color.fade_out(fade); + } + window.paint_quad(quad( *track_bounds, Corners::default(), - *color, + color, Edges::default(), Hsla::transparent_black(), BorderStyle::default(),