summaryrefslogtreecommitdiff
path: root/anim/src/ui.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-13 12:18:26 -0300
committerGabriel Schneider <[email protected]>2026-11-13 12:18:26 -0300
commit4f31aaef1338b53195f8c475db5a72d75cc1fc82 (patch)
treef2c3c2140269a5559f60bcd9e2520f5ff7431565 /anim/src/ui.zig
parent771e377f6db9c3aed1ab85bc36a774f4176272cc (diff)
downloadcomputeranim-4f31aaef1338b53195f8c475db5a72d75cc1fc82.tar.gz
computeranim-4f31aaef1338b53195f8c475db5a72d75cc1fc82.zip
debugger: add refractive lenses and configurable memory values
Use disassembly lenses for executable pointers, browse surrounding segment context, and keep the reading surface opaque with GPU refraction at the edges. Route right-clicks by stack mapping and expose byte-width and numeric-format controls. Replace matching-address arrows with staggered shared-renderer highlights. Verified GUI and renderer suites, native restart/zoom cycles, independent float-extrema and popup review, and a live wrong-map stop at Deoptimizer::New with JS origin context. Requires Sketchbook 409c1ac.
Diffstat (limited to 'anim/src/ui.zig')
-rw-r--r--anim/src/ui.zig25
1 files changed, 25 insertions, 0 deletions
diff --git a/anim/src/ui.zig b/anim/src/ui.zig
index 282a24f..2c78c04 100644
--- a/anim/src/ui.zig
+++ b/anim/src/ui.zig
@@ -57,6 +57,17 @@ pub const Collected = struct {
};
pub var collected: Collected = .{};
+/// A selected occurrence leads, then its matches arrive in reading order.
+pub fn matchProgress(seconds: f32, rank: usize, delay: f32, duration: f32) f32 {
+ return theme.ease(.standard, std.math.clamp((seconds - @as(f32, @floatFromInt(rank)) * delay) / @max(0.001, duration), 0, 1));
+}
+
+test "matching highlights reveal the selection before its peers" {
+ try std.testing.expect(matchProgress(0.05, 0, 0.08, 0.16) > 0);
+ try std.testing.expectEqual(@as(f32, 0), matchProgress(0.05, 1, 0.08, 0.16));
+ try std.testing.expectEqual(@as(f32, 1), matchProgress(1, 3, 0.08, 0.16));
+}
+
/// A mark on the row whose middle is `y` (in `u`), for the strips; `shows` of it.
pub fn collectMark(u: Ui, x: f32, y: f32, kind: Collected.Kind, shows: f32) void {
if (!strokes or shows <= 0 or collected.n_marks == collected.marks.len) return;
@@ -635,6 +646,20 @@ pub const Ui = struct {
if (bound) |b| u.f.clip(b) else u.f.clip(null);
}
+ pub fn matchHighlight(u: Ui, r: Rect, seconds: f32, rank: usize, options: struct {
+ color: Color = .hex(0x65c9d8),
+ selected_color: Color = .hex(0xe6bd70),
+ delay: f32 = 0.075,
+ duration: f32 = 0.16,
+ opacity: f32 = 0.23,
+ }) void {
+ const progress = matchProgress(seconds, rank, options.delay, options.duration);
+ const c = if (rank == 0) options.selected_color else options.color;
+ const box: Rect = .{ .x = r.x, .y = r.y, .w = r.w * progress, .h = r.h };
+ u.faded(options.opacity * progress).fill(box, c);
+ u.faded(progress * 0.6).line(.{ r.x, r.y + r.h - 1 }, .{ r.x + box.w, r.y + r.h - 1 }, c, 1);
+ }
+
pub fn hitAddress(u: Ui, addr: u64, r: Rect) void {
const hook = address_hit orelse return;
if (strokes or mapping or u.at.pose.opacity < 0.1) return;