Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

refactor: update ZoomFocusInterpolator callers with click_spring and zoom_segments

Richie McIlroy48f2edc988c4
diff --git a/apps/desktop/src-tauri/src/export.rs b/apps/desktop/src-tauri/src/export.rs
index 0eba1e546..40993c1db 100644
--- a/apps/desktop/src-tauri/src/export.rs
+++ b/apps/desktop/src-tauri/src/export.rs
@@ -336,8 +336,14 @@ pub async fn generate_export_preview(
let zoom_focus_interpolator = ZoomFocusInterpolator::new(
&render_segment.cursor,
cursor_smoothing,
+ project_config.cursor.click_spring_config(),
project_config.screen_movement_spring,
total_duration,
+ project_config
+ .timeline
+ .as_ref()
+ .map(|t| t.zoom_segments.as_slice())
+ .unwrap_or(&[]),
);
let uniforms = ProjectUniforms::new(
@@ -482,8 +488,14 @@ pub async fn generate_export_preview_fast(
let zoom_focus_interpolator = ZoomFocusInterpolator::new(
&segment_media.cursor,
cursor_smoothing,
+ project_config.cursor.click_spring_config(),
project_config.screen_movement_spring,
total_duration,
+ project_config
+ .timeline
+ .as_ref()
+ .map(|t| t.zoom_segments.as_slice())
+ .unwrap_or(&[]),
);
let uniforms = ProjectUniforms::new(
diff --git a/apps/desktop/src-tauri/src/screenshot_editor.rs b/apps/desktop/src-tauri/src/screenshot_editor.rs
index 6dec290f6..472be597e 100644
--- a/apps/desktop/src-tauri/src/screenshot_editor.rs
+++ b/apps/desktop/src-tauri/src/screenshot_editor.rs
@@ -356,8 +356,14 @@ impl ScreenshotEditorInstances {
let zoom_focus_interpolator = ZoomFocusInterpolator::new(
&cursor_events,
None,
+ current_config.cursor.click_spring_config(),
current_config.screen_movement_spring,
0.0,
+ current_config
+ .timeline
+ .as_ref()
+ .map(|t| t.zoom_segments.as_slice())
+ .unwrap_or(&[]),
);
let uniforms = ProjectUniforms::new(
diff --git a/crates/cap-test/src/suites/performance.rs b/crates/cap-test/src/suites/performance.rs
index c109b920f..b8ea76e94 100644
--- a/crates/cap-test/src/suites/performance.rs
+++ b/crates/cap-test/src/suites/performance.rs
@@ -482,8 +482,15 @@ async fn benchmark_playback(
let zoom_focus_interpolator = ZoomFocusInterpolator::new(
&segment_media.cursor,
cursor_smoothing,
+ context.project.cursor.click_spring_config(),
context.project.screen_movement_spring,
duration,
+ context
+ .project
+ .timeline
+ .as_ref()
+ .map(|t| t.zoom_segments.as_slice())
+ .unwrap_or(&[]),
);
let uniforms = ProjectUniforms::new(
@@ -671,8 +678,15 @@ async fn render_single_frame(context: &FixtureContext) -> Result<()> {
let zoom_focus_interpolator = ZoomFocusInterpolator::new(
&segment_media.cursor,
cursor_smoothing,
+ context.project.cursor.click_spring_config(),
context.project.screen_movement_spring,
duration,
+ context
+ .project
+ .timeline
+ .as_ref()
+ .map(|t| t.zoom_segments.as_slice())
+ .unwrap_or(&[]),
);
let uniforms = ProjectUniforms::new(
&context.render_constants,
diff --git a/crates/editor/examples/playback-pipeline-benchmark.rs b/crates/editor/examples/playback-pipeline-benchmark.rs
index e59172ee9..7acedd2b1 100644
--- a/crates/editor/examples/playback-pipeline-benchmark.rs
+++ b/crates/editor/examples/playback-pipeline-benchmark.rs
@@ -356,8 +356,14 @@ async fn run_full_pipeline_benchmark(
let zoom_focus_interpolator = ZoomFocusInterpolator::new(
&segment_media.cursor,
cursor_smoothing,
+ project.cursor.click_spring_config(),
project.screen_movement_spring,
duration,
+ project
+ .timeline
+ .as_ref()
+ .map(|t| t.zoom_segments.as_slice())
+ .unwrap_or(&[]),
);
let uniforms = ProjectUniforms::new(
@@ -518,8 +524,14 @@ async fn run_scrubbing_benchmark(
let zoom_focus_interpolator = ZoomFocusInterpolator::new(
&segment_media.cursor,
cursor_smoothing,
+ project.cursor.click_spring_config(),
project.screen_movement_spring,
duration,
+ project
+ .timeline
+ .as_ref()
+ .map(|t| t.zoom_segments.as_slice())
+ .unwrap_or(&[]),
);
let uniforms = ProjectUniforms::new(
diff --git a/crates/editor/src/editor_instance.rs b/crates/editor/src/editor_instance.rs
index bf42055aa..cc1f823db 100644
--- a/crates/editor/src/editor_instance.rs
+++ b/crates/editor/src/editor_instance.rs
@@ -530,8 +530,10 @@ impl EditorInstance {
let zoom_focus_interpolator = ZoomFocusInterpolator::new_arc(
segment_medias.cursor.clone(),
cursor_smoothing,
+ project.cursor.click_spring_config(),
project.screen_movement_spring,
total_duration,
+ project.timeline.as_ref().map(|t| t.zoom_segments.as_slice()).unwrap_or(&[]),
);
let uniforms = ProjectUniforms::new(