diff --git a/src/components/view_ruler.zig b/src/components/view_ruler.zig index 5cddf8f..6dce824 100644 --- a/src/components/view_ruler.zig +++ b/src/components/view_ruler.zig @@ -449,6 +449,42 @@ pub fn show(ctx: Context, box: *UI.Box, graph_box: *UI.Box, view_id: Id, axis: U project.updateGainChange(i, mouse_range.remapTo(view_range.*, mouse_position)); } } + + for (0.., project.statistic_points.items) |i, statistic_point| { + const color = srcery.bright_blue; + + const sample: f64 = @floatFromInt(statistic_point); + + showMarkerLine(ui, ruler, sample, color); + showMarkerLine(ui, ruler, sample, color); + + var hasher = UI.Key.CombineHasher.init(); + hasher.update(std.mem.asBytes("Statistic point")); + hasher.update(std.mem.asBytes(&view_id)); + hasher.update(std.mem.asBytes(&axis)); + hasher.update(std.mem.asBytes(&i)); + + const view_size = view.graph_opts.x_range.size(); + const clickable_width = view_size * 0.01; + + const clickable = ui.createBox(.{ + .key = UI.Key.init(hasher.final()), + .float_rect = ruler.getGraphDrawContext().getRect(sample - clickable_width/2, clickable_width, 0, 1), + .float_relative_to = ruler.graph_box, + .parent = ruler.graph_box, + .flags = &.{ .draw_hot, .draw_active, .clickable }, + .hot_cursor = .mouse_cursor_pointing_hand, + }); + + const signal = ui.signal(clickable); + if (signal.hot) { + const mouse_tooltip = ui.mouseTooltip(); + mouse_tooltip.beginChildren(); + defer mouse_tooltip.endChildren(); + + _ = ui.label("Statistic point", .{ }); + } + } } }