-
Notifications
You must be signed in to change notification settings - Fork 759
Automatic zoom segment generation #558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatic zoom segment generation #558
Conversation
WalkthroughThe 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 Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
📒 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
Summary
Demo:
https://cap.link/05kt9w0gwr0wa74
Summary by CodeRabbit