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:
1 parent
10d5129fbf
commit
a14f333dbe
10 files changed
+175
-70
No files matched your search
@@ -1190,7 +1190,7 @@ void Renderer::draw_swatch(const Plot& plot, u32 trace, const Rect& box) {
|
||||
|
||||
void Renderer::draw_crosshair_lines(const Plot& plot, const PlotLayout& layout) {
|
||||
const CrosshairLayout& crosshair = layout.crosshair;
|
||||
if (!crosshair.active) return;
|
||||
if (crosshair.empty()) return;
|
||||
|
||||
const f32 stroke = style_.device(style_.line_width_px);
|
||||
// The two lines. Each is staged as one data-space segment at the *centre* of the stroke box
|
||||
@@ -1231,7 +1231,7 @@ void Renderer::draw_crosshair_lines(const Plot& plot, const PlotLayout& layout)
|
||||
|
||||
void Renderer::draw_crosshair_readout(const Plot& plot, const PlotLayout& layout) {
|
||||
const CrosshairLayout& crosshair = layout.crosshair;
|
||||
if (!crosshair.active) return;
|
||||
if (crosshair.empty()) return;
|
||||
|
||||
// The readout: the same backplate a legend has (the shared `draw_readout_panel()`), with its
|
||||
// border in the crosshair's own colour -- which is what makes the panel read as part of the
|
||||
@@ -1242,9 +1242,9 @@ void Renderer::draw_crosshair_readout(const Plot& plot, const PlotLayout& layout
|
||||
if (!row.listed) continue;
|
||||
draw_swatch(plot, row.trace, row.swatch);
|
||||
stage_text({row.label_box.x, row.label_box.y}, row.label.c_str());
|
||||
// A row with no sample at this x has no value to write -- and it is *not* written as a
|
||||
// zero or a dash: the box is empty and the number is simply absent (see CrosshairRow).
|
||||
if (row.valid) stage_text({row.value_box.x, row.value_box.y}, row.value.c_str());
|
||||
// The value is a number, or `kCrosshairNoValue` for a trace with no sample at this x (the plot
|
||||
// put it there): either way there is a run to stage, so a row is never a blank cell.
|
||||
stage_text({row.value_box.x, row.value_box.y}, row.value.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user