summaryrefslogtreecommitdiffstats
path: root/core/src/layout.rs
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/layout.rs')
-rw-r--r--core/src/layout.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/src/layout.rs b/core/src/layout.rs
index 50ccf1f4..caf315b6 100644
--- a/core/src/layout.rs
+++ b/core/src/layout.rs
@@ -71,7 +71,7 @@ pub fn next_to_each_other(
left: impl FnOnce(&Limits) -> Node,
right: impl FnOnce(&Limits) -> Node,
) -> Node {
- let left_node = left(limits);
+ let mut left_node = left(limits);
let left_size = left_node.size();
let right_limits = limits.shrink(Size::new(left_size.width + spacing, 0.0));
@@ -79,7 +79,14 @@ pub fn next_to_each_other(
let mut right_node = right(&right_limits);
let right_size = right_node.size();
- right_node.move_to(Point::new(left_size.width + spacing, 0.0));
+ let (left_y, right_y) = if left_size.height > right_size.height {
+ (0.0, (left_size.height - right_size.height) / 2.0)
+ } else {
+ ((right_size.height - left_size.height) / 2.0, 0.0)
+ };
+
+ left_node.move_to(Point::new(0.0, left_y));
+ right_node.move_to(Point::new(left_size.width + spacing, right_y));
Node::with_children(
Size::new(