Separated allocation
This commit is contained in:
+6
-13
@@ -1,13 +1,10 @@
|
||||
use pulse_ui::layout::{LayoutItem, Rect, Size};
|
||||
use pulse_ui::layout::{LayoutItem, Rect, Size, layout};
|
||||
|
||||
fn main() {
|
||||
let layout = LayoutItem::Columns {
|
||||
unit: Size::Percent(100),
|
||||
items: vec![
|
||||
LayoutItem::Widget(Size::Flex(16)),
|
||||
LayoutItem::Widget(Size::Flex(9)),
|
||||
],
|
||||
};
|
||||
let layout = layout(vec![
|
||||
LayoutItem::Widget(Size::Flex(16)),
|
||||
LayoutItem::Widget(Size::Flex(9)),
|
||||
]);
|
||||
|
||||
let screen = Rect {
|
||||
x: 0,
|
||||
@@ -16,9 +13,5 @@ fn main() {
|
||||
height: 3000,
|
||||
};
|
||||
|
||||
let mut layout_alloc = Vec::new();
|
||||
|
||||
layout.allocate(&screen, &mut layout_alloc);
|
||||
|
||||
println!("{:?}", layout_alloc);
|
||||
println!("{:?}", screen.allocate(&layout));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user