test(plot): pin the crosshair's lookup, readout, placement, sync and clip
This commit is contained in:
1 parent
fd0c471430
commit
8e27e22ebe
6 files changed
+798
-17
No files matched your search
+16
-5
@@ -487,6 +487,12 @@ void Renderer::draw_plot(Plot& plot, const PlotLayout& layout) {
|
||||
draw_axis_lines(plot);
|
||||
set_clip(layout.axes);
|
||||
draw_traces(plot, layout);
|
||||
// The crosshair's lines and markers over the data, but *under* the handles a pointer can
|
||||
// grab: a hovered or grabbed cursor marker or region bound is feedback for a gesture in
|
||||
// progress, and the crosshair -- which is drawn wherever the pointer is, including on top of
|
||||
// the handle being grabbed -- must not hide it. Its readout panel, which is a backplate for
|
||||
// text rather than a stroke, is drawn last of all (see below).
|
||||
draw_crosshair_lines(plot, layout);
|
||||
// Regions over the traces and under the cursors: an area of interest the data is
|
||||
// still legible through, with the markers that bound it on top of it.
|
||||
draw_regions(plot, layout);
|
||||
@@ -494,10 +500,10 @@ void Renderer::draw_plot(Plot& plot, const PlotLayout& layout) {
|
||||
draw_measures(plot, layout);
|
||||
draw_annotations(plot);
|
||||
draw_legend(plot, layout);
|
||||
// The crosshair last of the interior passes: it is what the pointer is on, so its panel is
|
||||
// drawn over the legend and every other overlay rather than under them, and its text joins
|
||||
// the frame's single flush with everything else.
|
||||
draw_crosshair(plot, layout);
|
||||
// The crosshair's readout last of the interior passes: it is what the pointer is on, so its
|
||||
// panel is drawn over the legend and every other overlay rather than under them, and its text
|
||||
// joins the frame's single flush with everything else.
|
||||
draw_crosshair_readout(plot, layout);
|
||||
clear_clip();
|
||||
draw_tick_labels(plot, layout);
|
||||
draw_titles(plot, layout);
|
||||
@@ -1174,7 +1180,7 @@ void Renderer::draw_legend(const Plot& plot, const PlotLayout& layout) {
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::draw_crosshair(const Plot& plot, const PlotLayout& layout) {
|
||||
void Renderer::draw_crosshair_lines(const Plot& plot, const PlotLayout& layout) {
|
||||
const CrosshairLayout& crosshair = layout.crosshair;
|
||||
if (!crosshair.active) return;
|
||||
|
||||
@@ -1213,6 +1219,11 @@ void Renderer::draw_crosshair(const Plot& plot, const PlotLayout& layout) {
|
||||
lines_.add_segment({row.marker.x, row.marker.y - arm}, {row.marker.x, row.marker.y + arm});
|
||||
flush_lines(pixel_mapping(), color, style_.device(1.0f));
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::draw_crosshair_readout(const Plot& plot, const PlotLayout& layout) {
|
||||
const CrosshairLayout& crosshair = layout.crosshair;
|
||||
if (!crosshair.active) return;
|
||||
|
||||
// The readout: the same backplate a legend has -- the frame's background at a partial
|
||||
// alpha, so the data stays legible through it -- with its border in the crosshair's own
|
||||
|
||||
Reference in new issue
Block a user