Footer SI prefix joins the unit segment (30.04 bright, M pkts muted; 50.66 + GB) so GB is never split across colours; the 90s ago/now axis line removed as a duplicate of the RESET | LAST 90 S | NOW column headers, rows stretching into the freed space
This commit is contained in:
@@ -105,7 +105,6 @@ type display struct {
|
||||
rowH int
|
||||
cellH int
|
||||
cellR int
|
||||
axisY int
|
||||
labelX int
|
||||
nowX int
|
||||
nowW int
|
||||
@@ -186,7 +185,7 @@ func (d *display) layout(w, h int) error {
|
||||
// Rows stretch to spend the whole band between the column headers and the
|
||||
// footer, cells riding along at their design proportion of the row.
|
||||
rowsTop := d.headerH + colHdrH
|
||||
d.rowH = (d.resetBtn.y - uiMargin - d.small.lineH - 8 - rowsTop) / len(panelRows)
|
||||
d.rowH = (d.resetBtn.y - uiMargin - rowsTop) / len(panelRows)
|
||||
if d.rowH < rowHMin {
|
||||
return fmt.Errorf("rows would be %dpx tall, under the %dpx minimum", d.rowH, rowHMin)
|
||||
}
|
||||
@@ -199,7 +198,6 @@ func (d *display) layout(w, h int) error {
|
||||
d.rowYs[i] = y
|
||||
y += d.rowH
|
||||
}
|
||||
d.axisY = y + 8
|
||||
d.versionSpot = rect{w - versionSpotSide, 0, versionSpotSide, versionSpotSide}
|
||||
return nil
|
||||
}
|
||||
@@ -424,11 +422,6 @@ func (d *display) drawColHeaders() {
|
||||
d.hairline(d.rowYs[0] - 1)
|
||||
}
|
||||
|
||||
func (d *display) drawAxis() {
|
||||
d.small.draw(d.fb, d.cellsX, d.axisY-d.small.capTop, "90s ago", uiMuted)
|
||||
d.textRightAt(d.small, d.cellsX+d.cellsW, d.axisY, "now", uiMuted)
|
||||
}
|
||||
|
||||
// One row of history cells: na for a slot with nothing believable (never
|
||||
// sampled, or spent inside a measure), otherwise judged by the row.
|
||||
func (d *display) heatRow(rowY int, hv histView, judge func(histSlot) rgb) {
|
||||
@@ -538,14 +531,24 @@ func snrInk(m float64) rgb {
|
||||
return uiInk
|
||||
}
|
||||
|
||||
// The magnitude letter belongs to the unit, not the figure — split G from B
|
||||
// and "GB" reads as two things — so it takes the unit's colour.
|
||||
func (d *display) qty(v uint64, unit string) []seg {
|
||||
val, mag, ok := strings.Cut(scaleCount(v), " ")
|
||||
if ok {
|
||||
unit = " " + mag + unit
|
||||
}
|
||||
return []seg{{d.small, val, uiInk2}, {d.small, unit, uiMuted}}
|
||||
}
|
||||
|
||||
// One fact per line, stacked beside the reset button: short lines can never
|
||||
// crowd it, whatever the values grow to.
|
||||
func (d *display) drawFooter(v view, elapsed time.Duration) {
|
||||
const gap = 6
|
||||
lines := [][]seg{
|
||||
{{d.small, scaleTime(elapsed), uiInk2}},
|
||||
{{d.small, scaleCount(v.rxFrames), uiInk2}, {d.small, " pkts", uiMuted}},
|
||||
{{d.small, scaleCount(v.rxBytes), uiInk2}, {d.small, "B", uiMuted}},
|
||||
d.qty(v.rxFrames, " pkts"),
|
||||
d.qty(v.rxBytes, "B"),
|
||||
}
|
||||
total := len(lines)*d.small.lineH + (len(lines)-1)*gap
|
||||
y := d.resetBtn.y + (btnH-total)/2
|
||||
@@ -564,7 +567,6 @@ func (d *display) render(v view, elapsed time.Duration, phy phyDisplay,
|
||||
d.hairline(d.headerH - 1)
|
||||
d.drawColHeaders()
|
||||
d.drawRows(v, phy, measuring, hv, target)
|
||||
d.drawAxis()
|
||||
d.drawFooter(v, elapsed)
|
||||
d.drawResetButton()
|
||||
return fb.flush()
|
||||
|
||||
Reference in New Issue
Block a user