style(grid): the minor grid is thinner, dashed and blended into the background
Subdivisions used to be drawn exactly like the labelled lines -- same width, same opacity -- so a plot dense enough to need them read as two competing sets of ticks. The minor class is now three things the style states explicitly: - grid_minor_width 1.0 -> 0.75, a sub-pixel logical width. At 1x that is expressed as reduced coverage through the anti-aliased ramp; on a HiDPI display the line is literally narrower. - grid_minor_dash_on/_off (new, 3/3): dashed by default, off == 0 draws it solid, the same convention as the crosshair's and a trace's dash. The dash is a fragment-shader discard, so no geometry is added -- the vertices are the line either way. - grid_minor carries alpha (0x1C2126 at 50%), and the line shader applies u_color.a, so it blends into the background instead of sitting on it. Together that is about a fifth of the ink a major line leaves along its length, which is what gives the eye one grid to read instead of two. The major class is untouched: it stays the structure. Tests: a new pixel test (the_minor_grid_is_thinner_dashed_and_dimmer_than_the_major) asserts a major column is inked top-to-bottom while a minor one alternates, and that the minor's ink sits closer to the background than the major's. Three existing tests counted the minor class as "most of eight rows" of its exact colour; two now take their floor from the style (minor_line_ink: width x alpha x duty), and the width test states the dash and alpha away because widths are its subject. 361 cases, 0 failed.
This commit is contained in:
1 parent
f3fb500068
commit
01e410bd74
5 files changed
+202
-13
No files matched your search
+15
-2
@@ -37,7 +37,7 @@ Colours (neither logical nor device — nothing to scale):
|
||||
|---|---|---|
|
||||
| `background` | `0x101418` | frame clear colour and legend/readout panel base |
|
||||
| `grid_major` | `0x2A3038` | major (labelled-tick) grid lines |
|
||||
| `grid_minor` | `0x1C2126` | minor (subdivision) grid lines |
|
||||
| `grid_minor` | `0x1C2126` at 50% alpha | minor (subdivision) grid lines |
|
||||
| `axis_line` | `0x8A94A6` | axis lines |
|
||||
| `axis_text` | `0xC8D0DC` | tick labels and axis titles |
|
||||
| `cursor` | `0xFFB020` | cursor markers; also the hovered/grab highlight |
|
||||
@@ -57,7 +57,9 @@ Logical metrics (scaled by `device()`):
|
||||
| `axis_font_px` | `12.0` | logical em the axis text is drawn at |
|
||||
| `grid_label_pad` | `4.0` | gap between a tick label and the axes, and the inset inside a title strip |
|
||||
| `grid_major_width` | `1.0` | width of a major grid line |
|
||||
| `grid_minor_width` | `1.0` | width of a minor grid line |
|
||||
| `grid_minor_width` | `0.75` | width of a minor grid line (sub-pixel on purpose) |
|
||||
| `grid_minor_dash_on` | `3.0` | minor grid dash: ink length in logical pixels |
|
||||
| `grid_minor_dash_off` | `3.0` | minor grid dash: gap; `0` draws the minor grid solid |
|
||||
| `grid_major_visible` | `true` | stage the major grid at all |
|
||||
| `grid_minor_visible` | `true` | stage the minor grid at all |
|
||||
| `line_width_px` | `1.5` | width of the strokes framing the data (axis lines, cursor markers) |
|
||||
@@ -91,6 +93,17 @@ transparent. `Grid` therefore carries both classes' geometry whatever the style
|
||||
caller that draws the grid itself applies the same two switches. `Grid::vertical` and
|
||||
`Grid::horizontal` (both `true`) control which directions emit lines at all.
|
||||
|
||||
The labelled class is the **structure** and the subdivisions are **texture**, and the minor
|
||||
grid's three defaults are what makes that read: it is thinner than the major hairline
|
||||
(`grid_minor_width`, a sub-pixel width that at 1x is expressed as coverage and on a HiDPI
|
||||
display as a narrower line), its colour carries an **alpha** so it blends into the
|
||||
background instead of sitting on it, and it is **dashed** (`grid_minor_dash_on`/`_off`) so an
|
||||
unlabelled line at an unlabelled position is never mistaken for a labelled one. Together
|
||||
those put a minor line at roughly a fifth of a major line's ink — at full opacity and the
|
||||
same width a dense minor grid reads as a second set of ticks. The dash is a fragment-shader
|
||||
discard, not extra geometry: the vertices are the line either way. Set
|
||||
`grid_minor_dash_off = 0` for the old solid subdivision.
|
||||
|
||||
## The crosshair's dash
|
||||
|
||||
`crosshair_dash_on`/`crosshair_dash_off` are the fragment shader's discard pattern, so no
|
||||
|
||||
Reference in new issue
Block a user