diff --git a/crates/outline_panel/src/outline_panel.rs b/crates/outline_panel/src/outline_panel.rs index de3af65d58..cfde0ce9fb 100644 --- a/crates/outline_panel/src/outline_panel.rs +++ b/crates/outline_panel/src/outline_panel.rs @@ -4335,19 +4335,7 @@ impl OutlinePanel { { return None; } - - let scroll_handle = self.scroll_handle.0.borrow(); - let longest_item_width = scroll_handle - .last_item_size - .filter(|size| size.contents.width > size.item.width)? - .contents - .width - .0 as f64; - if longest_item_width < scroll_handle.base_handle.bounds().size.width.0 as f64 { - return None; - } - - Some( + Scrollbar::horizontal(self.horizontal_scrollbar_state.clone()).map(|scrollbar| { div() .occlude() .id("project-panel-horizontal-scroll") @@ -4384,12 +4372,8 @@ impl OutlinePanel { .bottom_0() .h(px(12.)) .cursor_default() - .when(self.width.is_some(), |this| { - this.children(Scrollbar::horizontal( - self.horizontal_scrollbar_state.clone(), - )) - }), - ) + .child(scrollbar) + }) } fn should_show_scrollbar(cx: &App) -> bool { diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index a188546dfa..9b8992fc6c 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -4340,19 +4340,7 @@ impl ProjectPanel { { return None; } - - let scroll_handle = self.scroll_handle.0.borrow(); - let longest_item_width = scroll_handle - .last_item_size - .filter(|size| size.contents.width > size.item.width)? - .contents - .width - .0 as f64; - if longest_item_width < scroll_handle.base_handle.bounds().size.width.0 as f64 { - return None; - } - - Some( + Scrollbar::horizontal(self.horizontal_scrollbar_state.clone()).map(|scrollbar| { div() .occlude() .id("project-panel-horizontal-scroll") @@ -4389,12 +4377,8 @@ impl ProjectPanel { .bottom_1() .h(px(12.)) .cursor_default() - .when(self.width.is_some(), |this| { - this.children(Scrollbar::horizontal( - self.horizontal_scrollbar_state.clone(), - )) - }), - ) + .child(scrollbar) + }) } fn dispatch_context(&self, window: &Window, cx: &Context) -> KeyContext {