fix(plot,render,glfw): a hue-neutral crosshair, an em-dash placeholder, one layout per figure event, and a usable readout switch

This commit is contained in:
Martino Ferrari committed 2026-09-28 19:38:30 +02:00
1 parent 10d5129fbf
commit a14f333dbe
10 files changed
+175 -70

No files matched your search

+9 -4
View File
@@ -650,16 +650,21 @@ PLOT_TEST(figure_crosshair_applies_one_x_to_every_row) {
PLOT_CHECK(third.panel.w == 0.0f);
// Row 3's series starts at x = 100: it is a visible signal with nothing at x = 3, so it is
// listed with **no value** rather than a value clamped to the end of its window.
// listed with **no number** rather than one clamped to the end of its window -- and the absence
// is said out loud with the documented placeholder, not left as a blank cell that would read as a
// value still to come.
const plot::CrosshairLayout& fourth = figure.plot(3u).layout().crosshair;
PLOT_CHECK(fourth.rows.size() == 1u);
PLOT_CHECK(fourth.rows[0].trace == 0u);
PLOT_CHECK(fourth.rows[0].label == "elsewhere");
PLOT_CHECK(!fourth.rows[0].valid);
PLOT_CHECK(fourth.rows[0].value.empty());
// ... and it is still listed, so the row's presence does not depend on having a value.
PLOT_CHECK(fourth.rows[0].value == plot::kCrosshairNoValue);
PLOT_CHECK(fourth.rows[0].marker.x == 0.0f && fourth.rows[0].marker.y == 0.0f); // no intersection
// ... and it is still listed, with a value column, so the row's presence and its shape do not
// depend on having a sample there.
PLOT_CHECK(fourth.rows[0].listed);
PLOT_CHECK(fourth.rows[0].value_box.w == 0.0f);
PLOT_CHECK(fourth.rows[0].value_box.w > 0.0f);
PLOT_CHECK(fourth.rows[0].value_box.right() <= fourth.panel.right());
// The crosshair is a data coordinate, so the x is the *same* whether or not the rows sample
// there -- moving it moves every row, and the rows that have data report their own value at