chore: update zig
This commit is contained in:
parent
5766189411
commit
e9eff795f1
|
@ -4,9 +4,8 @@ pub fn build(b: *std.build.Builder) void {
|
|||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
b.addModule(.{
|
||||
.name = "boxflow",
|
||||
.source = .{ .path = "src/main.zig" },
|
||||
_ = b.addModule("boxflow", .{
|
||||
.source_file = .{ .path = "src/main.zig" },
|
||||
});
|
||||
|
||||
const main_tests = b.addTest(.{
|
||||
|
|
|
@ -53,7 +53,7 @@ fn position(self: *Self, ctx: *LayoutCtx, pos: Position) void {
|
|||
const col_width = self.data.size.width / self.cols;
|
||||
const row_height = self.data.size.height / rows;
|
||||
|
||||
for (self.children) |child, i| {
|
||||
for (self.children, 0..) |child, i| {
|
||||
if (child.data.overflow)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ fn layout(self: *Self, ctx: *LayoutCtx, cons: Constraints, final_pass: bool) any
|
|||
}
|
||||
|
||||
// set the extra space to the part of remaining space the boxes will get
|
||||
for (flex_extra_space) |*fes, i| {
|
||||
for (flex_extra_space, 0..) |*fes, i| {
|
||||
if (self.children[i].data.flex_expand > 0) {
|
||||
fes.* = @intToFloat(f64, self.children[i].data.flex_expand) / flex_sum;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ fn layout(self: *Self, ctx: *LayoutCtx, cons: Constraints, final_pass: bool) any
|
|||
}
|
||||
|
||||
// re-layout the flex children with tight constraints
|
||||
for (self.children) |*child, i| {
|
||||
for (self.children, 0..) |*child, i| {
|
||||
if (flex_extra_space[i]) |fes| {
|
||||
const child_height = @floatToInt(usize, fes) + child.data.size.height;
|
||||
const child_cons = Constraints.tight(.{
|
||||
|
@ -168,7 +168,7 @@ fn layout(self: *Self, ctx: *LayoutCtx, cons: Constraints, final_pass: bool) any
|
|||
}
|
||||
|
||||
// set the extra space to the part of remaining space the boxes will get
|
||||
for (flex_extra_space) |*fes, i| {
|
||||
for (flex_extra_space, 0..) |*fes, i| {
|
||||
if (self.children[i].data.flex_expand > 0) {
|
||||
fes.* = @intToFloat(f64, self.children[i].data.flex_expand) / flex_sum;
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ fn layout(self: *Self, ctx: *LayoutCtx, cons: Constraints, final_pass: bool) any
|
|||
}
|
||||
|
||||
// re-layout the flex children with tight constraints
|
||||
for (self.children) |*child, i| {
|
||||
for (self.children, 0..) |*child, i| {
|
||||
if (flex_extra_space[i]) |fes| {
|
||||
const child_width = @floatToInt(usize, fes) + child.data.size.width;
|
||||
const child_cons = Constraints.tight(.{
|
||||
|
@ -210,7 +210,7 @@ fn layout(self: *Self, ctx: *LayoutCtx, cons: Constraints, final_pass: bool) any
|
|||
}
|
||||
|
||||
fn position(self: *Self, ctx: *LayoutCtx, pos: Position) void {
|
||||
for (self.children) |child, i| {
|
||||
for (self.children, 0..) |child, i| {
|
||||
if (child.data.overflow)
|
||||
continue;
|
||||
|
||||
|
|
Reference in a new issue