refactor(render): share the readout panel and swatch drawing with the legend

This commit is contained in:
Martino Ferrari committed 2026-09-28 19:25:33 +02:00
1 parent 29824b6919
commit 10d5129fbf
2 files changed
+54 -56

No files matched your search

+12
View File
@@ -487,6 +487,18 @@ class Renderer {
/// them again, so the panel a test asserts and the panel this draws are the same
/// numbers.
void draw_legend(const Plot& plot, const PlotLayout& layout);
/// The backplate the legend and the crosshair's readout share: the frame's background at
/// `kLegendPanelAlpha` over `panel`, with a one-device-pixel border in `border` around the
/// outermost pixels the fill covers (the crisp-hairline rule -- a border drawn on the measured
/// rect's fractional edges is lit half-heartedly, and a frame bright on three sides and dim on the
/// fourth reads as a mistake). One helper, two callers: the border's colour is the only thing a
/// legend panel and a readout panel do not share.
void draw_readout_panel(const Rect& panel, Color border);
/// One trace's colour swatch in `box`, opaque whatever the trace's own alpha is: a swatch drawn at
/// a trace's 15% would be the least legible thing in the frame, and the swatch is the one element
/// that says which colour an entry or a readout row *is*. The legend's entries and the crosshair's
/// rows both read it from here.
void draw_swatch(const Plot& plot, u32 trace, const Rect& box);
/// The crosshair's **lines and markers**: the vertical and horizontal strokes and a small
/// cross at each trace's intersection.
///