Fix tabs layout
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
c55d99022e
commit
d5a9bab4a0
3 changed files with 13 additions and 3 deletions
|
@ -53,6 +53,11 @@ impl Container {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn with_padding_bottom(mut self, padding: f32) -> Self {
|
||||||
|
self.padding.bottom = padding;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn with_background_color(mut self, color: impl Into<ColorU>) -> Self {
|
pub fn with_background_color(mut self, color: impl Into<ColorU>) -> Self {
|
||||||
self.background_color = Some(color.into());
|
self.background_color = Some(color.into());
|
||||||
self
|
self
|
||||||
|
|
|
@ -38,7 +38,11 @@ impl Element for LineBox {
|
||||||
.select_font(self.family_id, &self.font_properties)
|
.select_font(self.family_id, &self.font_properties)
|
||||||
{
|
{
|
||||||
Ok(font_id) => {
|
Ok(font_id) => {
|
||||||
let line_height = ctx.font_cache.bounding_box(font_id, self.font_size).y();
|
let line_height = ctx
|
||||||
|
.font_cache
|
||||||
|
.bounding_box(font_id, self.font_size)
|
||||||
|
.y()
|
||||||
|
.ceil();
|
||||||
let child_max = vec2f(
|
let child_max = vec2f(
|
||||||
constraint.max.x(),
|
constraint.max.x(),
|
||||||
ctx.font_cache.ascent(font_id, self.font_size)
|
ctx.font_cache.ascent(font_id, self.font_size)
|
||||||
|
|
|
@ -187,19 +187,20 @@ impl Pane {
|
||||||
border.right = ix == last_item_ix;
|
border.right = ix == last_item_ix;
|
||||||
border.bottom = ix != self.active_item;
|
border.bottom = ix != self.active_item;
|
||||||
|
|
||||||
|
let padding = 6.;
|
||||||
let mut container = Container::new(
|
let mut container = Container::new(
|
||||||
Align::new(
|
Align::new(
|
||||||
Label::new(title, settings.ui_font_family, settings.ui_font_size).boxed(),
|
Label::new(title, settings.ui_font_family, settings.ui_font_size).boxed(),
|
||||||
)
|
)
|
||||||
.boxed(),
|
.boxed(),
|
||||||
)
|
)
|
||||||
.with_uniform_padding(6.0)
|
.with_uniform_padding(padding)
|
||||||
.with_border(border);
|
.with_border(border);
|
||||||
|
|
||||||
if ix == self.active_item {
|
if ix == self.active_item {
|
||||||
container = container
|
container = container
|
||||||
.with_background_color(ColorU::white())
|
.with_background_color(ColorU::white())
|
||||||
.with_overdraw_bottom(1.5);
|
.with_padding_bottom(padding + border.width);
|
||||||
} else {
|
} else {
|
||||||
container = container.with_background_color(ColorU::from_u32(0xeaeaebff));
|
container = container.with_background_color(ColorU::from_u32(0xeaeaebff));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue