feat(desktop): auto zoom from cursor movement + higher default export quality#1995
feat(desktop): auto zoom from cursor movement + higher default export quality#1995sukirman1901 wants to merge 1 commit into
Conversation
…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 |
There was a problem hiding this comment.
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.| let dx = m.x - last_pos.0; | ||
| let dy = m.y - last_pos.1; | ||
| travel += (dx * dx + dy * dy).sqrt(); |
There was a problem hiding this comment.
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), |
There was a problem hiding this 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.
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; | ||
| } |
There was a problem hiding this comment.
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.
| } | |
| 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", |
There was a problem hiding this comment.
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).
Summary
WebtoSocialfor sharper output by default.Test plan
cargo test -p cap-desktop --lib movement_andzoom_amount_adaptspassMade with Cursor
Greptile Summary
This PR expands desktop auto-zoom behavior and raises default export quality.
Confidence Score: 4/5
The changed auto-zoom path should be fixed before merging.
apps/desktop/src-tauri/src/recording.rs
Important Files Changed
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "feat(desktop): improve auto zoom from cu..." | Re-trigger Greptile
Context used: