diff options
Diffstat (limited to 'anim/src/loupe.zig')
| -rw-r--r-- | anim/src/loupe.zig | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/anim/src/loupe.zig b/anim/src/loupe.zig index 65a9463..4ffe860 100644 --- a/anim/src/loupe.zig +++ b/anim/src/loupe.zig @@ -69,6 +69,19 @@ pub const Loupe = struct { s.play(.{l.closing.to(1)}, .{ .seconds = time.close, .ease = anim.ease.linear }); } + /// What it opens on, by the pointer's name: for the map, where an open loupe is a panel of its own. + pub fn aim(l: *const Loupe, now: cursors.Now) ?struct { name: []const u8, target: u64 } { + const moment = now.moment(); + return switch (l.from) { + .register => |name| blk: { + const regs = (moment.regs(l.cursor.rec.tid) catch null) orelse return null; + break :blk .{ .name = name, .target = regs.named(name) orelse return null }; + }, + .field => |field| .{ .name = "its field", .target = (Recording.word(moment, field.at, 8) catch null) orelse return null }, + .row => |row| .{ .name = row.name, .target = row.fields.base }, + }; + } + /// Where it is now (in the working frame's units) and what it shows: /// null while it is shut, or where its pointer is not on screen. const Placed = struct { box: Rect, pointer: Rect, target: u64, first: u64, ink: u24 }; @@ -131,7 +144,7 @@ pub const Loupe = struct { holding[@intFromBool(deep)] = null; const opened = placed.value(l.opening) * time.open; const closed = placed.value(l.closing); - if (opened <= 0 or closed >= 1 or ui.mapping) return; + if (opened <= 0 or closed >= 1 or ui.mapping or @import("map.zig").looking(f)) return; const u: ui.Ui = .{ .f = f, .at = placed }; const now = l.cursor.now(placed); const p = l.place(u, now) orelse return; |
