Skip to content

fix: use full-screen reference frame for recording touch overlays#765

Merged
thymikee merged 1 commit into
mainfrom
fix/recording-overlay-reference-frame
Jun 11, 2026
Merged

fix: use full-screen reference frame for recording touch overlays#765
thymikee merged 1 commit into
mainfrom
fix/recording-overlay-reference-frame

Conversation

@thymikee

Copy link
Copy Markdown
Member

What

iOS simulator screen recordings with touch overlays rendered tap markers at the wrong position — y clamped to the video's bottom edge (repro: record start, press 220 600 on a 440×956pt device, marker burned in at bottom-center instead of ~(110, 301) in the 220×480 video).

Why

For coordinate presses during recording with no prior snapshot, resolveDirectTouchReferenceFrame captured the reference-frame snapshot with interactiveOnly: true, which captureSnapshotForSession coupled to compact mode. Compact pruning drops Application/Window container nodes, so inferViewportRect fell back to a bounding box of leaf elements (e.g. 386×208.33 in the Settings app instead of the screen size). The overlay renderer (recording-overlay.swift) then scaled marker coordinates with that garbage frame: x looked nearly right by coincidence (bbox width ≈ screen width), while y scaled ~2× past the canvas and clamped.

How

  • captureSnapshotForSession accepts an optional compact override (default unchanged: compact = interactiveOnly).
  • resolveDirectTouchReferenceFrame requests compact: false, so the Application node survives and the inferred frame is the real full-screen point size — matching the coordinate space of the recorded touch events and the recorded video.
  • Regression test: an iOS coordinate press during recording must capture a non-compact snapshot and stamp the gesture event with the Application-node frame.

The leaf-bbox fallback in inferViewportRect is left as is — Android snapshots have no Application/Window-typed nodes and rely on it (there the bbox approximates the screen).

Validation (iPhone 17 simulator, iOS 27, 402×874pt screen, 220×480 video)

  • Before: <video>.gesture-telemetry.json carried referenceWidth: 386, referenceHeight: 208.33; marker clamped at the bottom edge.
  • After: telemetry carries 402×874; the burned-in marker measures at (121, 329) in the frame vs expected (120.4, 329.5) — within a pixel.
  • pnpm typecheck clean; daemon unit suites pass (734 tests).

Coordinate presses during recording resolved their touch reference
frame from an interactive-only snapshot that was also captured in
compact mode. Compact pruning drops Application/Window containers, so
viewport inference fell back to a bounding box of leaf elements (e.g.
386x208 instead of the 440x956 screen) and the overlay burn-in scaled
tap markers with that garbage frame: x landed nearly right by
coincidence, y blew past the canvas and clamped to the bottom edge.

Capture the reference-frame snapshot with compact disabled so the
Application node survives and the frame is the real screen point size.

Verified on an iPhone 17 simulator (402x874pt screen, 220x480 video):
gesture telemetry now carries 402x874 and the burned-in marker lands at
(121, 329) vs expected (120.4, 329.5); previously it rendered clamped
at the bottom edge.
@github-actions

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 1.2 MB 1.2 MB +22 B
JS gzip 390.4 kB 390.4 kB +9 B
npm tarball 501.7 kB 501.7 kB +13 B
npm unpacked 1.7 MB 1.7 MB +22 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 24.8 ms 24.0 ms -0.7 ms
CLI --help 38.3 ms 38.2 ms -0.0 ms

Top changed chunks: no changes in the largest emitted chunks.

@thymikee thymikee merged commit ded6a16 into main Jun 11, 2026
19 checks passed
@thymikee thymikee deleted the fix/recording-overlay-reference-frame branch June 11, 2026 09:43
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-06-11 09:43 UTC

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.

1 participant