Skip to content

recording: query_and_hover (live readout follows the cursor)#15

Merged
borisbat merged 1 commit into
masterfrom
bbatkin/query-and-hover-recording
Jun 7, 2026
Merged

recording: query_and_hover (live readout follows the cursor)#15
borisbat merged 1 commit into
masterfrom
bbatkin/query-and-hover-recording

Conversation

@borisbat

@borisbat borisbat commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Seventh tutorial recording, and the last of the subject-interaction set. query_and_hover reads the cursor live: while the pointer is over the plot the example draws a vertical crosshair at the cursor x and an (x, y) label in data coords (GetPlotMousePos). The interaction it teaches is the hover — move the cursor and the readout follows, every frame. Driven with a real synthetic cursor glide (center → left → right), voiced and self-verifying: each beat waits for hovered to flip true, then asserts GetPlotMousePos resolved into the band the cursor was aimed at (and moved right between beats), so a dead hover or a frozen readout aborts at teardown.

Example tidy (from review)

The cursor label printed full double precision — (73.97119341563786, -0.19043977055449335). Formatted via fmt precision specifiers in the interpolation, "({mp.x:.1f}, {mp.y:.2f})", so it now reads (74.0, -0.19).

Note: format(...) is deprecated in favor of fmt, whose spec is :.1f (not printf %.1f), and it validates at runtime — so a bad spec passes compile/lint and only throws when the example runs. The driver's self-verification caught it (fmt error: invalid format string → recording aborted) before it could ship a broken clip.

Files

  • examples/tutorial/query_and_hover.das — format the cursor label to 1–2 decimals (+ require strings for fmt).
  • tests/integration/record_query_and_hover.das — the voiced driver (intro + glide left + glide right), each verifying hovered + mouse-plot-x in the aimed band.
  • doc/source/tutorials/query_and_hover.rst.. video:: query_and_hover.mp4; inline snippet + prose synced to the formatted label.
  • doc/source/_static/tutorials/query_and_hover.mp4 — the recording (633 KB, 26.4 s, 695 frames, 0 dropped, Emma voice + −16 dB bed).

Verification

  • ok:true, 695 frames, 0 dropped; all four gates pass (hovered + left band [8,40] + right band [60,92] + moved right).
  • Eyeballed: crosshair + label track center → left (21.9, 0.20) → right (74.0, -0.19).

The headless guard is the existing test_query_and_hover.das.

🤖 Generated with Claude Code

Seventh tutorial recording, and the last of the subject-interaction set. query_and_hover
reads the cursor LIVE: while the pointer is over the plot the example draws a vertical
crosshair at the cursor x and an (x, y) label in DATA coords (GetPlotMousePos). The
interaction it teaches is the HOVER - move the cursor and the readout follows, every
frame. Driven with a REAL synthetic cursor glide (center -> left -> right), voiced and
self-verifying: each beat waits for `hovered` to flip true, then asserts GetPlotMousePos
resolved into the band the cursor was aimed at (and moved right between beats), so a dead
hover or a frozen readout aborts at teardown.

Also tidies the example's cursor label (review): it printed full double precision -
(73.97119341563786, -0.19043977055449335). Formatted via fmt precision specifiers in the
interpolation - "({mp.x:.1f}, {mp.y:.2f})" - so it reads (74.0, -0.19). (`format(...)` is
deprecated in favor of `fmt`, whose spec is `:.1f`, not printf `%.1f`.)

- examples/tutorial/query_and_hover.das: format the cursor label to 1-2 decimals
  (+ require strings for fmt).
- tests/integration/record_query_and_hover.das: the voiced driver (intro + glide left +
  glide right), each verifying hovered + mouse-plot-x in the aimed band.
- doc/source/tutorials/query_and_hover.rst: + .. video:: query_and_hover.mp4, inline
  snippet + prose synced to the formatted label.
- doc/source/_static/tutorials/query_and_hover.mp4: the recording (633 KB, 26.4s, 695
  frames, 0 dropped, Emma voice + -16 dB bed).

The headless guard is the existing test_query_and_hover.das.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the final “subject-interaction” tutorial recording for query_and_hover, and tightens the example’s cursor readout formatting so the on-plot label is readable and consistent with the narrated walkthrough.

Changes:

  • Add a new integration recording driver that glides a synthetic cursor and self-verifies hover + live GetPlotMousePos readout bands.
  • Format the on-plot (x, y) cursor label to fixed decimals using fmt-style precision specifiers.
  • Update the tutorial RST to include the walkthrough video and keep the inline snippet/prose in sync with the formatted label.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/integration/record_query_and_hover.das New voiced recording driver that hovers and glides the cursor while asserting live plot-mouse readout behavior.
examples/tutorial/query_and_hover.das Formats the cursor label to 1–2 decimals and adds the required module import for formatting.
doc/source/tutorials/query_and_hover.rst Updates snippet + prose to match the formatted label and adds a walkthrough video section.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +48 to +50
move_to(app, (px + pw * 0.5f, py + ph * 0.5f), 700)
var hc = wait_for_hovered(s, true)
record_check(app, "the plot reports hovered while the cursor is over it", hc != null)
@borisbat borisbat merged commit 8d17d3c into master Jun 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants