Three findings reachable by ordinary use:
* `Controller::axis_zoom()` divided by `Plot::ui_scale()` directly, though
`Style::device()` documents a non-positive scale as host state that must be
tolerated. With `ui_scale == 0` and a negative drag delta, `logical_dy` was
`-inf`, the factor `+inf`, and the guard `!(factor > 0.0)` did not reject it:
`zoom_x_axis`/`zoom_y_axis` computed `anchor + (bound - anchor) * inf`, and
`set_y_range()` stored it verbatim and cleared `auto_scale` -- an axis left
non-finite until an auto-fit. A negative scale silently inverted the zoom.
A scale that is not positive and finite now means no zoom at all.
* `draw_annotations()` stages its caption into the frame's single text batch,
which `flush_text()` draws *after* `clear_clip()`, so a caption staged while
the axes clip was engaged was rasterised with the viewport clip. An
annotation anchored outside the visible range kept a caption with no cross,
and in a `Figure` -- whose rows tile the figure -- that caption painted into
the neighbouring row. A caption whose anchor is outside `axes` is now skipped
with its cross, rather than splitting the frame's one text draw call (which
would cost a draw call per row and mis-clip the labels staged outside `axes`).
* `dump_frame_ppm()` was the one public entry point not `noexcept`, so a
`std::bad_alloc` crossed the API boundary. Its buffers are now sized before
anything is on disk and a failure is reported as `ErrorCode::OutOfMemory`,
exactly as `TrueTypeFont::from_file()` reports it.
Tests: `ui_scale` 0 and -1 leave the axis range finite and unchanged with
`auto_scale` intact; an annotation anchored outside a bottom figure row's y
range leaves no caption ink in the row above, while an in-range one still
draws; a `static_assert` pins the dump's `noexcept`.
`controller_at()` routed every pointer event by the row the pixel was in,
ignoring the row a drag started in, so a press on one figure row followed by a
motion and release in another delivered the motion and release to a controller
whose `mode_ == None`. The owning controller kept `mode_`, `drag_region_`,
`drag_cursor_` and `drag_fixed_x_` set for ever: `publish_hot()` kept publishing
the grabbed handle, `grabbed_region()` reported a drag that had ended, and a
later gesture re-entering the row resumed the stale edit from the old anchor.
`feed_pointer_event()` now owns the routing: a press captures the row it landed
in and every motion and the release until the button comes up go to that row
(`pointer_target()`), cleared on release and when another figure is set. The
GLFW callbacks build the event and call it, so a windowless host or a test can
drive the routing too.
Two neighbours in the same seam:
* `sync_figure_crosshair()` called the four-argument overload unconditionally,
so a documented vertical-only crosshair (`horizontal == false`) was promoted
to a full cross at the stored y == 0, clamped to the axes edge and made
permanent; the change detection also keyed on x alone, missing a y-only move
to another row at the same x (two rows showing one horizontal line, spec 17).
It now consults `crosshair().horizontal` and compares the hovered row's y.
* Only the row under the pointer republished its hot handles, so a row the
pointer left kept drawing a hovered marker or bound as if it were still
under the pointer, and answered `hovered_region()`/`grabbed_cursor()` for
it. The run loop clears every other row's handles, keeping the captured
row while a drag owns the button, and reads the frame's one layout once
instead of recomputing every row five times.
Test: a press on row A's region, a motion into row B, a release in row B
asserts no controller keeps a drag mode, nothing reports a grabbed handle, and
a later press-and-motion that re-enters row A does not resume the old edit.
The repository had no licence at all, so every source was all-rights-reserved
by default. Add the verbatim MIT text at LICENSE (Copyright (c) 2026 Martino
Ferrari) and a two-line SPDX header to each of the 113 first-party sources --
48 include/plot, 26 src, 10 adapters, 5 examples, 21 tests, 3 tools -- so the
grant travels with each file rather than relying on the root document alone.
Scripts keep their shebang on line 1; the SPDX lines follow it. Genuinely
vendored code is untouched: third_party/stb_truetype.h carries no header of
ours. src/render/embedded_mono_font.cpp is generated, so tools/fonts/gen_atlas.py
emit() now writes the two lines into its header comment and the file was
regenerated -- gen_atlas.py --check passes and the regeneration adds only those
comment lines to the previously committed file.
README's provenance section now states MIT and links LICENSE.
No code, test or public API change.
The figure sync learns which row the pointer is in and that row's local y, so the
shared x goes to every row and the horizontal line only to the hovered one -- a
crosshair that finally marks a row where its y means something. The stroke gains
Style::crosshair_width/_dash_on/_dash_off (logical; 0.75 / 4 / 4), a per-Crosshair
override, and a fragment-shader dash on v_along (off == 0 is solid), anchored to the
axes edge each line is staged from so the phase does not crawl.
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.
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
The multi-plot example the phase exists for: three plots stacked in one
Figure, sharing one x link with following armed, each row carrying its own
named signals and its own legend, driven by six StreamSeries at 500 kS/s.
Two cursors and a region with an exact statistics readout reach the direct
manipulation of spec §5 in the same frame, and PLOT_DEMO_SYNC=1 is a
self-checking mode that exits non-zero unless all three rows hold one range
and the shared right edge keeps tracking the newest sample through a zoom, a
pan on another row and more arriving data.
The GLFW host gains the figure mode the demo needs: set_figure() makes the
run loop draw the Figure instead of its own plot and route each pointer,
wheel and key event to the row it lands in, through one Controller per row
(row_controller()). All of it is opt-in; the single-plot path is untouched.