improve performance for TUI

This commit is contained in:
Evan Almloff committed 2023-02-07 20:55:01 -06:00
1 parent 9702ee3e19
commit a720507094
2 files changed
+119 -3

No files matched your search

+5 -3
View File
@@ -165,13 +165,15 @@ pub fn render<R: Renderer<Rc<EventData>>>(
.unwrap();
// the root node fills the entire area
let mut style = *taffy.style(root_node).unwrap();
style.size = Size {
let new_size = Size {
width: Dimension::Points(width),
height: Dimension::Points(height),
};
taffy.set_style(root_node, style).unwrap();
if style.size != new_size {
style.size = new_size;
taffy.set_style(root_node, style).unwrap();
}
let size = Size {
width: AvailableSpace::Definite(width),