Fix spacing

This commit is contained in:
2026-07-15 08:21:14 +02:00
parent 8df34ba762
commit 88e5d69087
2 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ impl LayoutItem {
let remaining = allocation
- items
.iter()
.map(|item| item.get_size().get_fixed(alloc.height))
.map(|item| item.get_size().get_fixed(allocation))
.sum::<u16>();
let total_weight = items
+7 -3
View File
@@ -4,7 +4,7 @@ pub struct SpacedRows(pub Vec<(LayoutItem, Box<dyn Widget>)>);
impl Widget for SpacedRows {
fn render(&self, scope: &mut crate::render::RenderScope) {
let alloc = scope.rect.allocate(&crate::layout::LayoutItem::Rows {
let mut alloc = scope.rect.allocate(&crate::layout::LayoutItem::Rows {
unit: Percent(100),
items: self.0.iter().map(|v| v.0.clone()).collect(),
});
@@ -13,9 +13,12 @@ impl Widget for SpacedRows {
let item = &self.0[i];
if i > 0 {
let rect = &alloc.widgets[i];
let rect = &mut alloc.widgets[i];
scope.draw_text((0, rect.y - 2), "─".repeat(rect.width as usize));
scope.draw_text((0, rect.y - 1), "─".repeat(rect.width as usize));
rect.y += 1;
rect.height -= 1;
}
alloc.draw(i, &*item.1);
@@ -42,6 +45,7 @@ impl Widget for SpacedColumns {
scope.draw_text((rect.x - 1, i), "│");
}
rect.x += 1;
rect.width -= 1;
}
alloc.draw(i, &*item.1);