tabs: pad scroll containers for shadow bleed
This commit is contained in:
+25
-11
@@ -738,9 +738,17 @@ impl RenderOnce for Tabs {
|
||||
|
||||
let focus = gpui_native_utils::focus_handle(&self.id, window, cx);
|
||||
// Theme reads end here, so the strip's group chips can take `cx` mutably.
|
||||
let (medium_text_size, border_color) = {
|
||||
let (medium_text_size, border_color, shadow_bleed) = {
|
||||
let theme = cx.theme();
|
||||
(theme.sizes.medium.text_size, theme.colors.border)
|
||||
let shadow_bleed = match self.variant {
|
||||
TabsVariant::Pill => theme.elevations.control.bleed(),
|
||||
TabsVariant::Underline => Pixels::ZERO,
|
||||
};
|
||||
(
|
||||
theme.sizes.medium.text_size,
|
||||
theme.colors.border,
|
||||
shadow_bleed,
|
||||
)
|
||||
};
|
||||
|
||||
let label = self
|
||||
@@ -902,7 +910,7 @@ impl RenderOnce for Tabs {
|
||||
|_, _, _, _| {},
|
||||
)
|
||||
.absolute()
|
||||
.inset_0();
|
||||
.inset(shadow_bleed);
|
||||
let trigger_canvas = canvas(
|
||||
{
|
||||
let key = measure_key;
|
||||
@@ -929,6 +937,8 @@ impl RenderOnce for Tabs {
|
||||
root.min_w_0()
|
||||
.flex_grow(1.0)
|
||||
.overflow_hidden()
|
||||
.p(shadow_bleed)
|
||||
.m(-shadow_bleed)
|
||||
.child(container_canvas)
|
||||
.child(
|
||||
div()
|
||||
@@ -940,14 +950,18 @@ impl RenderOnce for Tabs {
|
||||
)
|
||||
.child(control.child(trigger_canvas))
|
||||
} else if self.overflow_scroll {
|
||||
root.min_w_0().overflow_x_scroll().child(
|
||||
div()
|
||||
.flex_none()
|
||||
.flex()
|
||||
.gap_1()
|
||||
.when(self.variant == TabsVariant::Pill, |row| row.items_center())
|
||||
.children(strip),
|
||||
)
|
||||
root.min_w_0()
|
||||
.overflow_x_scroll()
|
||||
.p(shadow_bleed)
|
||||
.m(-shadow_bleed)
|
||||
.child(
|
||||
div()
|
||||
.flex_none()
|
||||
.flex()
|
||||
.gap_1()
|
||||
.when(self.variant == TabsVariant::Pill, |row| row.items_center())
|
||||
.children(strip),
|
||||
)
|
||||
} else {
|
||||
root.children(strip)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user