moar flat

This commit is contained in:
facile pop culture reference 2026-08-01 17:52:37 +03:00
parent fc01fd6ad3
commit a27dacff93
29 changed files with 649 additions and 582 deletions

View file

@ -5,9 +5,9 @@ use super::{*, draw::*};
/// ```
/// /// TODO
/// ```
pub fn border (on: bool, style: impl BorderStyle, draw: impl Draw<Tui>) -> impl Draw<Tui> {
let content = draw.pad_wh(1, 1);
let outline = when(on, thunk(move|to: &mut Tui|{
pub fn border (on: bool, style: impl BorderStyle, item: impl Draw<Tui>) -> impl Draw<Tui> {
let content = item.pad_wh(1, 1);
let outline = when(on, draw(move|to: &mut Tui|{
let XYWH(x, y, w, h) = to.1;
if w > 0 && h > 0 {
to.blit(&style.border_nw(), x, y, style.style());
@ -49,7 +49,7 @@ macro_rules! border {
//impl Layout<Tui> for $T {}
impl Draw<Tui> for $T {
fn draw (self, to: &mut Tui) -> Perhaps<XYWH<u16>> {
when(self.enabled(), thunk(|to: &mut Tui|BorderStyle::draw(self, to).map(Some))).draw(to)
when(self.enabled(), draw(|to: &mut Tui|BorderStyle::draw(self, to).map(Some))).draw(to)
}
}
)+}