| ... | @@ -153,10 +153,13 @@ impl Ui { | ... | @@ -153,10 +153,13 @@ impl Ui { |
| 153 | let mut nodes = Vec::new(); | 153 | let mut nodes = Vec::new(); |
| 154 | let mut children = Vec::new(); | 154 | let mut children = Vec::new(); |
| 155 | let mut seen = HashSet::from([Id::ROOT]); | 155 | let mut seen = HashSet::from([Id::ROOT]); |
| 156 | self.describe(0, scale, None, &mut children, &mut nodes, &mut seen); | | |
| 157 | let mut root = Node::new(Role::Window); | 156 | let mut root = Node::new(Role::Window); |
| 158 | root.set_label(label); | 157 | root.set_label(label); |
| 159 | root.set_bounds(bounds(self.nodes[0].rect, scale)); | 158 | // Before the first frame is built, the window is all there is. |
| | 159 | if let Some(built) = self.nodes.first() { |
| | 160 | self.describe(0, scale, None, &mut children, &mut nodes, &mut seen); |
| | 161 | root.set_bounds(bounds(built.rect, scale)); |
| | 162 | } |
| 160 | root.set_children(children.into_iter().map(|(id, _)| id).collect::<Vec<_>>()); | 163 | root.set_children(children.into_iter().map(|(id, _)| id).collect::<Vec<_>>()); |
| 161 | nodes.push((Id::ROOT, root)); | 164 | nodes.push((Id::ROOT, root)); |
| 162 | let focus = self.focus.filter(|focus| seen.contains(focus)); | 165 | let focus = self.focus.filter(|focus| seen.contains(focus)); |