Cap icon indicating copy to clipboard operation
Cap copied to clipboard

Make auto-zoom duration and click-merge gap configurable

Open pxshaaa opened this issue 1 month ago • 3 comments

Feature request: make auto-zoom timing configurable

Right now the only auto-zoom settings are the on/off toggle and Default zoom amount. How long each zoom lasts is hardcoded in generate_zoom_segments_from_clicks:

https://github.com/CapSoftware/Cap/blob/848d18fe7b601f1b92ada6563e56e1fba4ebe1e0/apps/desktop-gpui/src/editor_edits.rs#L2135-L2139

const CLICK_PRE_PADDING_MS: f64 = 300.0;
const CLICK_POST_PADDING_MS: f64 = 2500.0;
const MERGE_GAP_MS: f64 = 2500.0;

Each click gets about 2.8 s of zoom. Zooms are merged when the gap between them is under 2.5 s, so any clicks less than ~5 s apart end up in one long zoom. In a fast product demo that turns into one zoom covering most of the recording. In my case, 7 clicks over about 6 s became a single 5.6 s zoom in a 9 s clip, and I had to trim it by hand.

Proposal: add these to Settings next to "Default zoom amount":

  • Zoom hold after click (currently 2.5 s)
  • Merge nearby clicks gap (currently 2.5 s), or a toggle to never merge

Even one "Auto zoom length: Short / Normal / Long" preset would cover most cases.

Version: Cap 0.6.1 (macOS, Homebrew cask)

pxshaaa avatar Oct 22 '26 13:10 pxshaaa

CAP-876

linear[bot] avatar Oct 22 '26 13:10 linear[bot]

I'd like to take this on.

Root Cause & Proposed Implementation

In apps/desktop-gpui/src/editor_edits.rs, generate_zoom_segments_from_clicks currently hardcodes CLICK_POST_PADDING_MS = 2500.0 and MERGE_GAP_MS = 2500.0.

To make auto-zoom timing configurable while preserving backwards-compatible defaults (2.5s hold duration and 2.5s merge gap):

  1. apps/desktop-gpui/src/editor_edits.rs:
    • Introduce AutoZoomTiming { post_padding_ms, merge_gap_ms } (Default: 2500.0ms hold, 2500.0ms merge gap) and AutoZoomTiming::from_seconds(hold_seconds: Option<f32>, merge_gap_seconds: Option<f32>).
    • Add generate_zoom_segments_for_timeline_with_timing and generate_zoom_segments_from_clicks_with_timing (with merge_gap_ms == 0.0 disabling gap-based merging of non-overlapping click intervals while still coalescing directly overlapping intervals).
  2. apps/desktop-gpui/src/store.rs:
    • Add auto_zoom_duration: Option<f32> (autoZoomDuration) and auto_zoom_merge_gap: Option<f32> (autoZoomMergeGap) to GeneralSettings.
  3. apps/desktop-gpui/src/settings_window.rs & apps/desktop-gpui/src/editor_window.rs:
    • Add Zoom hold duration (1s, 1.5s, 2.5s, 3.5s, 5s) and Merge nearby clicks gap (Off, 1s, 1.5s, 2.5s, 3.5s, 5s) rows next to Default zoom amount in General Settings, and pass the loaded AutoZoomTiming in EditorWindow::generate_auto_zoom.
  4. Tests:
    • Add unit tests in editor_edits.rs (auto_zoom_respects_custom_hold_duration_and_merge_gap) and store.rs (typed_reads_match_the_store_shape).

I have a verified branch ready on my fork (feat/issue-2928-configurable-auto-zoom-timing) and can open a PR as soon as assigned.

duongynhi000005-oss avatar Oct 26 '26 19:10 duongynhi000005-oss

Thanks for the suggestion! Making the zoom hold and merge gap configurable makes sense for fast demos.

richiemcilroy avatar Nov 04 '26 16:11 richiemcilroy