diff --git a/src/osc.nim b/src/osc.nim index 7f07396..0248f17 100644 --- a/src/osc.nim +++ b/src/osc.nim @@ -68,10 +68,7 @@ proc main() = of Key.Space: scope.frozen = not scope.frozen of Key.G: - scope.grid = case scope.grid - of gsGrid: gsCross - of gsCross: gsOff - of gsOff: gsGrid + scope.grid = if scope.grid == gsGrid: gsOff else: gsGrid else: discard diff --git a/src/osc/scope.nim b/src/osc/scope.nim index 8cb918a..36ff3b1 100644 --- a/src/osc/scope.nim +++ b/src/osc/scope.nim @@ -10,7 +10,6 @@ type GridStyle* = enum gsGrid ## Full graticule - gsCross ## Center crosshair only gsOff ## No grid Scope* = object @@ -93,33 +92,31 @@ proc drawGraticule*(tb: var TerminalBuffer, w, h: int, grid: GridStyle) = let cx = w div 2 let cy = h div 2 - if grid == gsGrid: - # Division lines - for d in 1..<10: - let x = d * w div 10 - if x > 0 and x < w: - for y in 0.. 0 and y < h: - for x in 0.. 0 and x < w: + for y in 0.. 0 and y < h: + for x in 0.. 0 and x < w: - for dy in 1..<8: - let y = dy * h div 8 - if y > 0 and y < h: - tb.write(x, y, fgGreen, styleDim, "┼") + # Intersections + for dx in 1..<10: + let x = dx * w div 10 + if x > 0 and x < w: + for dy in 1..<8: + let y = dy * h div 8 + if y > 0 and y < h: + tb.write(x, y, fgGreen, styleDim, "┼") # ── HUD ──────────────────────────────────────────────────────────────