Skip to content

feat(desktop): auto zoom from cursor movement + higher default export quality#1995

Open
sukirman1901 wants to merge 1 commit into
CapSoftware:mainfrom
sukirman1901:feat/auto-zoom-movement-export-quality
Open

feat(desktop): auto zoom from cursor movement + higher default export quality#1995
sukirman1901 wants to merge 1 commit into
CapSoftware:mainfrom
sukirman1901:feat/auto-zoom-movement-export-quality

Conversation

@sukirman1901

@sukirman1901 sukirman1901 commented Jul 10, 2026

Copy link
Copy Markdown

Summary

  • Auto zoom segments now also come from sustained cursor movement/drag bursts (not only clicks), with idle-gap splitting so separate gestures stay separate.
  • Zoom amount is adaptive (about 1.5x–2.5x) based on how tightly cursor activity is clustered on screen.
  • Default share/copy/save export compression is raised from Web to Social for sharper output by default.

Test plan

  • Record in Studio mode with cursor capture enabled; click around and also drag/move without clicking
  • Open editor and generate/auto-apply zoom segments — expect zooms on movement bursts as well as clicks
  • Confirm separate movement bursts with a long pause become separate segments
  • Confirm tight local activity zooms in more than wide sweeping movement
  • Share / copy / save from editor or recordings overlay and confirm export uses Social compression (higher quality than Web)
  • cargo test -p cap-desktop --lib movement_ and zoom_amount_adapts pass

Made with Cursor

Greptile Summary

This PR expands desktop auto-zoom behavior and raises default export quality.

  • Movement and drag bursts can now create auto-zoom segments.
  • Auto-zoom amount now adapts to cursor activity spread.
  • Share, copy, and save exports now default to Social compression.

Confidence Score: 4/5

The changed auto-zoom path should be fixed before merging.

  • Movement bursts can be created from sustained tiny cursor oscillation.
  • Interleaved cursor streams can inflate movement distance.
  • Merged click and movement windows can reduce the click zoom amount unexpectedly.
  • The Social compression changes use a supported export setting.

apps/desktop/src-tauri/src/recording.rs

Important Files Changed

Filename Overview
apps/desktop/src-tauri/src/recording.rs Adds movement-burst auto-zoom and adaptive zoom amounts; the new burst and amount logic can misclassify jitter or mixed cursor streams.
apps/desktop/src/routes/editor/ShareButton.tsx Changes the editor share export preset from Web to Social.
apps/desktop/src/routes/recordings-overlay.tsx Changes overlay copy, upload, and save export presets from Web to Social.
Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 3
apps/desktop/src-tauri/src/recording.rs:3774
**Tiny Oscillation Becomes Zoom**

When the OS reports repeated pixel-level cursor changes while the cursor is effectively idle, `burst.travel` can pass this total-distance check even though the pointer stays in a tiny area. That creates a movement-only zoom segment, and the small spread then drives the adaptive amount toward the maximum zoom, so idle jitter can show up as an unintended zoom in the final recording.

### Issue 2 of 3
apps/desktop/src-tauri/src/recording.rs:3673-3675
**Cursor Streams Share Travel**

This computes travel between consecutive move events without checking whether they came from the same `cursor_id`. If two cursor streams are interleaved by time, a small move from cursor A followed by a small move from cursor B can look like one large jump, causing a false movement burst and an auto-zoom segment that neither cursor produced on its own.

### Issue 3 of 3
apps/desktop/src-tauri/src/recording.rs:3809
**Merged Movement Dilutes Click Zoom**

After click and movement intervals are merged, the amount is computed from every move inside the merged time window. A click near one screen area followed within the merge gap by movement far away can reduce the whole segment to the minimum zoom, so the click that previously received the fixed 2.0x auto-zoom becomes noticeably less focused.

Reviews (1): Last reviewed commit: "feat(desktop): improve auto zoom from cu..." | Re-trigger Greptile

Greptile also left 3 inline comments on this PR.

