summaryrefslogtreecommitdiff
path: root/anim/src/ui.zig
diff options
context:
space:
mode:
Diffstat (limited to 'anim/src/ui.zig')
-rw-r--r--anim/src/ui.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/anim/src/ui.zig b/anim/src/ui.zig
index d770e05..bcefff3 100644
--- a/anim/src/ui.zig
+++ b/anim/src/ui.zig
@@ -487,6 +487,21 @@ pub const Ui = struct {
sk.draw.polygon(u.f, &.{ .{ hx + p.row_head[0], mid }, .{ hx, mid - p.row_head[1] / 2 }, .{ hx, mid + p.row_head[1] / 2 } }, u.at.pen(.{ .fill = rgb(ink) }));
}
+ /// `pin` `row` at a dump row's right end (a view has no lane before its
+ /// addresses): the head pointing left at the row, then the names,
+ /// ending at `right`. Returns where it begins.
+ pub fn pinEnd(u: Ui, right: f32, y: f32, names: []const []const u8, ink: anytype) f32 {
+ const size = theme.size.mono.context;
+ const p = theme.metric.pin;
+ const shown = joined(u, names);
+ const x = right - u.width(.mono, size, shown);
+ u.text(.mono_bold, size, x, theme.baseline(y, theme.metric.context.row, size), shown, theme.color.text.primary);
+ const hx = x - p.row_gap;
+ const mid = y + theme.metric.context.row / 2;
+ sk.draw.polygon(u.f, &.{ .{ hx - p.row_head[0], mid }, .{ hx, mid - p.row_head[1] / 2 }, .{ hx, mid + p.row_head[1] / 2 } }, u.at.pen(.{ .fill = rgb(ink) }));
+ return hx - p.row_head[0];
+ }
+
/// `pin` `under`: a stub 3 wide rising `size` + 10 to a node's bottom
/// edge at (`cx`, `y`), a head 10 by 10 on it, the first name left of
/// the stub and the others right, bold, primary.