Fix disappearing items in rows
This commit is contained in:
@@ -4,7 +4,7 @@ pub struct SpacedRows(pub Vec<(LayoutItem, Box<dyn Widget>)>);
|
|||||||
|
|
||||||
impl Widget for SpacedRows {
|
impl Widget for SpacedRows {
|
||||||
fn render(&self, scope: &mut crate::render::RenderScope) {
|
fn render(&self, scope: &mut crate::render::RenderScope) {
|
||||||
let mut alloc = scope.rect.allocate(&crate::layout::LayoutItem::Rows {
|
let alloc = scope.rect.allocate(&crate::layout::LayoutItem::Rows {
|
||||||
unit: Percent(100),
|
unit: Percent(100),
|
||||||
items: self.0.iter().map(|v| v.0.clone()).collect(),
|
items: self.0.iter().map(|v| v.0.clone()).collect(),
|
||||||
});
|
});
|
||||||
@@ -13,8 +13,9 @@ impl Widget for SpacedRows {
|
|||||||
let item = &self.0[i];
|
let item = &self.0[i];
|
||||||
|
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
let rect = &mut alloc.widgets[i];
|
let rect = &alloc.widgets[i];
|
||||||
scope.draw_text((0, rect.y - 1), "─".repeat(rect.width as usize));
|
|
||||||
|
scope.draw_text((0, rect.y - 2), "─".repeat(rect.width as usize));
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc.draw(i, &*item.1);
|
alloc.draw(i, &*item.1);
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ impl App for PulseTradeApp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn render(&mut self, layout: pulse_ui::layout::Allocation) {
|
async fn render(&mut self, layout: pulse_ui::layout::Allocation) {
|
||||||
// layout.draw_frame(0, Outline);
|
layout.draw_frame(0, Outline);
|
||||||
|
|
||||||
layout.draw(
|
layout.draw(
|
||||||
0,
|
0,
|
||||||
|
|||||||
Reference in New Issue
Block a user