summaryrefslogtreecommitdiff
path: root/src/tty/panel_compositor.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/tty/panel_compositor.zig')
-rw-r--r--src/tty/panel_compositor.zig27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/tty/panel_compositor.zig b/src/tty/panel_compositor.zig
index 9363841a..67d3a6e6 100644
--- a/src/tty/panel_compositor.zig
+++ b/src/tty/panel_compositor.zig
@@ -8,9 +8,10 @@
const std = @import("std");
const pardes = @import("../pardes.zig");
const layout = @import("../layout.zig");
+const animation = @import("../animation.zig");
-const Box = layout.Box;
-const Track = layout.Track;
+const Box = animation.Box;
+const Track = animation.Track;
/// Kitty placements cannot be resampled through the character-grid transform.
/// Keep their transmitted pixels cached, but omit the placement while its pane
@@ -77,7 +78,7 @@ pub fn compose(
// Stable layout motion first, newly opening panels above it, and closing
// tombstones last. A closing pane no longer owns input or canonical cells,
// but its frozen old content remains the top visual until it slides out.
- for ([_]layout.Phase{ .moving, .opening, .closing }) |phase| {
+ for ([_]animation.Phase{ .moving, .opening, .closing }) |phase| {
for (tracks) |track| {
if (!drawable(source, track) or track.phase != phase) continue;
switch (track.effect) {
@@ -139,7 +140,7 @@ fn dissolve(out: *pardes.Surface, source: *const pardes.Surface, track: Track) v
var x = area.x0;
while (x < area.x1) : (x += 1) {
if (!source.panelCellChanged(x, y)) continue;
- if (layout.dissolveRevealed(
+ if (animation.dissolveRevealed(
track.serial,
x - area.x0,
y - area.y0,
@@ -339,7 +340,7 @@ test "TTY content effects never touch cells outside the published diff" {
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena.deinit();
- for ([_]layout.Transition{ .ascii, .dissolve }) |effect| {
+ for ([_]animation.Transition{ .ascii, .dissolve }) |effect| {
const track: Track = .{
.serial = 17,
.effect = effect,
@@ -366,7 +367,7 @@ test "content transition without a diff snaps to canonical surface" {
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena.deinit();
- for ([_]layout.Transition{ .dissolve, .ascii, .vertical }) |effect| {
+ for ([_]animation.Transition{ .dissolve, .ascii, .vertical }) |effect| {
const track: Track = .{
.effect = effect,
.phase = .opening,
@@ -391,7 +392,7 @@ test "exact transition endpoint preserves the canonical cursor" {
};
const track: Track = .{
.effect = .ascii,
- .frame = layout.Transition.ascii.frames() - 1,
+ .frame = animation.Transition.ascii.frames() - 1,
.from = .{ .w = 1, .h = 1 },
.to = .{ .w = 1, .h = 1 },
};
@@ -431,7 +432,7 @@ test "vertical opening rises through a fixed old-grid clip" {
.serial = 5,
.phase = .opening,
.effect = .vertical,
- .from = layout.openingBox(.vertical, target, 3),
+ .from = animation.openingBox(.vertical, target, 3),
.to = target,
};
@@ -485,7 +486,7 @@ test "vertical closing drops frozen content over canonical cells" {
.phase = .closing,
.effect = .vertical,
.from = old_box,
- .to = layout.closingBox(.vertical, old_box),
+ .to = animation.closingBox(.vertical, old_box),
};
const first = try compose(arena.allocator(), &surface, &.{track}, null);
@@ -530,13 +531,13 @@ test "closing content paints after opening content regardless of track order" {
.phase = .closing,
.effect = .vertical,
.from = box,
- .to = layout.closingBox(.vertical, box),
+ .to = animation.closingBox(.vertical, box),
};
const opening: Track = .{
.serial = 2,
.phase = .opening,
.effect = .ascii,
- .frame = layout.Transition.ascii.frames() - 1,
+ .frame = animation.Transition.ascii.frames() - 1,
.from = box,
.to = box,
};
@@ -691,8 +692,8 @@ test "active panel transition hides only its own native attachment" {
const tracks = [_]Track{
.{ .serial = 41, .effect = .slide, .frame = 0 },
.{ .serial = 42, .effect = .ascii, .frame = 0 },
- .{ .serial = 43, .effect = .zoom, .frame = layout.Transition.zoom.frames() - 1 },
- .{ .serial = 44, .effect = .zoom, .frame = layout.Transition.zoom.frames() },
+ .{ .serial = 43, .effect = .zoom, .frame = animation.Transition.zoom.frames() - 1 },
+ .{ .serial = 44, .effect = .zoom, .frame = animation.Transition.zoom.frames() },
.{ .serial = 45, .phase = .opening, .effect = .vertical, .frame = 0 },
};