From 35481e2c79b0ec43776255ff19aa2744ccce07ba Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Wed, 29 Nov 2023 10:05:31 -0700 Subject: [PATCH] Move padding on uniform list inside the scrollable area --- crates/gpui2/src/elements/uniform_list.rs | 6 ++---- crates/picker2/src/picker2.rs | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/gpui2/src/elements/uniform_list.rs b/crates/gpui2/src/elements/uniform_list.rs index 8e61f247bd..2d5a46f3d9 100644 --- a/crates/gpui2/src/elements/uniform_list.rs +++ b/crates/gpui2/src/elements/uniform_list.rs @@ -173,7 +173,7 @@ impl Element for UniformList { let item_size = element_state.item_size; let content_size = Size { width: padded_bounds.size.width, - height: item_size.height * self.item_count, + height: item_size.height * self.item_count + padding.top + padding.bottom, }; let shared_scroll_offset = element_state @@ -221,9 +221,7 @@ impl Element for UniformList { let items = (self.render_items)(visible_range.clone(), cx); cx.with_z_index(1, |cx| { - let content_mask = ContentMask { - bounds: padded_bounds, - }; + let content_mask = ContentMask { bounds }; cx.with_content_mask(Some(content_mask), |cx| { for (item, ix) in items.into_iter().zip(visible_range) { let item_origin = padded_bounds.origin diff --git a/crates/picker2/src/picker2.rs b/crates/picker2/src/picker2.rs index 672cb12466..44056dabd1 100644 --- a/crates/picker2/src/picker2.rs +++ b/crates/picker2/src/picker2.rs @@ -205,7 +205,6 @@ impl Render for Picker { .when(self.delegate.match_count() > 0, |el| { el.child( v_stack() - .p_1() .grow() .child( uniform_list( @@ -239,7 +238,8 @@ impl Render for Picker { } }, ) - .track_scroll(self.scroll_handle.clone()), + .track_scroll(self.scroll_handle.clone()) + .p_1() ) .max_h_72() .overflow_hidden(),