feat: wire up stretch into place

This commit is contained in:
Jonathan Kelley committed 2021-12-31 23:53:37 -05:00
1 parent e3171e8303
commit dc34805ee6
14 files changed
+1430 -257

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
use stretch2::prelude::*;
fn main() -> Result<(), Error> {
let mut stretch = Stretch::new();
let child = stretch.new_node(
Style {
size: Size {
width: Dimension::Percent(0.5),
height: Dimension::Auto,
},
..Default::default()
},
&[],
)?;
let node = stretch.new_node(
Style {
size: Size {
width: Dimension::Points(100.0),
height: Dimension::Points(100.0),
},
justify_content: JustifyContent::Center,
..Default::default()
},
&[child],
)?;
stretch.compute_layout(node, Size::undefined())?;
println!("node: {:#?}", stretch.layout(node)?);
println!("child: {:#?}", stretch.layout(child)?);
Ok(())
}