Delta semántico · 6
src/result.rs
- cambió de firma struct Layout pub
- cambió por dentro def new
diff --git a/src/algo.rs b/src/algo.rs
index e40e1cb0b..2dab93beb 100644
--- a/src/algo.rs
+++ b/src/algo.rs
@@ -89,8 +89,7 @@ impl Forest {
self.compute_internal(root, style.size.resolve(size), size, true, true)
};
- self.nodes[root].layout =
- result::Layout { order: 0, size: result.size, location: Point::zero(), relative_location: Point::zero() };
+ self.nodes[root].layout = result::Layout { order: 0, size: result.size, location: Point::zero() };
Self::round_layout(&mut self.nodes, &self.children, root, 0.0, 0.0);
}
@@ -103,11 +102,11 @@ impl Forest {
abs_y: f32,
) {
let layout = &mut nodes[root].layout;
- let abs_x = abs_x + layout.relative_location.x;
- let abs_y = abs_y + layout.relative_location.y;
+ let abs_x = abs_x + layout.location.x;
+ let abs_y = abs_y + layout.location.y;
- layout.location.x = sys::round(abs_x);
- layout.location.y = sys::round(abs_y);
+ layout.location.x = sys::round(layout.location.x);
+ layout.location.y = sys::round(layout.location.y);
layout.size.width = sys::round(abs_x + layout.size.width) - sys::round(abs_x);
layout.size.height = sys::round(abs_y + layout.size.height) - sys::round(abs_y);
@@ -749,7 +748,6 @@ impl Forest {
order: self.children[node].iter().position(|n| *n == child.node).unwrap() as u32,
size: result.size,
location: Point::zero(),
- relative_location: Point::zero(),
},
);
}
@@ -1156,8 +1154,7 @@ impl Forest {
self.nodes[child.node].layout = result::Layout {
order: self.children[node].iter().position(|n| *n == child.node).unwrap() as u32,
size: result.size,
- location: Point::zero(),
- relative_location: Point {
+ location: Point {
x: if is_row { offset_main } else { offset_cross },
y: if is_column { offset_main } else { offset_cross },
},
@@ -1306,18 +1303,16 @@ impl Forest {
self.nodes[child].layout = result::Layout {
order: order as u32,
size: result.size,
- relative_location: Point {
+ location: Point {
x: if is_row { offset_main } else { offset_cross },
y: if is_column { offset_main } else { offset_cross },
},
- location: Point::zero(),
};
}
}
fn hidden_layout(nodes: &mut [NodeData], children: &[sys::ChildrenVec<NodeId>], node: NodeId, order: u32) {
- nodes[node].layout =
- result::Layout { order, size: Size::zero(), location: Point::zero(), relative_location: Point::zero() };
+ nodes[node].layout = result::Layout { order, size: Size::zero(), location: Point::zero() };
for (order, child) in children[node].iter().enumerate() {
hidden_layout(nodes, children, *child, order as _);
diff --git a/src/result.rs b/src/result.rs
index 3ca8da767..ff3619fe3 100644
--- a/src/result.rs
+++ b/src/result.rs
@@ -8,12 +8,11 @@ pub struct Layout {
pub(crate) order: u32,
pub size: Size<f32>,
pub location: Point<f32>,
- pub(crate) relative_location: Point<f32>,
}
impl Layout {
pub(crate) fn new() -> Self {
- Self { order: 0, size: Size::zero(), location: Point::zero(), relative_location: Point::zero() }
+ Self { order: 0, size: Size::zero(), location: Point::zero() }
}
}