Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

richiemcilroy
Copy link
Member

@richiemcilroy richiemcilroy commented May 20, 2025

Summary

  • generate zoom segments only from click events
  • merge bursts of clicks into a single automatic segment

Demo:
https://cap.link/05kt9w0gwr0wa74

Summary by CodeRabbit

  • New Features
    • Added an experimental setting to automatically generate zoom segments around mouse clicks during Studio Mode recordings, enhancing interaction visibility.
    • Introduced a new command to generate zoom segments from clicks, accessible via a context menu in the timeline zoom track (development mode only).
  • Refactor
    • Improved zoom segment generation to support multiple segments and group clicks more accurately for smoother automatic zooming during playback.
  • Bug Fixes
    • Updated header styling by removing the border for a cleaner interface.

@richiemcilroy richiemcilroy changed the title Group click-based zoom segments Automatic zoom segment generation May 20, 2025
@richiemcilroy richiemcilroy marked this pull request as ready for review May 20, 2025 12:52
Copy link
Contributor

coderabbitai bot commented Aug 5, 2025

Walkthrough

The function for generating zoom segments from cursor clicks was refactored to aggregate click events across all recording segments, supporting multi-segment studio recordings. The logic now groups closely timed clicks into single zoom segments, updates how cursor events are loaded, and removes outdated, single-segment-only code. Imports were adjusted accordingly. A new auto_zoom_on_clicks setting was added to user settings, with UI toggles introduced in experimental and general settings to enable or disable this feature. A new Tauri backend command and frontend integration were added to generate zoom segments on demand from the editor UI.

Changes

Cohort / File(s) Change Summary
Zoom Segment Aggregation & Refactor
apps/desktop/src-tauri/src/recording.rs
Refactored click aggregation for zoom segment generation to support multi-segment recordings, updated click grouping logic, adjusted imports, removed obsolete single-segment code, added conditional zoom segment generation based on user setting, and updated function signatures to include AppHandle.
User Settings Store Update
apps/desktop/src-tauri/src/general_settings.rs
Added new boolean field auto_zoom_on_clicks to GeneralSettingsStore with default false.
Experimental Settings UI Update
apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx
Added autoZoomOnClicks toggle control to experimental settings UI with label and description, integrated into existing toggle group.
General Settings UI Update
apps/desktop/src/routes/(window-chrome)/settings/general.tsx
Added autoZoomOnClicks boolean property with default false to general settings store state.
Tauri Backend Command Addition
apps/desktop/src-tauri/src/lib.rs
Added new async Tauri command generate_zoom_segments_from_clicks to generate zoom segments from editor instance metadata and recordings, registered command in Tauri.
Frontend Command & UI Integration
apps/desktop/src/routes/editor/Timeline/ZoomTrack.tsx
Added development-only context menu to trigger zoom segment generation from clicks via Tauri command, updating project state with results and logging errors.
Tauri Utility & Type Update
apps/desktop/src/utils/tauri.ts
Added async command generateZoomSegmentsFromClicks to frontend commands and optional autoZoomOnClicks property to GeneralSettingsStore type.
TypeScript Declaration Style Update
packages/ui-solid/src/auto-imports.d.ts
Changed double-quoted import path strings to single-quoted strings in icon component type declarations.
UI Styling Adjustment
apps/desktop/src/routes/(window-chrome).tsx
Removed "border" CSS class from header element to adjust styling without changing behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A click, a hop, a zoom in sight,
Across the segments, day and night.
Settings toggle, on or off,
Highlighting clicks with a gentle scoff.
The rabbit codes with nimble paws,
Bringing magic without a pause! 🐰✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 16746ba and 28c02ea.

📒 Files selected for processing (1)
  • apps/desktop/src-tauri/src/recording.rs (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/desktop/src-tauri/src/recording.rs
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pt1dih-codex/auto-create-zoom-segments-on-stop-recording

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
apps/desktop/src/routes/editor/Timeline/ZoomTrack.tsx (1)

43-50: Consider adding user feedback for the zoom segment generation action.

The error is only logged to console. Consider showing a toast notification or UI feedback to inform users about success or failure of the operation.

 const handleGenerateZoomSegments = async () => {
   try {
     const zoomSegments = await commands.generateZoomSegmentsFromClicks();
     setProject("timeline", "zoomSegments", zoomSegments);
+    // Show success feedback to user
+    console.log(`Successfully generated ${zoomSegments.length} zoom segments`);
   } catch (error) {
     console.error("Failed to generate zoom segments:", error);
+    // Consider showing an error notification to the user
   }
 };
apps/desktop/src-tauri/src/recording.rs (1)

841-846: Consider making zoom parameters configurable.

The hardcoded constants for zoom behavior could be made configurable through settings to allow users to customize the zoom experience.

Consider extracting these constants to a configuration struct or user settings:

pub struct ZoomGenerationConfig {
    pub after_click_padding: f64,  // default: 1.5
    pub before_click_padding: f64, // default: 0.8
    pub zoom_amount: f64,          // default: 2.0
    pub click_group_threshold: f64, // default: 0.6
    pub min_segment_padding: f64,   // default: 2.0
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 586a006 and ccdf20c.

📒 Files selected for processing (5)
  • apps/desktop/src-tauri/src/lib.rs (3 hunks)
  • apps/desktop/src-tauri/src/recording.rs (4 hunks)
  • apps/desktop/src/routes/editor/Timeline/ZoomTrack.tsx (3 hunks)
  • apps/desktop/src/utils/tauri.ts (2 hunks)
  • packages/ui-solid/src/auto-imports.d.ts (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/ui-solid/src/auto-imports.d.ts
  • apps/desktop/src-tauri/src/lib.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/desktop/src/utils/tauri.ts
🔇 Additional comments (4)
apps/desktop/src/routes/editor/Timeline/ZoomTrack.tsx (1)

54-69: LGTM! Development-only context menu is well-implemented.

The context menu is properly gated behind a development flag and follows good UX patterns by preventing the default behavior.

apps/desktop/src-tauri/src/recording.rs (3)

858-887: Solid zoom segment generation logic with good boundary handling.

The implementation correctly:

  • Filters for mouse down events only
  • Handles segment merging for closely timed clicks
  • Respects recording duration boundaries
  • Prevents overlapping segments

929-934: Good handling of multi-segment recordings.

The code properly aggregates click events from all segments using flat_map, which is an efficient approach for this use case.


945-948: Settings integration looks good.

The conditional zoom segment generation based on the auto_zoom_on_clicks setting is properly implemented with appropriate fallback handling.

Also applies to: 962-966

@Brendonovich Brendonovich merged commit 1897b8c into main Aug 6, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants