@@ -79,27 +79,23 @@ impl Container {
7979 y: f64,
8080 s: f64,
8181 content: u32,
82− ) -> Vec<Node<'bump>>
83− where
82+ children: &mut bumpalo::collections::Vec<Node<'bump>>,
83+ ) where
8484 'a: 'bump,
8585 {
8686 if s <= self.size {
87− return vec![self.dot(bump, x, y, content)];
87+ children.push(self.dot(bump, x, y, content));
88+ return;
8889 }
8990
9091 let s = s / 2.0;
9192
92− vec![
93− // Top of triangle
94− self.triangle(bump, x, y - (s / 2.0), s, content),
95− // Bottom-left of triangle
96− self.triangle(bump, x - s, y + (s / 2.0), s, content),
97− // Bottom-right of triangle
98− self.triangle(bump, x + s, y + (s / 2.0), s, content),
99− ]
100− .into_iter()
101− .flatten()
102− .collect()
93+ // Top of triangle
94+ self.triangle(bump, x, y - (s / 2.0), s, content, children);
95+ // Bottom-left of triangle
96+ self.triangle(bump, x - s, y + (s / 2.0), s, content, children);
97+ // Bottom-right of triangle
98+ self.triangle(bump, x + s, y + (s / 2.0), s, content, children);
10399 }
104100}
105101
@@ -119,10 +115,13 @@ impl Render for Container {
119115
120116 let modulus = elapsed as u32 % 10;
121117
118+ let mut children = bumpalo::collections::Vec::new_in(bump);
119+ self.triangle(bump, 0.0, 0.0, 1000.0, modulus, &mut children);
120+
122121 div(bump)
123122 .attr("class", "container")
124123 .attr("style", self.container_transform(bump, elapsed))
125− .children(self.triangle(bump, 0.0, 0.0, 1000.0, modulus))
124+ .children(children)
126125 .finish()
127126 }
128127}