From 84b3b5cbe361fb3bb5e200792a8fe80e32a39312 Mon Sep 17 00:00:00 2001 From: George Atkinson Date: Wed, 8 Nov 2023 18:03:50 +0000 Subject: [PATCH 1/3] Actually fix child-space issue --- src/layout.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/layout.rs b/src/layout.rs index e05cdd84..8ac498e7 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -200,8 +200,8 @@ where let mut iter = node .children(tree) .filter(|child| child.visible(store)) - .enumerate() - .filter(|(_, child)| child.position_type(store).unwrap_or_default() == PositionType::ParentDirected); + .filter(|child| child.position_type(store).unwrap_or_default() == PositionType::ParentDirected) + .enumerate(); let first = iter.next().map(|(index, _)| index); let last = iter.last().map_or(first, |(index, _)| Some(index)); @@ -209,8 +209,8 @@ where let mut node_children = node .children(tree) .filter(|child| child.visible(store)) + .filter(|child| child.position_type(store).unwrap_or_default() == PositionType::ParentDirected) .enumerate() - .filter(|(_, child)| child.position_type(store).unwrap_or_default() == PositionType::ParentDirected) .peekable(); // Compute space and size of non-flexible parent-directed children. @@ -353,9 +353,9 @@ where // Compute flexible space and size on the cross-axis for parent-directed children. for (index, child) in children .iter_mut() + .filter(|child| child.node.position_type(store).unwrap_or_default() == PositionType::ParentDirected) + .filter(|child| !child.node.cross(store, layout_type).is_auto()) .enumerate() - .filter(|(_, child)| child.node.position_type(store).unwrap_or_default() == PositionType::ParentDirected) - .filter(|(_, child)| !child.node.cross(store, layout_type).is_auto()) { let mut child_cross_before = child.node.cross_before(store, layout_type); let child_cross = child.node.cross(store, layout_type); @@ -571,7 +571,7 @@ where // Compute stretch cross_before and stretch cross_after for auto cross children. // TODO: I think this only needs to be done for parent-directed children... for (index, child) in - children.iter_mut().enumerate().filter(|(_, child)| child.node.cross(store, layout_type).is_auto()) + children.iter_mut().filter(|child| child.node.cross(store, layout_type).is_auto()).enumerate() { let mut child_cross_before = child.node.cross_before(store, layout_type); let mut child_cross_after = child.node.cross_after(store, layout_type); @@ -782,8 +782,8 @@ where // Compute flexible space and size on the cross-axis for self-directed nodes. for (index, child) in children .iter_mut() + .filter(| child| child.node.position_type(store).unwrap_or_default() == PositionType::SelfDirected) .enumerate() - .filter(|(_, child)| child.node.position_type(store).unwrap_or_default() == PositionType::SelfDirected) { let mut child_cross_before = child.node.cross_before(store, layout_type); let child_cross = child.node.cross(store, layout_type); @@ -933,8 +933,8 @@ where // Compute flexible space and size on the main-axis for self-directed nodes. for (index, child) in children .iter_mut() + .filter(|child| child.node.position_type(store).unwrap_or_default() == PositionType::SelfDirected) .enumerate() - .filter(|(_, child)| child.node.position_type(store).unwrap_or_default() == PositionType::SelfDirected) { let mut child_main_before = child.node.main_before(store, layout_type); let child_main = child.node.main(store, layout_type); From aea01c74769781972d0947deb0f183fd836e0f01 Mon Sep 17 00:00:00 2001 From: George Atkinson Date: Wed, 8 Nov 2023 18:05:57 +0000 Subject: [PATCH 2/3] Bump minor version --- Cargo.toml | 2 +- ecs/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 08d7e02a..2ca85a37 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "morphorm" -version = "0.6.3" +version = "0.6.4" edition = "2021" author = "George Atkinson " license = "MIT" diff --git a/ecs/Cargo.toml b/ecs/Cargo.toml index c162e94e..f2524e05 100644 --- a/ecs/Cargo.toml +++ b/ecs/Cargo.toml @@ -6,7 +6,7 @@ description = "A mini ECS used for testing the morphorm crate." license = "MIT" [dependencies] -morphorm = {version = "0.6.3", path = "../"} +morphorm = {version = "0.6.4", path = "../"} femtovg = {version = "0.7.1", default-features = false} rand = "0.8.5" slotmap = "1.0.6" \ No newline at end of file From 8d9bb211d5f9058cce7c352dc954fc3ed14a2972 Mon Sep 17 00:00:00 2001 From: George Atkinson Date: Wed, 8 Nov 2023 18:08:32 +0000 Subject: [PATCH 3/3] fmt --- src/layout.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/layout.rs b/src/layout.rs index 8ac498e7..23d584f8 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -570,8 +570,7 @@ where // Compute stretch cross_before and stretch cross_after for auto cross children. // TODO: I think this only needs to be done for parent-directed children... - for (index, child) in - children.iter_mut().filter(|child| child.node.cross(store, layout_type).is_auto()).enumerate() + for (index, child) in children.iter_mut().filter(|child| child.node.cross(store, layout_type).is_auto()).enumerate() { let mut child_cross_before = child.node.cross_before(store, layout_type); let mut child_cross_after = child.node.cross_after(store, layout_type); @@ -782,7 +781,7 @@ where // Compute flexible space and size on the cross-axis for self-directed nodes. for (index, child) in children .iter_mut() - .filter(| child| child.node.position_type(store).unwrap_or_default() == PositionType::SelfDirected) + .filter(|child| child.node.position_type(store).unwrap_or_default() == PositionType::SelfDirected) .enumerate() { let mut child_cross_before = child.node.cross_before(store, layout_type);