From 0aa470a350f913f12c9db3e18c5e80b5b74edfd6 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 4 Nov 2026 23:55:40 -0300 Subject: gui: an instance's transition fields are written once: emitInstance no longer spells out the defaults CellInstance already has, and setTransitionFields with no track leaves a new instance as it is instead of zeroing it again Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/gui/gui.zig | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) (limited to 'src/gui/gui.zig') diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 61bd61f0..63cee882 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -1873,6 +1873,8 @@ fn ndcBox(box: pardes.animation.Box, layout: CellLayout, win_w: f32, win_h: f32) }; } +/// A new instance's transition fields for `track`, which moves its pane; +/// with none it keeps its defaults (still, all of it shown). fn setTransitionFields( instance: anytype, track: ?pardes.animation.Track, @@ -1881,21 +1883,7 @@ fn setTransitionFields( win_h: f32, cell_coord: u32, ) void { - const active = track orelse { - instance.panel_x0 = 0; - instance.panel_y0 = 0; - instance.panel_x1 = 0; - instance.panel_y1 = 0; - instance.present_x0 = 0; - instance.present_y0 = 0; - instance.present_x1 = 0; - instance.present_y1 = 0; - instance.effect = 0; - instance.progress_bits = @bitCast(@as(f32, 1)); - instance.serial = 0; - instance.cell_coord = cell_coord; - return; - }; + const active = track orelse return; const final = ndcBox(active.contentBox(), layout, win_w, win_h); const presented = ndcBox(active.visualBox(), layout, win_w, win_h); instance.panel_x0 = final[0]; @@ -7507,18 +7495,6 @@ fn emitInstance( .br = @as(f32, @floatFromInt(resolved.bg[0])) / 255.0, .bg = @as(f32, @floatFromInt(resolved.bg[1])) / 255.0, .bb = @as(f32, @floatFromInt(resolved.bg[2])) / 255.0, - .panel_x0 = 0, - .panel_y0 = 0, - .panel_x1 = 0, - .panel_y1 = 0, - .present_x0 = 0, - .present_y0 = 0, - .present_x1 = 0, - .present_y1 = 0, - .effect = 0, - .progress_bits = @bitCast(@as(f32, 1)), - .serial = 0, - .cell_coord = 0, }; setTransitionFields( &instances[idx], -- cgit v1.3