fix(examples): keep the glfw demo's region off the pan path, and print the multiplot's region geometry

Adding a grabbable region across the middle of the glfw demo turned the pan
gesture PLOT_DEMO_FOLLOW makes -- and a user's own centre drag -- into a region
drag, which that mode's self-check reported as 'distance behind only by the pan:
NO' and exit 1. The region now rides the left sixth of the live window, so a
press in the middle pans exactly as it always did, and the reason is written
where the bounds are placed.

The multiplot demo also prints its region's last-frame fill rect and bound
columns, so the exit frame's region pixels can be read against the geometry
Plot::layout() measured.

Report: .superpowers/sdd/p2-task-7-report.md
This commit is contained in:
Martino Ferrari committed 2026-09-28 15:36:25 +02:00
1 parent 942f88c568
commit a70c381a1e
2 files changed
+17 -1

No files matched your search

+11
View File
@@ -655,6 +655,17 @@ int main() {
" %.4f, max %.4f, integral %.4f\n",
region, rs.x0, rs.x1, static_cast<unsigned long long>(rs.count), rs.mean, rs.rms,
rs.min, rs.max, rs.integral);
// The region's last-frame geometry on row 0, as the layout measured it: the rect the
// fill and the bound strokes are drawn in, which is also what the screenshot's region
// pixels are read against.
for (const plot::RegionLayout& rl : std::as_const(figure.plot(0)).layout().regions) {
if (rl.region != region) continue;
std::printf("[multiplot] region %u: fill x %.1f y %.1f w %.1f h %.1f, bounds at %.1f and"
" %.1f\n",
region, rl.fill.x, rl.fill.y, rl.fill.w, rl.fill.h,
static_cast<plot::f64>(plot::handle_column(rl.left_handle)),
static_cast<plot::f64>(plot::handle_column(rl.right_handle)));
}
std::printf("[multiplot] cursors a %.6f s, b %.6f s, dx %g s dy %g\n",
figure.plot(0).cursor(cursor_a).x, figure.plot(0).cursor(cursor_b).x,
figure.plot(0).measurement(measure).dx, figure.plot(0).measurement(measure).dy);