fix(input,examples): a linked figure's wheel anchor uses the group's live edge, and every demo verdict reaches its exit status

Review fix pass 1 on the task 7 work; four findings, all closed.

1. The Qt demo's region sat across the middle of the window, which is exactly
   where its own scripted input check pans: after the check's box zoom the press
   opened DragMode::MoveRegion, the x range never moved, and the check printed
   'input check pan FAIL' -- under an exit 0, because the verdict was printed and
   not returned. The region now rides the left sixth (as the GLFW demo's does),
   both checks pass, and the verdict is wired to the exit status. The same audit
   found two more printed-only verdicts -- the GTK demo's scripted-resize layout
   check and its screenshot write (and Qt's) -- now wired too. What stays
   printed-only is the screenshot line of the GLFW host and the ImGui widget,
   where the dump happens inside the adapter's frame loop.

2. A follow-ing link group was invisible to the input layer: a member's own axis
   must be XFollow::Off (link_x() refuses a Live member), so Controller's
   x_zoom_anchor() extrapolated a coordinate from the pointer instead of using
   the live edge and a wheel over a row's axis strip walked the window back by
   19% of its width (behind 0.000000 -> 0.285809 s). The group now publishes its
   own edge to every member (Axis::live_owner + Plot::set_x_live_owner, written
   by Figure::push_link, cleared when the group stops following or the row
   unlinks), and x_zoom_anchor() reads it. Public-header addition, called out.
   Measured after: behind 0.012992 s and the window's right edge bit-identical to
   the edge the group published at the gesture.

3. The multiplot summary printed x_link_count() -- a number of groups -- under
   'rows in it'. It now reports the members and the group count separately, and
   every row line carries its own group id.

4. Host::controller_at() promised to clamp a pixel in a row gap to the nearest
   row and only clamped below the last one, so a gap pixel went to row 0. It now
   selects by distance, and tests/test_glfw_host.cpp pins it with a 40 px gap --
   the first coverage of the host's figure routing, which needs no window.

New cases: tests/test_controller.cpp x2 (the anchor and the hint's lifecycle),
tests/test_glfw_host.cpp x3 (routing, the gap, the single-plot fallback): 229
cases, 0 failed, ASan clean. All five demos exit 0, the three self-checking
modes exit 0, and the amended assertions were confirmed failing against the
pre-fix behaviour.
This commit is contained in:
Martino Ferrari committed 2026-09-28 15:52:08 +02:00
1 parent a70c381a1e
commit daff60e3f0
14 files changed
+441 -55

No files matched your search

+11 -3
View File
@@ -564,10 +564,18 @@ f64 Controller::x_zoom_anchor(u32 axis, f32 px, f32 py) const {
// off the plot keep the window ending at the newest sample instead of drifting
// away from it. Any other axis keeps the extrapolated coordinate, and `Off` is
// the default, so nothing changes for a plot that is not following.
if (!std::as_const(*plot_).layout().axes.contains(px, py) &&
plot_->x_follow(axis) == XFollow::Live) {
//
// A figure row's axis is `Off` even while its window follows, because a link group
// owns the shared window *and* the follow state (`Figure::link_x()` refuses a `Live`
// member) -- so the axis' own follow flag is not the whole answer. A following group
// publishes its edge to every member (`Plot::x_live_owner()`), and that edge is read
// second: it is the group's -- the union of its members' newest x -- which is the
// coordinate the window actually ends at, and the member's own series would be a
// different answer in a figure whose rows are fed at different rates.
if (!std::as_const(*plot_).layout().axes.contains(px, py)) {
f64 live = 0.0;
if (plot_->x_live_edge(axis, live)) return live;
if (plot_->x_follow(axis) == XFollow::Live && plot_->x_live_edge(axis, live)) return live;
if (plot_->x_live_owner(axis, live)) return live;
}
return plot_->x_transform(axis).to_data_x(static_cast<f64>(px));
}