sampler_view: use Map::east/south

This commit is contained in:
🪞👃🪞 2025-04-25 14:00:12 +03:00
parent 09edbbe730
commit 8b0e484114
2 changed files with 16 additions and 5 deletions

View file

@ -2,10 +2,21 @@ use crate::*;
impl Sampler {
pub fn view_grid (&self) -> impl Content<TuiOut> {
let pos = |x|Align::c(Fixed::xy(64, 32, Align::nw(x)));
pos(Map::new(||0..8u16, |x, _|Map::new(||0..8u16, move|y, _|{
Pull::x(2, Push::xy(x * 5, y * 2, Tui::bg(Color::Black, "SMPL")))
})))
let cells_x = 8u16;
let cells_y = 8u16;
let cell_width = 8u16;
let cell_height = 2u16;
let width = cells_x * cell_width;
let height = cells_y * cell_height;
let pos = |a|Align::c(Tui::bg(Color::Black, Fixed::xy(width, height, a)));
let cell = move|y, _|Fixed::xy(cell_width, cell_height, "x");
let rows = move|x, _|Map::south(cell_height, move||0..cells_y, cell);
let cols = Map::east(cell_width, move||0..cells_x, rows);
pos(cols)
//Fixed::xy(cell_width, 2, Bsp::s(
//format!("{x}x{y}"),
//RepeatH(Phat::<()>::HI),
//)))))))))
}
}