this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

vxfw(FlexRow): fix flex logic

Reference: #201

+10 -9
+10 -9
src/vxfw/FlexRow.zig
··· 41 41 var first_pass_width: u16 = 0; 42 42 var total_flex: u16 = 0; 43 43 for (self.children, 0..) |child, i| { 44 - const surf = try child.widget.draw(layout_ctx); 45 - first_pass_width += surf.size.width; 44 + if (child.flex == 0) { 45 + const surf = try child.widget.draw(layout_ctx); 46 + first_pass_width += surf.size.width; 47 + size_list[i] = surf.size.width; 48 + } 46 49 total_flex += child.flex; 47 - size_list[i] = surf.size.width; 48 50 } 49 51 50 52 // We are done with the layout arena ··· 57 59 var second_pass_width: u16 = 0; 58 60 var max_height: u16 = 0; 59 61 const remaining_space = ctx.max.width.? - first_pass_width; 60 - for (self.children, 1..) |child, i| { 61 - const inherent_width = size_list[i - 1]; 62 + for (self.children, 0..) |child, i| { 62 63 const child_width = if (child.flex == 0) 63 - inherent_width 64 - else if (i == self.children.len) 64 + size_list[i] 65 + else if (i == self.children.len - 1) 65 66 // If we are the last one, we just get the remainder 66 - ctx.max.width.? - second_pass_width 67 + ctx.max.width.? -| second_pass_width 67 68 else 68 - inherent_width + (remaining_space * child.flex) / total_flex; 69 + (remaining_space * child.flex) / total_flex; 69 70 70 71 // Create a context for the child 71 72 const child_ctx = ctx.withConstraints(