Context used:

  • Context used - CLAUDE.md (source)
  • Context used - AGENTS.md (source)

…lt export quality

Detect sustained cursor movement bursts for auto zoom segments (not only clicks), scale zoom amount by activity spread, and default share/export compression to Social for sharper output.

Co-authored-by: Cursor <cursoragent@cursor.com>
for burst in detect_movement_bursts(&moves, MOVE_IDLE_GAP_MS) {
if burst.start_ms >= click_cutoff_ms
|| burst.travel < MOVE_MIN_TRAVEL
|| burst.end_ms - burst.start_ms < MOVE_MIN_DURATION_MS

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Tiny Oscillation Becomes Zoom

When the OS reports repeated pixel-level cursor changes while the cursor is effectively idle, burst.travel can pass this total-distance check even though the pointer stays in a tiny area. That creates a movement-only zoom segment, and the small spread then drives the adaptive amount toward the maximum zoom, so idle jitter can show up as an unintended zoom in the final recording.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src-tauri/src/recording.rs
Line: 3774

Comment:
**Tiny Oscillation Becomes Zoom**

When the OS reports repeated pixel-level cursor changes while the cursor is effectively idle, `burst.travel` can pass this total-distance check even though the pointer stays in a tiny area. That creates a movement-only zoom segment, and the small spread then drives the adaptive amount toward the maximum zoom, so idle jitter can show up as an unintended zoom in the final recording.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +3673 to +3675
let dx = m.x - last_pos.0;
let dy = m.y - last_pos.1;
travel += (dx * dx + dy * dy).sqrt();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Cursor Streams Share Travel

This computes travel between consecutive move events without checking whether they came from the same cursor_id. If two cursor streams are interleaved by time, a small move from cursor A followed by a small move from cursor B can look like one large jump, causing a false movement burst and an auto-zoom segment that neither cursor produced on its own.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src-tauri/src/recording.rs
Line: 3673-3675

Comment:
**Cursor Streams Share Travel**

This computes travel between consecutive move events without checking whether they came from the same `cursor_id`. If two cursor streams are interleaved by time, a small move from cursor A followed by a small move from cursor B can look like one large jump, causing a false movement burst and an auto-zoom segment that neither cursor produced on its own.

How can I resolve this? If you propose a fix, please make it concise.

start: start.round() / MS_PER_SECOND,
end: end.round() / MS_PER_SECOND,
amount: AUTO_ZOOM_AMOUNT,
amount: zoom_amount_for_interval(&moves, start, end),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Merged Movement Dilutes Click Zoom

After click and movement intervals are merged, the amount is computed from every move inside the merged time window. A click near one screen area followed within the merge gap by movement far away can reduce the whole segment to the minimum zoom, so the click that previously received the fixed 2.0x auto-zoom becomes noticeably less focused.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src-tauri/src/recording.rs
Line: 3809

Comment:
**Merged Movement Dilutes Click Zoom**

After click and movement intervals are merged, the amount is computed from every move inside the merged time window. A click near one screen area followed within the merge gap by movement far away can reduce the whole segment to the minimum zoom, so the click that previously received the fixed 2.0x auto-zoom becomes noticeably less focused.

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

for m in moves {
if m.time_ms < start_ms || m.time_ms > end_ms {
continue;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice. Since moves is sorted by time_ms now, you can break once you pass end_ms to avoid scanning the full list for every segment.

Suggested change
}
for m in moves {
if m.time_ms < start_ms {
continue;
}
if m.time_ms > end_ms {
break;
}
min_x = min_x.min(m.x);
max_x = max_x.max(m.x);
min_y = min_y.min(m.y);
max_y = max_y.max(m.y);
found = true;
}

y: RESOLUTION_OPTIONS._1080p.height,
},
compression: "Web",
compression: "Social",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bumping the default compression makes sense. Might be worth a quick rg "compression: \"Web\"" to make sure there aren’t other export entry points still defaulting to Web (to avoid inconsistent output quality across flows).

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