This commit is contained in:
Nathan Sobo 2023-08-25 22:19:49 -06:00
parent 147aa0f695
commit 8ad736da8d
2 changed files with 9 additions and 17 deletions

View file

@ -55,17 +55,6 @@ fn playground<V: 'static>(theme: &ThemeColors) -> impl Element<V> {
.h_full()
.w_full()
.fill(p.rose)
.block()
.child(
div()
.block()
.fill(p.pine)
.child(div().block().fill(p.love).w_6().h_3()),
)
.child(
div()
.block()
.fill(p.gold)
.child(div().block().fill(p.iris).w_3().h_3()),
)
.child(div().fill(p.pine).child(div().fill(p.love).w_6().h_3()))
.child(div().fill(p.gold).child(div().fill(p.iris).w_3().h_3()))
}

View file

@ -1276,9 +1276,12 @@ impl LayoutEngine {
where
C: IntoIterator<Item = LayoutId>,
{
Ok(self
.0
.new_with_children(style, &children.into_iter().collect::<Vec<_>>())?)
let children = children.into_iter().collect::<Vec<_>>();
if children.is_empty() {
Ok(self.0.new_leaf(style)?)
} else {
Ok(self.0.new_with_children(style, &children)?)
}
}
pub fn add_measured_node<F>(&mut self, style: LayoutStyle, measure: F) -> Result<LayoutId>
@ -1302,7 +1305,7 @@ impl LayoutEngine {
}
pub fn computed_layout(&mut self, node: LayoutId) -> Result<EngineLayout> {
dbg!(Ok(self.0.layout(node)?.into()))
Ok(EngineLayout::from(self.0.layout(node)?))
}
}