From 8ad736da8d39d61b44bb50a5e38e8b1cd5773993 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 25 Aug 2023 22:19:49 -0600 Subject: [PATCH] WIP --- crates/gpui/playground/src/playground.rs | 15 ++------------- crates/gpui/src/app/window.rs | 11 +++++++---- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/crates/gpui/playground/src/playground.rs b/crates/gpui/playground/src/playground.rs index bd184ac621d2a8dfdc0c6e530c782365348b95ba..88e953b8bc953d232668baeed49c48708ad2e423 100644 --- a/crates/gpui/playground/src/playground.rs +++ b/crates/gpui/playground/src/playground.rs @@ -55,17 +55,6 @@ fn playground(theme: &ThemeColors) -> impl Element { .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())) } diff --git a/crates/gpui/src/app/window.rs b/crates/gpui/src/app/window.rs index 62c514b4e95d5a85a10b96abdc114dc2f79b38f0..a372b865fe017a56da79896d9cf002385b24515a 100644 --- a/crates/gpui/src/app/window.rs +++ b/crates/gpui/src/app/window.rs @@ -1276,9 +1276,12 @@ impl LayoutEngine { where C: IntoIterator, { - Ok(self - .0 - .new_with_children(style, &children.into_iter().collect::>())?) + let children = children.into_iter().collect::>(); + if children.is_empty() { + Ok(self.0.new_leaf(style)?) + } else { + Ok(self.0.new_with_children(style, &children)?) + } } pub fn add_measured_node(&mut self, style: LayoutStyle, measure: F) -> Result @@ -1302,7 +1305,7 @@ impl LayoutEngine { } pub fn computed_layout(&mut self, node: LayoutId) -> Result { - dbg!(Ok(self.0.layout(node)?.into())) + Ok(EngineLayout::from(self.0.layout(node)?)) } }