summaryrefslogtreecommitdiffstats
path: root/src/tuice/layout/build_layout.rs
blob: d9fdddaefe3dc4784082c3538bf16bbc011e83ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use tui::layout::Rect;

use crate::tuice::{Bounds, Element, LayoutNode, TmpComponent};

pub fn build_layout_tree<Message>(rect: Rect, root: &Element<'_, Message>) -> LayoutNode {
    let mut root_layout_node = LayoutNode::from_rect(rect);
    let bounds = Bounds {
        min_width: 0,
        min_height: 0,
        max_width: rect.width,
        max_height: rect.height,
    };

    let _ = root.layout(bounds, &mut root_layout_node);

    root_layout_node
}