Change summary
crates/gpui/playground/src/playground.rs | 15 ++-------------
crates/gpui/src/app/window.rs | 11 +++++++----
2 files changed, 9 insertions(+), 17 deletions(-)
Detailed changes
@@ -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()))
}
@@ -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)?))
}
}