fix root node layout

This commit is contained in:
Evan Almloff committed 2022-12-05 20:18:10 -06:00
1 parent e6a11f50dd
commit a823b45af9
3 files changed
+20 -17

No files matched your search

+16 -6
View File
@@ -152,14 +152,24 @@ fn render_vdom(
let width = dims.width;
let height = dims.height;
let root_node = rdom[NodeId(0)].state.layout.node.unwrap();
taffy
// the root node fills the entire area
let mut style=*taffy.style(root_node).unwrap();
style.size=Size {
width: Dimension::Points(width as f32),
height: Dimension::Points(height as f32),
};
taffy.set_style(root_node, style).unwrap();
let size =Size {
width: AvailableSpace::Definite(width as f32),
height: AvailableSpace::Definite(height as f32),
};
taffy
.compute_layout(
root_node,
Size {
width: AvailableSpace::Definite((width - 1) as f32),
height: AvailableSpace::Definite((height - 1) as f32),
},
size
)
.unwrap();
}