fix text centering!

This commit is contained in:
🪞👃🪞 2025-01-10 19:23:00 +01:00
parent 6746844b7b
commit 1dcce2502f

View file

@ -5,7 +5,8 @@ impl Content<TuiOut> for &str {
to.center_xy([self.chars().count() as u16, 1])
}
fn render (&self, to: &mut TuiOut) {
to.blit(self, to.area.x(), to.area.y(), None)
let [x, y, ..] = Content::layout(self, to.area());
to.blit(self, x, y, None)
}
}
@ -14,7 +15,8 @@ impl Content<TuiOut> for String {
to.center_xy([self.chars().count() as u16, 1])
}
fn render (&self, to: &mut TuiOut) {
to.blit(self, to.area.x(), to.area.y(), None)
let [x, y, ..] = Content::layout(self, to.area());
to.blit(self, x, y, None)
}
}