Skip to content

fix(zoom): auto-placed zoom regions follow the cursor for their whole span - #118

Merged
EtienneLescot merged 1 commit into
mainfrom
fix/72-auto-zoom-follow-cursor
Jul 19, 2026
Merged

fix(zoom): auto-placed zoom regions follow the cursor for their whole span#118
EtienneLescot merged 1 commit into
mainfrom
fix/72-auto-zoom-follow-cursor

Conversation

@EtienneLescot

@EtienneLescot EtienneLescot commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Auto zoom regions (created by the magic-wand cursor-dwell suggestion pass, source: "auto") were built with focusMode left undefined unless the separate, global "Auto Focus All" toggle was on.
  • With focusMode not "auto", the zoom/pan render used the static dwell-centroid focus point captured when the region was suggested and never tracked the cursor for the rest of the region — matching the reported symptom of the zoom "jumping to the cursor's position at the start and then staying fixed."
  • The cursor-follow interpolation logic (zoomRegionUtils.ts / cursorFollowUtils.ts) already existed and worked correctly when focusMode: "auto" — it just wasn't being applied by default to auto-suggested regions.
  • Fix: buildAutoZoomRegions in src/components/video-editor/VideoEditor.tsx now always sets focusMode: "auto" for regions with source: "auto", independent of the "Auto Focus All" toggle (which still only controls the default for manually-drawn zoom regions — unchanged).

Root cause

src/components/video-editor/VideoEditor.tsxbuildAutoZoomRegions() set focusMode: autoFocusAll ? "auto" : undefined for every auto-suggested region. Since autoFocusAll defaults to false, freshly auto-placed zoom regions got focusMode: undefined, which getResolvedFocus() in src/components/video-editor/videoPlayback/zoomRegionUtils.ts treats as "manual" (static focus point), so the pan never sampled cursor telemetry across the region's time range.

Test plan

  • Added src/components/video-editor/videoPlayback/zoomRegionUtils.test.ts: regression test asserting an auto-zoom region's resolved focus tracks moving cursor telemetry across its span, and that a manual-focus-mode region stays pinned to its static focus (manual regions unaffected).
  • npx tsc --noEmit — no new errors (2 pre-existing unrelated errors for optional @xenova/transformers / onnxruntime-web deps).
  • npm run lint (biome check on changed files) — clean.
  • npm run test — all 52 test files / 409 tests pass.
  • Live app smoke test (record → auto-zoom → playback) was not performed in this session due to the setup cost of driving real screen capture from a worktree; verification here is unit-test only. A manual smoke test recording a clip with cursor movement, letting the magic wand auto-place a zoom region, and confirming the pan follows the cursor during playback is recommended before merge.

Fixes #72

Summary by CodeRabbit

  • Bug Fixes

    • Auto-placed zoom regions now continuously follow the cursor throughout their duration.
    • Manual zoom regions continue to preserve their fixed focus.
    • Improved zoom behavior consistency when automatic focus settings are enabled or disabled.
  • Tests

    • Added regression coverage for cursor-following behavior in automatic zoom regions.

… span

Auto zoom regions (created by the magic-wand cursor-dwell suggestion pass)
were built with focusMode left undefined unless the separate, global
"Auto Focus All" toggle was on. That meant the pan/zoom used the static
dwell-centroid focus captured at suggestion time and never tracked the
cursor afterward, even though the cursor-follow interpolation logic
(zoomRegionUtils/cursorFollowUtils) already existed and just wasn't wired
up by default for these regions.

Auto-suggested regions now always get focusMode "auto" so they pan to
track the cursor telemetry across their whole span, independent of the
"Auto Focus All" toggle (which still only controls the default for
manually-drawn zoom regions).

Fixes #72

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2177e8cc-1baf-47a5-b203-3a5fe52a02ec

📥 Commits

Reviewing files that changed from the base of the PR and between d5966ed and e92e3e3.

📒 Files selected for processing (2)
  • src/components/video-editor/VideoEditor.tsx
  • src/components/video-editor/videoPlayback/zoomRegionUtils.test.ts

📝 Walkthrough

Walkthrough

Auto-generated zoom regions now always use automatic cursor-following focus, independent of the global Auto Focus All setting. Regression tests cover automatic cursor tracking and static manual focus behavior.

Changes

Auto zoom focus behavior

Layer / File(s) Summary
Auto zoom region generation
src/components/video-editor/VideoEditor.tsx
Auto-generated regions now set focusMode: "auto" unconditionally, retain source: "auto", and remove autoFocusAll from memoization dependencies. Comments document the behavior.
Focus behavior regression tests
src/components/video-editor/videoPlayback/zoomRegionUtils.test.ts
Tests verify automatic regions follow cursor telemetry over time while manual regions remain pinned to their static focus.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: siddharthvaddem

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the bug, root cause, and testing, but it omits several required template sections like type, release impact, desktop impact, and screenshots. Add the missing template sections, especially type of change, release and desktop impact, screenshots/video, and complete testing details.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main fix: auto-placed zoom regions now follow the cursor across their span.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/72-auto-zoom-follow-cursor

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@EtienneLescot
EtienneLescot merged commit 9844c78 into main Jul 19, 2026
11 checks passed
@EtienneLescot
EtienneLescot deleted the fix/72-auto-zoom-follow-cursor branch July 19, 2026 08:50
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.

[Bug]: Auto zoom does not follow the cursor

1 participant