Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

feat(zoom): give the 3D Orbit camera the zoom's focus mode

EtienneLescote45b1627adef
diff --git a/crates/compositor/src/camera.rs b/crates/compositor/src/camera.rs
index 7c3e1adc4..b218e338d 100644
--- a/crates/compositor/src/camera.rs
+++ b/crates/compositor/src/camera.rs
@@ -1,12 +1,14 @@
-//! Caméra 3D réelle, en orbite, pour `follow-cursor`.
+//! Caméra 3D réelle, en orbite, pour le préset `orbit`.
//!
//! L'ÉCRAN NE BOUGE PAS. L'œil tourne autour de lui sur une sphère : l'azimut suit la position
-//! horizontale du pointeur (à droite, on voit l'écran par la droite et son côté droit vient vers
-//! nous), l'élévation sa position verticale (en haut, la caméra monte et plonge sur le haut de
-//! l'écran), autour d'une petite élévation de repos. L'œil regarde toujours son point visé, haut du
-//! monde fixe (le `lookAt` classique) : le roulis est donc nul PAR CONSTRUCTION. L'axe horizontal
-//! de l'image reste horizontal dans le monde, et une verticale qui passe par le point visé reste
-//! verticale à l'image. Ce qui penche encore, c'est la perspective, et elle seule.
+//! horizontale d'un point de l'écran (à droite, on voit l'écran par la droite et son côté droit
+//! vient vers nous), l'élévation sa position verticale (en haut, la caméra monte et plonge sur le
+//! haut de l'écran), autour d'une petite élévation de repos. Ce point est le pointeur lissé en
+//! focus auto (`follow`), le point de focus de la région en manuel (`fixed`). L'œil regarde
+//! toujours son point visé, haut du monde fixe (le `lookAt` classique) : le roulis est donc nul
+//! PAR CONSTRUCTION. L'axe horizontal de l'image reste horizontal dans le monde, et une verticale
+//! qui passe par le point visé reste verticale à l'image. Ce qui penche encore, c'est la
+//! perspective, et elle seule.
//!
//! Pourquoi une orbite et pas un pivot sur place : depuis un œil fixe, tourner la caméra n'est
//! presque qu'un pan à plat, l'angle sous lequel on voit l'écran change à peine. L'orientation ne
@@ -259,8 +261,23 @@ impl Follow {
pub const CENTRE: Follow = Follow { aim: [0.5; 2], orbit: [0.5; 2] };
}
-/// Où `follow-cursor` vise à `t` et où il place l'œil, pour une région de zoom `zoom`. Sans
-/// piste : le centre, caméra au repos.
+/// Portée du point visé au zoom `zoom` : il reste dans `0,5 ± reach`, là où la vue reste dans
+/// l'écran ; au zoom 1, le centre.
+fn reach(zoom: f32) -> f32 {
+ (0.5 - 0.5 * VIEW_MARGIN / zoom.max(1.0)).max(0.0)
+}
+
+/// L'orbite en focus manuel, posée par le point de focus de la région (`point`, fractions de
+/// l'écran recadré) comme par un pointeur garé là : l'œil sur l'orbite de ce point, le point visé
+/// le même borné à la portée du zoom. Sans piste : rien ne bouge pendant la région.
+pub fn fixed(point: [f32; 2], zoom: f32) -> Follow {
+ let r = reach(zoom);
+ let orbit = point.map(|p| p.clamp(0.0, 1.0));
+ Follow { aim: orbit.map(|p| p.clamp(0.5 - r, 0.5 + r)), orbit }
+}
+
+/// Où l'orbite en focus auto vise à `t` et où elle place l'œil, pour une région de zoom `zoom`.
+/// Sans piste : le centre, caméra au repos.
///
/// Le pointeur (lu dans l'image source recadrée, borné à l'écran et à la fenêtre du clip) passe
/// par la réponse impulsionnelle d'un ressort critique, `h(τ) = ω²·τ·e^(−ωτ)`, avancée de
@@ -273,7 +290,7 @@ impl Follow {
/// reste dans l'écran ; au zoom 1, le centre.
pub fn follow(frame: &CameraFrame, t: f32, zoom: f32) -> Follow {
let Some(track) = frame.track else { return Follow::CENTRE };
- let reach = (0.5 - 0.5 * VIEW_MARGIN / zoom.max(1.0)).max(0.0);
+ let reach = reach(zoom);
let [x0, y0, x1, y1] = frame.crop;
let size = [(x1 - x0).max(1e-6), (y1 - y0).max(1e-6)];
let (mut aim, mut orbit, mut total) = ([0.0f32; 2], [0.0f32; 2], 0.0f32);
diff --git a/crates/compositor/src/compositor_linux.rs b/crates/compositor/src/compositor_linux.rs
index 561a59a15..593de6628 100644
--- a/crates/compositor/src/compositor_linux.rs
+++ b/crates/compositor/src/compositor_linux.rs
@@ -5209,7 +5209,7 @@ mod tests {
"screenRect":{{"x":0.1,"y":0.1,"width":0.8,"height":0.8}}}},
"effects":{{"padding":0.2,"blur":false,"shadow":0,"roundnessFrac":0.03,"motionBlur":0}},
"background":{{"kind":"gradient","angleDeg":135,"stops":["#5b6ee1","#e8a0bf"]}},
- "zoomRegions":[{{"clipIndex":0,"startSec":0,"endSec":10,"scale":1,"focusX":0.5,"focusY":0.5,"focusMode":"manual","rotation":{rotation}}}],
+ "zoomRegions":[{{"clipIndex":0,"startSec":0,"endSec":10,"scale":1,"focusX":0.5,"focusY":0.5,"rotation":{rotation}}}],
"annotations":[],
"cursor":{{"show":{show},"size":{size},"smoothing":0,"motionBlur":0,"clickBounce":2.5{model3d},"clipToBounds":false,"theme":"{theme}",
"cursorSprites":{{{sprites}}}}},
@@ -5695,7 +5695,7 @@ mod tests {
}
// -----------------------------------------------------------------------
- // Camera reelle (`follow-cursor`) : pendant de `tests/follow_camera_render.rs` (Windows).
+ // Camera reelle (`orbit`, focus auto) : pendant de `tests/follow_camera_render.rs` (Windows).
// -----------------------------------------------------------------------
/// Le warp projectif du WGSL pose chaque ligne verticale d'une grille la ou la camera la
@@ -5712,7 +5712,7 @@ mod tests {
let screen = FakeFrame::from_planes(&gpu, w, h, &y, &uv);
// Profondeur de champ coupee (allumee par defaut) : l'orbite a une vraie profondeur, et un
// trait floute ne se mesure plus a +-8 px.
- let json = model_scene_json(r#""follow-cursor""#, None, "none", true, 0.05)
+ let json = model_scene_json(r#""orbit","focusMode":"auto""#, None, "none", true, 0.05)
.replace(r#""scale":1,"#, r#""scale":2.2,"#)
.replace(r#""roundnessFrac":0.03"#, r#""roundnessFrac":0,"depthOfField":false"#);
let scene = crate::scene::Scene::from_json(&json).expect("scene json");
diff --git a/crates/compositor/src/frame_geometry.rs b/crates/compositor/src/frame_geometry.rs
index cbad9015c..c8b29cbeb 100644
--- a/crates/compositor/src/frame_geometry.rs
+++ b/crates/compositor/src/frame_geometry.rs
@@ -1784,7 +1784,7 @@ pub struct FrameGeometry {
/// Part dynamique du tilt (parallaxe, `regions::dynamic_tilt`), ajoutée à la base à la
/// projection. Nulle quand la base est neutre.
pub zoom_rotation_dyn: [f32; 3],
- /// Caméra réelle de `follow-cursor` (`camera.rs`), `None` sans elle. Jamais en même temps
+ /// Caméra réelle de `orbit` (`camera.rs`), `None` sans elle. Jamais en même temps
/// qu'une `zoom_rotation` non nulle.
pub camera: Option<crate::camera::CameraPose>,
/// La rotation de base une frame d'écran plus tôt : avec `s_dst_prev` et `camera_prev`, le
@@ -2864,15 +2864,15 @@ pub fn plan_frame(input: &FrameGeometryInput) -> FrameGeometry {
let mut zoom_aim = [0.5f32; 2];
let mut zoom_orbit = [0.5f32; 2];
let (mut zoom_aim_prev, mut zoom_orbit_prev) = ([0.5f32; 2], [0.5f32; 2]);
- // Curseur masqué → pas de piste pour ce qui anime le plan (parallaxe, impact, caméra
- // `follow-cursor`) : un plan ne bouge que sous un pointeur qu'on voit. Preview et export
+ // Curseur masqué → pas de piste pour ce qui anime le plan (parallaxe, impact, orbite en
+ // focus auto) : un plan ne bouge que sous un pointeur qu'on voit. Preview et export
// chargent la piste dans tous les cas (le focus auto la suit), cette porte fait le reste.
let parallax_track = cursor_for_zoom.filter(|_| scene.is_some_and(|s| s.cursor.show));
let active_crop = scene.and_then(|scene| {
scene.crop_by_clip.get(scene.active_clip_index).copied().flatten()
});
if !zoom_regions.is_empty() {
- // La caméra `follow-cursor` lit le curseur dans l'image SOURCE recadrée — pas dans la
+ // L'orbite en focus auto lit le curseur dans l'image SOURCE recadrée — pas dans la
// coupe zoomée, qu'un focus auto recentre sur lui — et ignore ce qu'une coupe retire.
let camera = crate::regions::CameraFrame {
track: parallax_track,
@@ -4393,6 +4393,10 @@ mod tests {
assert_eq!(a.s_ann, a.s_dst, "sans zoom, ancre et boîte écran coïncident");
}
+ /// La caméra en orbite, en focus auto : celle qui bouge avec le pointeur. Sans piste, elle
+ /// rend comme l'orbite manuelle posée au centre.
+ const ORBIT: &str = r#""orbit","focusMode":"auto""#;
+
/// Scène à boîte écran résolue par l'app, pour le cadre de fenêtre. `frame` est inséré tel
/// quel dans `effects` (chaîne vide = clé absente).
fn framed_scene(frame: &str, rotation: &str, zoom: f32, cover: bool) -> Scene {
@@ -4583,7 +4587,7 @@ mod tests {
#[test]
fn a_moving_tilted_screen_is_motion_blurred_as_one_object() {
let cfg = crate::config::all().pop().expect("au moins une config");
- for rotation in [r#""iso""#, r#""follow-cursor""#] {
+ for rotation in [r#""iso""#, ORBIT] {
for frame in ["", r#","frame":"laptop""#] {
let mut scene = framed_scene(frame, rotation, 1.5, false);
scene.effects.motion_blur = 1.0;
@@ -4782,7 +4786,7 @@ mod tests {
#[test]
fn the_device_screen_face_lands_on_the_footage_plane() {
for (name, _) in DEVICES {
- for rotation in ["null", r#""iso""#, r#""left""#, r#""follow-cursor""#] {
+ for rotation in ["null", r#""iso""#, r#""left""#, ORBIT] {
let g = device_plan(name, rotation, 1.0);
let view = g.device_view(RENDER).expect("caméra");
let center = g.screen_center_px(RENDER);
@@ -4825,7 +4829,7 @@ mod tests {
fn the_footage_edge_falls_on_the_aperture_edge() {
let mut worst: f32 = 0.0;
for (name, _) in DEVICES {
- for rotation in ["null", r#""iso""#, r#""left""#, r#""right""#, r#""follow-cursor""#] {
+ for rotation in ["null", r#""iso""#, r#""left""#, r#""right""#, ORBIT] {
let g = device_plan(name, rotation, 1.0);
let view = g.device_view(RENDER).expect("caméra");
let center = g.screen_center_px(RENDER);
@@ -4892,7 +4896,7 @@ mod tests {
// caméra réelle, elle, garde les deux.
let plain = flat_cb(&framed_plan(&framed_scene("", r#""iso""#, 1.0, false)));
assert_eq!((plain.dst_prev[3], plain.color), (0.0, [0.0; 4]));
- let orbit = flat_cb(&framed_plan(&framed_scene("", r#""follow-cursor""#, 1.0, false)));
+ let orbit = flat_cb(&framed_plan(&framed_scene("", ORBIT, 1.0, false)));
assert_eq!(orbit.dst_prev[3], 1.0);
assert!(orbit.color[0] != 0.0 || orbit.color[1] != 0.0, "la caméra réelle n'éclaire plus");
}
@@ -4903,7 +4907,7 @@ mod tests {
#[test]
fn the_device_box_and_its_shadow_contain_the_model() {
for (name, kind) in DEVICES {
- for rotation in ["null", r#""iso""#, r#""left""#, r#""right""#, r#""follow-cursor""#] {
+ for rotation in ["null", r#""iso""#, r#""left""#, r#""right""#, ORBIT] {
let g = device_plan(name, rotation, 1.0);
let frame = g.window_frame.expect("un cadre");
let view = g.device_view(RENDER).expect("caméra");
@@ -4991,7 +4995,7 @@ mod tests {
/// RAYON, lui, suit la course de Roundness propre au cadre : `roundness_spans_each_frames_own_range`.)
#[test]
fn the_footage_box_is_the_same_under_every_frame() {
- for rotation in ["null", r#""iso""#, r#""follow-cursor""#] {
+ for rotation in ["null", r#""iso""#, ORBIT] {
for zoom in [1.0f32, 2.0] {
let bare = framed_plan(&framed_scene("", rotation, zoom, false));
for frame in ["window", "laptop", "phone", "monitor"] {
@@ -5143,7 +5147,7 @@ mod tests {
/// curseur affiché quand `rotation` est la caméra en orbite (elle le suit).
fn ratio_scene(frame: &str, ar: f32, roundness: f32, rotation: &str, zoom: f32) -> Scene {
let (w, h) = if ar >= 16.0 / 9.0 { (0.8, 0.8 * 16.0 / 9.0 / ar) } else { (0.8 * ar * 9.0 / 16.0, 0.8) };
- let show = rotation.contains("follow-cursor");
+ let show = rotation.contains("orbit");
Scene::from_json(&format!(
r##"{{
"clips":[{{"screenPath":"/s.mp4","webcamPath":"","sourceStartSec":0,"sourceEndSec":10,"webcamOffsetSec":0,"hasAudio":false}}],
@@ -5293,10 +5297,10 @@ mod tests {
}
}
- /// Une scène 1080p où la caméra en orbite (`follow-cursor`) zoome de `zoom` sur un pointeur
+ /// Une scène 1080p où la caméra en orbite (focus auto) zoome de `zoom` sur un pointeur
/// garé en (x, y) de l'image, sous le cadre `frame`, clip de ratio `ar`.
fn orbit_plan(frame: &str, ar: f32, zoom: f32, x: f32, y: f32) -> FrameGeometry {
- let scene = ratio_scene(&format!(r#","frame":"{frame}""#), ar, 0.03, r#""follow-cursor""#, zoom);
+ let scene = ratio_scene(&format!(r#","frame":"{frame}""#), ar, 0.03, ORBIT, zoom);
let cfg = crate::config::all().pop().expect("au moins une config");
let track: &'static crate::cursor::CursorTrack = Box::leak(Box::new(crate::cursor::CursorTrack::new(
(0..=150).map(|i| (i as f32 / 30.0, x, y)).collect(),
@@ -5452,7 +5456,7 @@ mod tests {
[(r[0] - b[0]) / b[2], (r[1] - b[1]) / b[3], r[2] / b[2], r[3] / b[3]]
};
for roundness in [0.0f32, 0.05] {
- for rotation in ["null", r#""iso""#, r#""right""#, r#""follow-cursor""#] {
+ for rotation in ["null", r#""iso""#, r#""right""#, ORBIT] {
for zoom in [1.0f32, 2.0] {
let bare = plan("", roundness, rotation, zoom);
for frame in
@@ -5963,7 +5967,7 @@ mod tests {
/// ce qu'on voit, le plan rogné par le slot.
#[test]
fn a_tilted_zoom_tilts_the_footage_inside_its_slot() {
- for rotation in [r#""iso""#, r#""right""#, r#""follow-cursor""#] {
+ for rotation in [r#""iso""#, r#""right""#, ORBIT] {
let g = slot_plan(&slot_scene(rotation, 2.0, true), Some((0.8, 0.3)));
let free = slot_plan(&slot_scene(rotation, 2.0, false), Some((0.8, 0.3)));
let mask = g.screen_mask.expect("masque");
@@ -6034,7 +6038,7 @@ mod tests {
let rest = slot_plan(&slot_scene_with("null", 1.0, true, &extra), pointer);
let rest_mask = rest.screen_mask.expect("un bloc masque son écran, sous un cadre aussi");
let rest_off = rest.screen_shadow_offset();
- for rotation in ["null", r#""iso""#, r#""follow-cursor""#] {
+ for rotation in ["null", r#""iso""#, ORBIT] {
let case = format!("{frame} {rotation}");
let g = slot_plan(&slot_scene_with(rotation, 2.0, true, &extra), pointer);
let bare = slot_plan(&slot_scene(rotation, 2.0, true), pointer);
@@ -6285,7 +6289,7 @@ mod tests {
}
/// Transition chaînée caméra réelle → angle fixe : la frame d'avant peut encore être dans la
- /// moitié `follow-cursor` quand celle-ci est dans la moitié fixe. La traînée doit alors partir
+ /// moitié orbite quand celle-ci est dans la moitié fixe. La traînée doit alors partir
/// du plan vu par la caméra d'AVANT, pas d'un plan droit.
#[test]
fn the_trail_keeps_the_previous_camera_across_a_follow_to_fixed_handover() {
@@ -6296,7 +6300,7 @@ mod tests {
));
let json = zoomed_golden_scene_json().replace(
r#"[{"clipIndex":0,"startSec":0.0,"endSec":5.0,"scale":2.0,"focusX":0.5,"focusY":0.3,"rotation":"none"}]"#,
- r#"[{"clipIndex":0,"startSec":1.0,"endSec":4.0,"scale":2.0,"focusX":0.5,"focusY":0.5,"rotation":"follow-cursor"},
+ r#"[{"clipIndex":0,"startSec":1.0,"endSec":4.0,"scale":2.0,"focusX":0.5,"focusY":0.5,"rotation":"orbit","focusMode":"auto"},
{"clipIndex":0,"startSec":4.5,"endSec":8.0,"scale":2.0,"focusX":0.5,"focusY":0.5,"rotation":"iso"}]"#,
);
assert_ne!(json, zoomed_golden_scene_json(), "la substitution doit poser les deux régions");
@@ -6511,7 +6515,7 @@ mod tests {
}
}
- /// `follow-cursor` passe par `plan_frame` : l'écran n'est pas incliné, la caméra vise et tourne
+ /// L'orbite en focus auto passe par `plan_frame` : l'écran n'est pas incliné, la caméra vise et tourne
/// avec le pointeur lu dans le RECADRAGE, la boîte zoome sur son centre sans glisser, la mise au
/// point suit la visée, un clic fait reculer l'œil sans presser l'écran, et curseur masqué
/// (l'export n'a alors pas de piste) la caméra vise le centre, au repos.
@@ -6519,7 +6523,7 @@ mod tests {
fn the_follow_camera_aims_at_the_pointer_in_the_crop() {
let cfg = crate::config::all().pop().expect("au moins une config");
let json = zoomed_golden_scene_json()
- .replace(r#""rotation":"none""#, r#""rotation":"follow-cursor""#)
+ .replace(r#""rotation":"none""#, r#""rotation":"orbit","focusMode":"auto""#)
.replace(r#""cursor":{"#, r#""cursor":{"clickImpact":true,"#);
let scene = Scene::from_json(&json).expect("scène");
let parked = |x: f32, clicks: Vec<f32>| -> &'static crate::cursor::CursorTrack {
@@ -6583,6 +6587,39 @@ mod tests {
assert!((front.orbit[0] - 0.5).abs() < 1e-4 && (front.orbit[1] - 0.5).abs() < 1e-4, "{:?}", front.orbit);
}
+ /// En focus manuel, l'orbite passe par le même chemin, posée par le point de focus de la
+ /// région : déjà dans le recadrage, comme celui d'un zoom à plat. Le pointeur n'y change rien,
+ /// et curseur masqué (pas de piste) elle reste posée.
+ #[test]
+ fn the_manual_orbit_sits_on_its_focus_point_in_the_crop() {
+ let cfg = crate::config::all().pop().expect("au moins une config");
+ let json = zoomed_golden_scene_json().replace(
+ r#""focusX":0.5,"focusY":0.3,"rotation":"none""#,
+ r#""focusX":0.74,"focusY":0.3,"rotation":"orbit","focusMode":"manual""#,
+ );
+ assert_ne!(json, zoomed_golden_scene_json(), "la substitution doit poser l'orbite");
+ let scene = Scene::from_json(&json).expect("scène");
+ let hidden = Scene::from_json(&json.replace(r#""show":true"#, r#""show":false"#)).expect("scène");
+ let parked = |x: f32| -> &'static crate::cursor::CursorTrack {
+ Box::leak(Box::new(crate::cursor::CursorTrack::new(
+ (0..=90).map(|i| (i as f32 / 30.0, x, 0.3)).collect(),
+ vec![],
+ vec![],
+ )))
+ };
+ let pose = |scene: &Scene, x: f32| {
+ plan_frame(&FrameGeometryInput { cursor: Some(parked(x)), ..golden_input(scene, &cfg) })
+ .camera
+ .expect("caméra")
+ };
+ for p in [pose(&scene, 0.55), pose(&scene, 0.05), pose(&hidden, 0.55)] {
+ assert_eq!(p.weight, 1.0);
+ // Zoom 2 : l'œil sur l'orbite du point, la visée bornée à 0,725.
+ assert!((p.orbit[0] - 0.74).abs() < 1e-3 && (p.orbit[1] - 0.3).abs() < 1e-3, "{:?}", p.orbit);
+ assert!((p.aim[0] - 0.725).abs() < 1e-3 && (p.aim[1] - 0.3).abs() < 1e-3, "{:?}", p.aim);
+ }
+ }
+
/// Sous un préset 3D, le masque est le quad du contenu, warpé comme le mode 8 le dessine.
#[test]
fn a_privacy_mask_follows_the_tilted_content() {
@@ -8007,7 +8044,7 @@ mod tests {
("iso", r#""rotation":"iso""#, true),
("left", r#""rotation":"left""#, true),
("right", r#""rotation":"right""#, true),
- ("follow", r#""rotation":"follow-cursor""#, true),
+ ("follow", r#""rotation":"orbit","focusMode":"auto""#, true),
];
let (to, from, away) = ([0.3, 0.18], [0.08, 0.05], [0.45, 0.32]);
let mut worst = 0.0f32;
@@ -8060,7 +8097,7 @@ mod tests {
let track: &'static crate::cursor::CursorTrack = Box::leak(Box::new(raw.smoothed(0.5)));
let quiet: &'static crate::cursor::CursorTrack =
Box::leak(Box::new(crate::cursor::CursorTrack::new(vec![(0.0, 0.3, 0.18), (4.0, 0.3, 0.18)], vec![], vec![])));
- for rotation in [r#""rotation":"none""#, r#""rotation":"iso""#, r#""rotation":"follow-cursor""#] {
+ for rotation in [r#""rotation":"none""#, r#""rotation":"iso""#, r#""rotation":"orbit","focusMode":"auto""#] {
let impacts = |track, t| model_frame(rotation, false, 0.0, track, t).1.expect("curseur").impacts;
assert!(impacts(quiet, TC + 0.1).is_empty(), "{rotation}: pas de clic, pas d'impact");
assert!(impacts(track, TC + 0.04).is_empty(), "{rotation}: avant le contact");
diff --git a/crates/compositor/src/regions.rs b/crates/compositor/src/regions.rs
index 42047c3d7..fda531a16 100644
--- a/crates/compositor/src/regions.rs
+++ b/crates/compositor/src/regions.rs
@@ -2,7 +2,7 @@
//! web (`zoomRegionUtils.ts` / `cameraFullscreenUtils.ts`) vers le natif, pour que le timing
//! des transitions soit identique en preview ET en export. Inclut le "connected zoom pan"
//! (chaînage lissé entre deux régions rapprochées), le focus "auto" (suivi de la télémétrie
-//! curseur) et la 3D (angles fixes iso/left/right, et la caméra `follow-cursor`, dont le modèle
+//! curseur) et la 3D (angles fixes iso/left/right, et la caméra `orbit`, dont le modèle
//! vit dans `camera.rs` ; le rendu est dans les backends — ce module ne fait que le calcul
//! temporel et la géométrie, pas le rendu GPU).
@@ -468,7 +468,7 @@ pub struct ZoomState {
/// un, 0 sinon ; interpolé entre deux régions chaînées, et refermé en milieu de course
/// quand leurs présets diffèrent. C'est la porte de `dynamic_tilt` (`tilt_gate`).
pub tilt: f32,
- /// Poids de la caméra réelle (`camera.rs`, 0..1) : la force de la région `follow-cursor`, 0
+ /// Poids de la caméra réelle (`camera.rs`, 0..1) : la force de la région `orbit`, 0
/// sinon. Jamais non nul en même temps que `rotation` (cf. la transition chaînée).
pub camera: f32,
/// Où la caméra vise, 0..1 dans le recadrage, déjà pondéré par `camera` (le centre à 0).
@@ -494,14 +494,14 @@ enum Camera {
Flat,
/// Un angle fixe : `iso`, `left`, `right`. L'écran est incliné devant la caméra.
Fixed([f32; 3]),
- /// `follow-cursor` : l'écran est immobile, une caméra réelle tourne autour de lui avec le
- /// pointeur (`camera.rs`).
- Follow,
+ /// `orbit` : l'écran est immobile, une caméra réelle tourne autour de lui (`camera.rs`), avec
+ /// le pointeur en focus auto, posée par le point de focus en manuel.
+ Orbit,
}
fn camera_for(rotation: &Option<String>) -> Camera {
match rotation.as_deref() {
- Some("follow-cursor") => Camera::Follow,
+ Some("orbit") => Camera::Orbit,
_ => match rotation3d_for(rotation) {
r if is_identity_rotation(r) => Camera::Flat,
r => Camera::Fixed(r),
@@ -509,7 +509,7 @@ fn camera_for(rotation: &Option<String>) -> Camera {
}
}
-/// Ce que la caméra `follow-cursor` lit de la scène : la piste curseur (celle de la parallaxe,
+/// Ce que l'orbite en focus auto lit de la scène : la piste curseur (celle de la parallaxe,
/// donc `None` curseur masqué, comme à l'export), le recadrage du clip actif dans le repère
/// normalisé du curseur (`[x0, y0, x1, y1]`) et sa fenêtre source `[début, fin)`.
#[derive(Clone, Copy)]
@@ -532,7 +532,7 @@ impl CameraFrame<'static> {
fn fixed_rotation(region: &SceneZoomRegion) -> [f32; 3] {
match camera_for(&region.rotation) {
Camera::Fixed(r) => r,
- Camera::Flat | Camera::Follow => [0.0; 3],
+ Camera::Flat | Camera::Orbit => [0.0; 3],
}
}
@@ -546,18 +546,22 @@ fn fixed_flag(region: &SceneZoomRegion) -> f32 {
}
/// 1 si la région porte la caméra réelle, 0 sinon.
-fn follow_flag(region: &SceneZoomRegion) -> f32 {
- if camera_for(&region.rotation) == Camera::Follow {
+fn orbit_flag(region: &SceneZoomRegion) -> f32 {
+ if camera_for(&region.rotation) == Camera::Orbit {
1.0
} else {
0.0
}
}
-/// Ce que la caméra d'une région lit à `t` (le centre hors `follow-cursor`), non pondéré.
-fn follow_at(region: &SceneZoomRegion, t: f32, frame: &CameraFrame) -> Follow {
+/// Ce que l'orbite d'une région lit à `t`, non pondéré : le pointeur lissé en focus auto, le point
+/// de focus de la région en manuel. Le centre hors orbite.
+fn orbit_at(region: &SceneZoomRegion, t: f32, frame: &CameraFrame) -> Follow {
match camera_for(&region.rotation) {
- Camera::Follow => crate::camera::follow(frame, t, region.scale),
+ Camera::Orbit if region.focus_mode.as_deref() == Some("auto") => {
+ crate::camera::follow(frame, t, region.scale)
+ }
+ Camera::Orbit => crate::camera::fixed([region.focus_x, region.focus_y], region.scale),
Camera::Flat | Camera::Fixed(_) => Follow::CENTRE,
}
}
@@ -705,10 +709,10 @@ fn resolve_focus(
cursor: Option<&CursorTrack>,
clock: &ScreenClock,
) -> [f32; 2] {
- // Sous la caméra réelle, le cadrage vient de son pivot : la boîte zoome sur son centre, sans
- // glissement 2D. Chaînée à une région plate, la transition glisse donc vers le focus de
- // celle-ci sans saut.
- if camera_for(&region.rotation) == Camera::Follow {
+ // Sous la caméra réelle, le cadrage vient de sa visée (`orbit_at`), en auto comme en manuel :
+ // la boîte zoome sur son centre, sans glissement 2D. Chaînée à une région plate, la
+ // transition glisse donc vers le focus de celle-ci sans saut.
+ if camera_for(&region.rotation) == Camera::Orbit {
return [0.5, 0.5];
}
if region.focus_mode.as_deref() == Some("auto") {
@@ -774,7 +778,7 @@ fn connected_pairs(
pairs
}
-/// `zoom_state_in` sans speed region ni caméra `follow-cursor` : ce que les tests comparent.
+/// `zoom_state_in` sans speed region ni piste pour l'orbite : ce que les tests comparent.
#[cfg(test)]
pub fn zoom_state_at(
regions: &[SceneZoomRegion],
@@ -795,7 +799,7 @@ pub fn zoom_state_at(
/// hold), sinon la région "dominante" indépendante la plus forte (ties → la plus récente).
/// Hors de toute région → identité (échelle 1, focus centre, tilt nul).
///
-/// `frame` est ce que lit la caméra `follow-cursor` (sans piste, elle vise le centre) ; `clock`
+/// `frame` est ce que lit l'orbite en focus auto (sans piste, elle vise le centre) ; `clock`
/// mesure les transitions à l'écran, cf. `ScreenClock`.
pub fn zoom_state_in(
regions: &[SceneZoomRegion],
@@ -836,7 +840,7 @@ pub fn zoom_state_in(
// s'éteignant sur la première moitié, l'autre s'allumant sur la seconde.
let split = matches!(
(cur_cam, next_cam),
- (Camera::Follow, Camera::Fixed(_)) | (Camera::Fixed(_), Camera::Follow)
+ (Camera::Orbit, Camera::Fixed(_)) | (Camera::Fixed(_), Camera::Orbit)
);
let (rotation, camera) = if split {
let (out, into) = (
@@ -849,14 +853,14 @@ pub fn zoom_state_in(
} else {
r
};
- (r, follow_flag(cur) * out + follow_flag(next) * into)
+ (r, orbit_flag(cur) * out + orbit_flag(next) * into)
} else {
(
lerp_rotation3d(fixed_rotation(cur), fixed_rotation(next), progress),
- lerp(follow_flag(cur), follow_flag(next), progress),
+ lerp(orbit_flag(cur), orbit_flag(next), progress),
)
};
- let (a, b) = (follow_at(cur, t, frame), follow_at(next, t, frame));
+ let (a, b) = (orbit_at(cur, t, frame), orbit_at(next, t, frame));
let mix =
|p: [f32; 2], q: [f32; 2]| [lerp(p[0], q[0], progress), lerp(p[1], q[1], progress)];
return ZoomState {
@@ -878,8 +882,8 @@ pub fn zoom_state_in(
for &(_, ni, _, t_end) in &pairs {
let next = &regions[ni];
if screen_t > t_end && t < next.start_sec as f32 {
- let camera = follow_flag(next);
- let seen = follow_at(next, t, frame);
+ let camera = orbit_flag(next);
+ let seen = orbit_at(next, t, frame);
return ZoomState {
scale: next.scale,
focus: resolve_focus(next, t, cursor, clock),
@@ -931,8 +935,8 @@ pub fn zoom_state_in(
// comme si une région manuelle suivait le curseur. On inverse donc le mapping pour
// trouver le centre qui produit la trajectoire de référence.
let ease = |f: f32| f - (f - 0.5) * (1.0 - strength) / scale.max(1e-3);
- let camera = follow_flag(r) * strength;
- let seen = follow_at(r, t, frame);
+ let camera = orbit_flag(r) * strength;
+ let seen = orbit_at(r, t, frame);
ZoomState {
scale,
focus: [ease(focus[0]), ease(focus[1])],
@@ -2482,9 +2486,9 @@ mod tilt_tests {
under_trim: false,
hide_cursor: false,
};
- // `follow-cursor` n'incline pas l'écran (caméra réelle, `camera.rs`) : chaînée à un angle
+ // `orbit` n'incline pas l'écran (caméra réelle, `camera.rs`) : chaînée à un angle
// fixe, la transition passe par l'écran droit, que ce balayage couvre aussi.
- let presets = [None, Some("left"), Some("right"), Some("follow-cursor")];
+ let presets = [None, Some("left"), Some("right"), Some("orbit")];
for a in presets {
for b in presets {
// Transition chaînée sur [4, 5] s.
@@ -2529,7 +2533,7 @@ mod tilt_tests {
// entre deux caméras réelles, la caméra aussi.
if a.is_some() && a == b {
let mid = zoom_state_at(&regions, 4.5, None);
- let open = if a == Some("follow-cursor") {
+ let open = if a == Some("orbit") {
mid.camera
} else {
mid.tilt
@@ -3191,11 +3195,13 @@ mod programme_clock {
}
#[cfg(test)]
-mod follow_camera_tests {
+mod orbit_camera_tests {
use super::*;
use crate::cursor::CursorTrack;
use crate::scene::SceneZoomRegion;
+ /// Une région en focus auto : c'est là que l'orbite suit le pointeur. Son point de focus,
+ /// (0,2 ; 0,7), ne sert qu'en manuel.
fn region(rotation: &str, start: f64, end: f64) -> SceneZoomRegion {
SceneZoomRegion {
id: "z".into(),
@@ -3205,7 +3211,7 @@ mod follow_camera_tests {
scale: 2.0,
focus_x: 0.2,
focus_y: 0.7,
- focus_mode: Some("manual".into()),
+ focus_mode: Some("auto".into()),
rotation: Some(rotation.into()),
under_trim: false,
hide_cursor: false,
@@ -3235,14 +3241,14 @@ mod follow_camera_tests {
}
}
- /// Sous `follow-cursor`, l'écran n'est pas incliné et ne glisse pas (focus au centre, quel que
- /// soit le réglage de la région) : seule la caméra, de poids la force de la région, vise et
- /// tourne avec le pointeur. Hors région, l'état plat exact.
+ /// Sous l'orbite en focus auto, l'écran n'est pas incliné et ne glisse pas (focus au centre) :
+ /// seule la caméra, de poids la force de la région, vise et tourne avec le pointeur. Hors
+ /// région, l'état plat exact.
#[test]
- fn follow_cursor_rides_the_zoom_envelope() {
+ fn the_auto_orbit_rides_the_zoom_envelope() {
let tr = track(|_| (0.85, 0.5));
let f = whole(&tr);
- let r = [region("follow-cursor", 2.0, 8.0)];
+ let r = [region("orbit", 2.0, 8.0)];
let full = zoom_state_in(&r, 5.0, Some(&tr), &f, &ScreenClock::default());
assert_eq!(
(full.rotation, full.tilt, full.camera),
@@ -3265,7 +3271,7 @@ mod follow_camera_tests {
"{}",
easing.camera
);
- let raw = follow_at(&r[0], 1.5, &f);
+ let raw = orbit_at(&r[0], 1.5, &f);
assert_eq!(
(easing.aim, easing.orbit),
(
@@ -3285,33 +3291,34 @@ mod follow_camera_tests {
// Un angle fixe garde exactement son état.
let left = zoom_state_in(&[region("left", 2.0, 8.0)], 5.0, Some(&tr), &f, &ScreenClock::default());
assert_eq!((left.rotation, left.camera), ([-12.0, -18.0, -2.0], 0.0));
- let unknown = zoom_state_in(&[region("orbit", 2.0, 8.0)], 5.0, Some(&tr), &f, &ScreenClock::default());
+ let unknown =
+ zoom_state_in(&[region("swing-clicks", 2.0, 8.0)], 5.0, Some(&tr), &f, &ScreenClock::default());
assert_eq!((unknown.rotation, unknown.tilt, unknown.camera), ([0.0; 3], 0.0, 0.0));
}
- /// Focus auto ou manuel, même visée : elle se lit dans l'image source, pas dans la coupe.
+ /// En focus manuel, l'orbite ne suit pas le pointeur : son point de focus la pose comme un
+ /// pointeur garé là (l'œil sur l'orbite du point, la visée bornée à la portée du zoom), et
+ /// l'écran ne glisse pas. Sans piste, pareil : le manuel n'en a pas besoin.
#[test]
- fn follow_cursor_aims_the_same_under_auto_focus() {
- let tr = track(|_| (0.85, 0.3));
- let mut auto = region("follow-cursor", 2.0, 8.0);
- auto.focus_mode = Some("auto".into());
- let manual = region("follow-cursor", 2.0, 8.0);
- let a = zoom_state_in(
- &[auto],
- 5.0,
- Some(&tr),
- &whole(&tr),
- &ScreenClock::default(),
- );
- let m = zoom_state_in(
- &[manual],
- 5.0,
- Some(&tr),
- &whole(&tr),
- &ScreenClock::default(),
- );
- assert_eq!((a.aim, a.focus), (m.aim, m.focus));
- assert!(a.aim[0] > 0.7 && a.aim[1] < 0.35, "{:?}", a.aim);
+ fn the_manual_orbit_sits_on_its_focus_point() {
+ let tr = track(|t| (0.5 + 0.4 * (t * 1.3).sin(), 0.3));
+ let parked = track(|_| (0.2, 0.7));
+ let mut manual = region("orbit", 2.0, 8.0);
+ manual.focus_mode = Some("manual".into());
+ let near = |a: [f32; 2], b: [f32; 2]| (a[0] - b[0]).abs() < 1e-5 && (a[1] - b[1]).abs() < 1e-5;
+ for t in [3.0f32, 5.0, 7.0] {
+ let m = zoom_state_in(std::slice::from_ref(&manual), t, Some(&tr), &whole(&tr), &ScreenClock::default());
+ assert_eq!((m.camera, m.focus), (1.0, [0.5, 0.5]), "t {t}");
+ // Zoom 2 : la visée reste dans [0,275 ; 0,725].
+ assert!(near(m.orbit, [0.2, 0.7]) && near(m.aim, [0.275, 0.7]), "t {t} : {:?} {:?}", m.orbit, m.aim);
+ let p = zoom_state_in(&[region("orbit", 2.0, 8.0)], t, Some(&parked), &whole(&parked), &ScreenClock::default());
+ assert!(near(m.orbit, p.orbit) && near(m.aim, p.aim), "t {t} : {:?} {:?}", p.orbit, p.aim);
+ let blind = zoom_state_at(std::slice::from_ref(&manual), t, None);
+ assert_eq!((blind.aim, blind.orbit), (m.aim, m.orbit), "t {t} : sans piste");
+ }
+ // Garde : la même région en auto suit le pointeur.
+ let auto = |t: f32| zoom_state_in(&[region("orbit", 2.0, 8.0)], t, Some(&tr), &whole(&tr), &ScreenClock::default());
+ assert!(!near(auto(3.0).orbit, auto(5.0).orbit));
}
/// Chaînée à un angle fixe, la transition passe par l'écran droit sans jamais mélanger les
@@ -3321,11 +3328,11 @@ mod follow_camera_tests {
let tr = track(|t| (0.2 + 0.05 * t, 0.5));
let f = whole(&tr);
for regions in [
- [region("left", 1.0, 4.0), region("follow-cursor", 4.5, 8.0)],
- [region("follow-cursor", 1.0, 4.0), region("right", 4.5, 8.0)],
+ [region("left", 1.0, 4.0), region("orbit", 4.5, 8.0)],
+ [region("orbit", 1.0, 4.0), region("right", 4.5, 8.0)],
[
- region("follow-cursor", 1.0, 4.0),
- region("follow-cursor", 4.5, 8.0),
+ region("orbit", 1.0, 4.0),
+ region("orbit", 4.5, 8.0),
],
] {
let both = regions[0].rotation == regions[1].rotation;
@@ -3362,7 +3369,7 @@ mod follow_camera_tests {
fn the_follow_state_is_a_pure_function_of_time() {
let tr = track(|t| (0.5 + 0.4 * (t * 1.3).sin(), 0.5 + 0.3 * (t * 0.7).cos()));
let f = whole(&tr);
- let r = [region("follow-cursor", 2.0, 8.0)];
+ let r = [region("orbit", 2.0, 8.0)];
let at = |i: usize| {
let s = zoom_state_in(
&r,
diff --git a/crates/compositor/src/scene.rs b/crates/compositor/src/scene.rs
index c041d21ca..1b7ee7cc7 100644
--- a/crates/compositor/src/scene.rs
+++ b/crates/compositor/src/scene.rs
@@ -471,9 +471,9 @@ pub struct SceneZoomRegion {
#[serde(default)]
pub focus_mode: Option<String>,
/// La caméra 3D du zoom : un angle fixe ("iso" | "left" | "right"), la caméra réelle qui
- /// tourne autour de l'écran avec le pointeur ("follow-cursor", cf. `camera.rs`), ou null
- /// (écran droit). Une valeur
- /// inconnue rend l'écran droit.
+ /// tourne autour de l'écran ("orbit", cf. `camera.rs` : avec le pointeur en focus auto,
+ /// posée par le point de focus en manuel), ou null (écran droit). Une valeur inconnue rend
+ /// l'écran droit.
pub rotation: Option<String>,
/// La région entière tombe sur une portion qu'un trim retire. Ses temps sont donc HORS de
/// la fenêtre source de `clip_index`, qui n'est là que pour l'adresser (le segment que la
diff --git a/crates/compositor/src/shaders.hlsl b/crates/compositor/src/shaders.hlsl
index eae92d60e..bdfbaa074 100644
--- a/crates/compositor/src/shaders.hlsl
+++ b/crates/compositor/src/shaders.hlsl
@@ -2243,7 +2243,7 @@ float4 ps_main(VSOut i) : SV_Target
}
// mode 8 : écran tilté en 3D (zoom regions "rotation" : iso/left/right) ou vu par la caméra
- // réelle (`follow-cursor`). `dst`/`quad_px` couvrent la BOUNDING BOX des 4 coins projetés
+ // réelle (`orbit`). `dst`/`quad_px` couvrent la BOUNDING BOX des 4 coins projetés
// (`frame_geometry::tilted_screen_cb`) ; ce shader retrouve où tombe chaque pixel DANS le quad
// (warp inverse : bilinéaire sous un angle fixe, projectif exact sous la caméra réelle ou un
// appareil, dst_prev.w = 1) et échantillonne la vidéo à l'UV correspondant, sinon transparent.
diff --git a/crates/compositor/src/timeline_walk.rs b/crates/compositor/src/timeline_walk.rs
index f139e6a2c..a16271c8b 100644
--- a/crates/compositor/src/timeline_walk.rs
+++ b/crates/compositor/src/timeline_walk.rs
@@ -161,7 +161,7 @@ pub(crate) unsafe fn walk_composited_timeline(
// La piste se charge même curseur MASQUÉ : le focus auto des zooms la suit, comme en preview
// (qui la charge toujours). Sans elle, un zoom auto suivait en preview et restait figé à
// l'export. Ce qui ne doit rien voir d'un curseur masqué a sa propre porte sur `cursor.show` :
- // le dessin (`cursor_alpha`), la parallaxe, l'impact du clic et la caméra `follow-cursor`.
+ // le dessin (`cursor_alpha`), la parallaxe, l'impact du clic et l'orbite en focus auto.
let cursor_enabled = scene.is_some();
let cursor_smoothing = scene.as_ref().map(|s| s.cursor.smoothing).unwrap_or(0.0);
let mut cursor_tracks: HashMap<String, CursorTrack> = HashMap::new();
diff --git a/crates/compositor/tests/cursor_tap_render.rs b/crates/compositor/tests/cursor_tap_render.rs
index 8b908f922..8500b163c 100644
--- a/crates/compositor/tests/cursor_tap_render.rs
+++ b/crates/compositor/tests/cursor_tap_render.rs
@@ -164,7 +164,7 @@ fn scene_json(rotation: &str, hide: bool, click_bounce: f32) -> String {
"screenRect":{{"x":0.1,"y":0.1,"width":0.8,"height":0.8}}}},
"effects":{{"padding":0.2,"blur":false,"shadow":0.5,"roundnessFrac":0.03,"motionBlur":0}},
"background":{{"kind":"gradient","angleDeg":135,"stops":["#5b6ee1","#e8a0bf"]}},
- "zoomRegions":[{{"clipIndex":0,"startSec":0,"endSec":10,"scale":1,"focusX":0.5,"focusY":0.5,"focusMode":"manual","rotation":{rotation},"hideCursor":{hide}}}],
+ "zoomRegions":[{{"clipIndex":0,"startSec":0,"endSec":10,"scale":1,"focusX":0.5,"focusY":0.5,"rotation":{rotation},"hideCursor":{hide}}}],
"annotations":[],
"cursor":{{"show":true,"size":4,"smoothing":0.5,"motionBlur":0.5,"clickBounce":{click_bounce},"model3d":true,"clipToBounds":false,"theme":"default",
"cursorSprites":{{"arrow":{{"path":"{dir}/arrow.png","hotspotX":0.1205,"hotspotY":0.0881}},
@@ -310,7 +310,7 @@ fn the_tip_lands_on_the_marked_click_target() {
let comp = Compositor::new_sized(&gpu, OUT.0, OUT.1).expect("compositor");
let screen = MockFrame::new(&gpu);
let track = gesture("contact");
- for (name, rotation) in [("flat", "null"), ("iso", r#""iso""#), ("follow", r#""follow-cursor""#)] {
+ for (name, rotation) in [("flat", "null"), ("iso", r#""iso""#), ("orbit", r#""orbit","focusMode":"auto""#)] {
for (target, tc) in TARGETS {
let t = tc + CONTACT_S;
// La pastille, lue sans curseur au même instant (la caméra suit la même piste).
diff --git a/crates/compositor/tests/device_frame_render.rs b/crates/compositor/tests/device_frame_render.rs
index b18bfbbd3..a4edd4327 100644
--- a/crates/compositor/tests/device_frame_render.rs
+++ b/crates/compositor/tests/device_frame_render.rs
@@ -153,7 +153,7 @@ fn scene_json_themed(
"screenRect":{{"x":0.08,"y":0.08,"width":0.84,"height":0.84}}}},
"effects":{{"padding":0.25,"blur":false,"shadow":{shadow},"roundnessFrac":0.02,"motionBlur":0{frame}}},
"background":{{"kind":"gradient","angleDeg":135,"stops":["#5b6ee1","#e8a0bf"]}},
- "zoomRegions":[{{"clipIndex":0,"startSec":0,"endSec":10,"scale":1,"focusX":0.5,"focusY":0.5,"focusMode":"manual","rotation":{rotation}}}],
+ "zoomRegions":[{{"clipIndex":0,"startSec":0,"endSec":10,"scale":1,"focusX":0.5,"focusY":0.5,"rotation":{rotation}}}],
"annotations":[],
"cursor":{cursor},
"cropByClip":[null],
@@ -163,6 +163,9 @@ fn scene_json_themed(
const NO_CURSOR: &str = r#"{"show":false,"size":1,"smoothing":0,"motionBlur":0,"clickBounce":0,"clipToBounds":false,"theme":"default"}"#;
+/// La caméra en orbite, en focus auto : celle qui bouge avec le pointeur.
+const ORBIT: &str = r#""orbit","focusMode":"auto""#;
+
fn cfg() -> Cfg {
let mut cfg = Cfg::c8();
cfg.bg_blur = false;
@@ -461,7 +464,7 @@ fn each_device_draws_around_untouched_footage() {
let blue = FakeFrame::new(&gpu, src, Tint::Blue);
let orange = FakeFrame::new(&gpu, src, Tint::Orange);
for &device in &DEVICES {
- for rotation in ["null", r#""iso""#, r#""follow-cursor""#] {
+ for rotation in ["null", r#""iso""#, ORBIT] {
let json = scene_json(device, rotation, 0.0, NO_CURSOR, out);
let a = render(&comp, &blue, &json, None, T);
let b = render(&comp, &orange, &json, None, T);
@@ -573,7 +576,7 @@ fn the_device_follows_the_tilt_and_the_orbit_camera() {
flat == render(&comp, &screen, &scene_json(device, "null", 0.0, NO_CURSOR, (W, H)), None, T),
"{device} : le rendu à plat n'est pas stable"
);
- for rotation in [r#""iso""#, r#""left""#, r#""follow-cursor""#] {
+ for rotation in [r#""iso""#, r#""left""#, ORBIT] {
let tilted = render(&comp, &screen, &scene_json(device, rotation, 0.0, NO_CURSOR, (W, H)), None, T);
let moved = differing(&flat, &tilted, 8);
println!("{device:<8} {rotation:<16} {moved:>7} px bougent");
@@ -603,7 +606,7 @@ fn the_device_trails_with_the_screen_under_motion_blur() {
json
};
for device in ["laptop", "window"] {
- for rotation in ["null", r#""iso""#, r#""follow-cursor""#] {
+ for rotation in ["null", r#""iso""#, ORBIT] {
let case = format!("{device} {rotation}");
let still = |blur| render(&comp, &blue, &json(device, rotation, blur), None, 4.0);
assert!(still(0.0) == still(1.0), "{case} : immobile, le flou ne doit rien changer");
@@ -689,7 +692,7 @@ fn no_seam_lets_the_wallpaper_through() {
let screen = FakeFrame::new(&gpu, SRC, Tint::Blue);
for frame in ["window", "laptop", "phone", "monitor"] {
for roundness in [0.0f32, MAX_ROUND] {
- for rotation in ["null", r#""iso""#, r#""follow-cursor""#] {
+ for rotation in ["null", r#""iso""#, ORBIT] {
let json = on_green(&with_roundness(&scene_json(frame, rotation, 0.6, NO_CURSOR, out), roundness));
let rgba = render(&comp, &screen, &json, None, T);
let g = Geo::new(&json, out, SRC);
@@ -730,7 +733,7 @@ fn the_bezel_fills_the_corners_at_maximum_roundness() {
let blue = FakeFrame::new(&gpu, SRC, Tint::Blue);
let orange = FakeFrame::new(&gpu, SRC, Tint::Orange);
for frame in ["window", "laptop", "phone", "monitor"] {
- for rotation in ["null", r#""iso""#, r#""follow-cursor""#] {
+ for rotation in ["null", r#""iso""#, ORBIT] {
let json = on_green(&with_roundness(&scene_json(frame, rotation, 0.0, NO_CURSOR, out), MAX_ROUND));
let (a, b) = (render(&comp, &blue, &json, None, T), render(&comp, &orange, &json, None, T));
let g = Geo::new(&json, out, SRC);
@@ -845,7 +848,7 @@ fn the_device_shadow_follows_the_silhouette() {
let spread = 40.0 / 1080.0 * W.min(H) as f32;
for frame in ["laptop", "monitor", "phone"] {
for theme in ["light", "dark"] {
- for rotation in ["null", r#""iso""#, r#""follow-cursor""#] {
+ for rotation in ["null", r#""iso""#, ORBIT] {
let json = |shadow: f32, f: &str| {
with_rect(&scene_json_themed(f, theme, rotation, shadow, NO_CURSOR, (W, H)), rect)
};
@@ -1061,7 +1064,7 @@ fn v3_renders() {
for frame in all {
for theme in ["light", "dark"] {
let mut row = Vec::new();
- for (cam, rotation) in [("flat", "null"), ("iso", r#""iso""#), ("orbit", r#""follow-cursor""#)] {
+ for (cam, rotation) in [("flat", "null"), ("iso", r#""iso""#), ("orbit", ORBIT)] {
let json = with_rect(&scene_json_themed(frame, theme, rotation, 1.0, NO_CURSOR, (W, H)), CLIPS[0].1);
let i = img(render(&comp, &screen, &json, None, T));
save_in(&dir, "shadows", &format!("{frame}-{cam}-{theme}"), &i);
@@ -1117,7 +1120,7 @@ fn orbit_clip_frames() {
.to_string_lossy()
.replace('\\', "/")
);
- let json = scene_json("laptop", r#""follow-cursor""#, 0.6, &cursor, (W, H));
+ let json = scene_json("laptop", ORBIT, 0.6, &cursor, (W, H));
for k in 0..180 {
let t = k as f32 / 30.0;
let rgba = render(&comp, &screen, &json, Some(&track), t);
@@ -1431,9 +1434,9 @@ fn parked_track(name: &str, x: f32, y: f32) -> CursorTrack {
const SHOWN_CURSOR: &str = r#"{"show":true,"size":0.2,"smoothing":0,"motionBlur":0,"clickBounce":0,"clipToBounds":false,"theme":"default","cursorSprites":{}}"#;
/// La caméra en orbite qui zoome de `zoom` : la région de zoom de `scene_json`, sous
-/// `follow-cursor`, à l'échelle voulue.
+/// l'orbite en focus auto, à l'échelle voulue.
fn orbit_json(frame: &str, zoom: f32, out: (u32, u32)) -> String {
- scene_json(frame, r#""follow-cursor""#, 0.6, SHOWN_CURSOR, out).replace(r#""scale":1,"#, &format!(r#""scale":{zoom},"#))
+ scene_json(frame, ORBIT, 0.6, SHOWN_CURSOR, out).replace(r#""scale":1,"#, &format!(r#""scale":{zoom},"#))
}
/// Le socle du portable ne couvre JAMAIS le métrage que le zoom montre : au plus fort zoom et aux
@@ -1623,7 +1626,7 @@ fn v4_near_clip() {
let comp = Compositor::new_sized(&gpu, W, H).expect("compositor");
let screen = FakeFrame::new(&gpu, SRC, Tint::Blue);
let track = parked_track("near", 0.5, 0.97);
- let json = with_rect(&scene_json("laptop", r#""follow-cursor""#, 0.6, SHOWN_CURSOR, (W, H)), CLIPS[0].1)
+ let json = with_rect(&scene_json("laptop", ORBIT, 0.6, SHOWN_CURSOR, (W, H)), CLIPS[0].1)
.replace(
r#""zoomRegions":[{"clipIndex":0,"startSec":0,"endSec":10,"scale":1,"#,
r#""zoomRegions":[{"clipIndex":0,"startSec":1.2,"endSec":4.4,"scale":3.5,"#,
@@ -1679,7 +1682,7 @@ fn bench_the_device_frame_at_1080p() {
}
t0.elapsed().as_secs_f64() * 10.0
};
- for rotation in ["null", r#""iso""#, r#""follow-cursor""#] {
+ for rotation in ["null", r#""iso""#, ORBIT] {
for &device in &DEVICES {
let (off, on) = (
scene_json("none", rotation, 0.6, NO_CURSOR, (1920, 1080)),
diff --git a/crates/compositor/tests/follow_camera_render.rs b/crates/compositor/tests/follow_camera_render.rs
index d1f28e4da..99f9f1ffe 100644
--- a/crates/compositor/tests/follow_camera_render.rs
+++ b/crates/compositor/tests/follow_camera_render.rs
@@ -1,4 +1,4 @@
-//! La caméra réelle de `follow-cursor` (l'orbite) rendue par le vrai compositeur D3D11.
+//! La caméra réelle de `orbit` (en focus auto) rendue par le vrai compositeur D3D11.
//!
//! Deux tests sans variable d'environnement, sur une frame NV12 SYNTHÉTIQUE (une grille, donc une
//! géométrie connue au texel près ; sans adaptateur matériel, ils se sautent : « test saute ») :
@@ -134,7 +134,7 @@ fn grid_scene_dof(scale: f32, dof: bool) -> Scene {
"screenRect":{{"x":0.1,"y":0.1,"width":0.8,"height":0.8}}}},
"effects":{{"padding":0.2,"blur":false,"shadow":0,"roundnessFrac":0.0,"motionBlur":0,"depthOfField":{dof}}},
"background":{{"kind":"color","color":"#000000"}},
- "zoomRegions":[{{"clipIndex":0,"startSec":0,"endSec":10,"scale":{scale},"focusX":0.5,"focusY":0.5,"focusMode":"manual","rotation":"follow-cursor"}}],
+ "zoomRegions":[{{"clipIndex":0,"startSec":0,"endSec":10,"scale":{scale},"focusX":0.5,"focusY":0.5,"focusMode":"auto","rotation":"orbit"}}],
"annotations":[],
"cursor":{{"show":true,"size":0.05,"smoothing":0,"motionBlur":0,"clickBounce":0,"clipToBounds":false,"theme":"none"}},
"cropByClip":[null],
@@ -390,7 +390,7 @@ fn orbit_scene(source: &str, regions: &str, (w, h): (u32, u32)) -> Scene {
fn orbit_region(start: f32, end: f32, scale: f32) -> String {
format!(
- r#"{{"clipIndex":0,"startSec":{start},"endSec":{end},"scale":{scale},"focusX":0.5,"focusY":0.5,"focusMode":"manual","rotation":"follow-cursor"}}"#
+ r#"{{"clipIndex":0,"startSec":{start},"endSec":{end},"scale":{scale},"focusX":0.5,"focusY":0.5,"focusMode":"auto","rotation":"orbit"}}"#
)
}
diff --git a/docs/3d-effects-v2.md b/docs/3d-effects-v2.md
index 7694bf9b8..dd99c7167 100644
--- a/docs/3d-effects-v2.md
+++ b/docs/3d-effects-v2.md
@@ -44,19 +44,22 @@ deuxième fusionnait tout en un sélecteur avec trois caméras mobiles (`follow-
`swing-clicks`, `orbit`) qui faisaient tourner **l'écran** sur un chemin de poses à roulis
permanent (5,5 à 8,5°). Rejetées : « pour chacune, le métrage est de travers ». La troisième,
une caméra pan-tilt-zoom sur un œil fixe, paraissait figée. Il reste **un** champ,
-`rotationPreset`, et **un** sélecteur « 3D camera » : les deux angles fixes et **une** caméra
-mobile, qui tourne autour de l'écran.
+`rotationPreset`, et **un** sélecteur « 3D camera » : **une** caméra mobile, qui tourne autour
+de l'écran, puis les deux angles fixes. La quatrième révision (26/09) donne à la caméra mobile le
+mode de focus de tout zoom : le pointeur en Auto, le point de focus en Manuel (A.3).
| groupe | valeur | libellé (EN) | ce que ça fait |
|---|---|---|---|
| — | absent | Off | écran droit |
+| Caméra mobile | `orbit` | 3D Orbit | l'écran est immobile, une vraie caméra tourne autour de lui : avec le curseur en focus auto, posée par le point de focus en manuel |
| Angle fixe | `left` | Screen turned left | tourné vers la gauche, vu d'en haut |
| Angle fixe | `right` | Screen turned right | tourné vers la droite, vu d'en haut |
-| Caméra mobile | `follow-cursor` | Orbits with the cursor | l'écran est immobile, une vraie caméra tourne autour de lui avec le curseur |
-`swing-clicks` et `orbit` sont retirés (jamais livrés). La caméra mobile qui reste est l'orbite
-ci-dessous, sous l'identifiant `follow-cursor`. Un projet qui les porte encore s'ouvre à plat
-(valeur inconnue).
+`swing-clicks` est retiré (jamais livré) : un projet qui le porte s'ouvre à plat (valeur
+inconnue). L'identifiant `orbit` d'une caméra retirée, jamais livrée non plus, nomme désormais
+l'orbite ci-dessous. Elle s'appelait `follow-cursor` (v1.13.0) quand elle suivait le curseur quel
+que soit le mode de focus : un zoom stocké ainsi se lit comme `orbit` en focus auto
+(`readFollowCursorAsAutoOrbit`), et rend comme avant.
`left` est l'`iso` de la v1.13.0, à l'identique : [−12, −18, −2], tourné vers la gauche et vu
d'en haut, dessiné comme alors au warp **bilinéaire** de ses coins. `right` en est le miroir,
@@ -71,11 +74,17 @@ plus rien de l'ancien `iso`.
« Screen turned right » veut dire que la face de l'écran regarde vers la droite : le bord droit
recule. C'est ce que fait `right` [−12, 18, 2], vu d'en haut.
-### A.3 `follow-cursor` : une caméra en orbite
+### A.3 `orbit` : une caméra en orbite
`crates/compositor/src/camera.rs`. **L'écran ne bouge pas** : c'est le plan z = 0 du monde, en
px de sa boîte. **L'œil tourne autour de lui** sur une sphère et regarde toujours son point visé.
+**Le point qui la pose** : le mode de focus du zoom le choisit. En Auto, le pointeur lissé du
+cadreur (`camera::follow`, plus bas). En Manuel, le point de focus de la région, fixe
+(`camera::fixed`), comme un pointeur garé là : l'œil sur l'orbite de ce point, la visée bornée à
+la portée du zoom. Au centre, la caméra est presque de face (0° d'azimut, 4° d'élévation). Le
+manuel n'a pas besoin de piste : curseur masqué, la caméra reste posée.
+
**Pourquoi une orbite.** La version précédente (pan-tilt-zoom : œil fixe, objectif de 12°, la
caméra pivotait sur place) a été jugée « encore plus figée ». Depuis un œil fixe, tourner la caméra
n'est presque qu'un pan à plat : l'angle sous lequel on voit l'écran change à peine. L'orientation
@@ -119,12 +128,13 @@ impulsionnelle d'un ressort critique, `h(τ) = ω²·τ·e^(−ωτ)`, ω = 5 ra
- Sur la vidéo de revue (8 s, zoom 1 puis 1,8) : azimut de −16° à +15°, élévation de −5° à +14°,
au plus 1,8° d'azimut et 68 px de déplacement du centre par image à 30 i/s.
-Sans piste (curseur masqué : l'export ne la charge pas), la caméra vise le centre, au repos.
+En focus auto, curseur masqué, la caméra n'a pas de piste : elle vise le centre, au repos.
**Ce qui suit la caméra** : l'écran (mode 8), son ombre (mode 12), le cadre de fenêtre (mode 14),
le curseur plat (mode 13) et modélisé (mode 15), le flou de confidentialité (mode 10) et la
-profondeur de champ. La mise au point suit le **pointeur lissé**, pas le point visé : celui-ci reste
-au centre au zoom 1 et bute sur sa portée au zoom, alors que le spectateur regarde le pointeur.
+profondeur de champ. La mise au point suit le point qui pose l'œil (le **pointeur lissé** en auto,
+le point de focus en manuel), pas le point visé : celui-ci reste au centre au zoom 1 et bute sur
+sa portée au zoom, alors que le spectateur regarde le pointeur.
L'ombre de l'écran tombe le long de la lumière de la flèche modélisée (haut-gauche). Une lampe posée
sur la caméra éclaire un peu plus le côté proche : gain 0,2, soit ±4 % d'un bord à l'autre à 22°
d'azimut (`CAMERA_LIGHT_GAIN`, 0,5 donnait ±10 % avec l'œil en orbite).
@@ -135,8 +145,8 @@ clip, clic visible, masque, vitesse, opacité du curseur), puis revient avec un
vidéo, l'écran perd 2 à 3 % de taille pendant deux images : un tapotement, pas un saut. C'est le
réglage « Click impact » du curseur, le même sous toutes les caméras (A.1).
-Chaînée à un angle fixe, une région `follow-cursor` ne mélange jamais les deux modèles : la
-transition passe par l'écran droit à mi-course. Entre deux régions `follow-cursor`, le cadreur ne
+Chaînée à un angle fixe, une région `orbit` ne mélange jamais les deux modèles : la
+transition passe par l'écran droit à mi-course. Entre deux orbites en focus auto, le cadreur ne
dépend pas de la région : l'orbite continue sans à-coup pendant que le zoom change.
**Rendu exact.** Le warp bilinéaire s'écarte de la projection de cette caméra de
@@ -194,7 +204,7 @@ lointain.
Le natif porte la preview **et** l'export (`sceneDescription` → `scene.rs`). Le seul autre
consommateur de l'attitude est `getRotation3D` (`types.ts`), lu par
`computeRotation3DContainScale` via `zoomRegionUtils` — la preview CSS (`VirtualPreview.tsx`) ne
-porte **aucun** tilt. Pour `follow-cursor`, `getRotation3D` rend la pose de repos de l'orbite
+porte **aucun** tilt. Pour `orbit`, `getRotation3D` rend la pose de repos de l'orbite
(X = −4° : caméra 4° au-dessus, le bord haut vient vers nous) : le chemin canvas n'a ni la piste ni
la caméra.
diff --git a/src/components/ai-edition/v4/FloatingInspector.test.tsx b/src/components/ai-edition/v4/FloatingInspector.test.tsx
index e67d28aaf..8173f1f51 100644
--- a/src/components/ai-edition/v4/FloatingInspector.test.tsx
+++ b/src/components/ai-edition/v4/FloatingInspector.test.tsx
@@ -193,22 +193,22 @@ describe("FloatingInspector", () => {
expect(screen.queryByRole("group", { name: /cameraMotion|threeD/ })).toBeNull();
});
- it("lists off, then the fixed angles, then the moving camera", () => {
+ it("lists off, then the orbit, then the fixed angles", () => {
const { tl } = zoomTl({});
render(<FloatingInspector {...defaultProps} tl={tl} />);
expect(cameraButtons().map((b) => b.getAttribute("aria-label"))).toEqual([
"settings.zoom.camera.off",
+ "settings.zoom.camera.preset.orbit",
"settings.zoom.camera.preset.left",
"settings.zoom.camera.preset.right",
- "settings.zoom.camera.preset.followCursor",
]);
});
it("writes the camera into rotationPreset, and off by absence", () => {
- const { tl, updateZoomRotation } = zoomTl({ rotationPreset: "follow-cursor" });
+ const { tl, updateZoomRotation } = zoomTl({ rotationPreset: "orbit" });
render(<FloatingInspector {...defaultProps} tl={tl} />);
expect(
- screen.getByRole("button", { name: "settings.zoom.camera.preset.followCursor" }),
+ screen.getByRole("button", { name: "settings.zoom.camera.preset.orbit" }),
).toHaveAttribute("aria-pressed", "true");
fireEvent.click(screen.getByRole("button", { name: "settings.zoom.camera.preset.left" }));
expect(updateZoomRotation).toHaveBeenCalledWith("z", "left");
@@ -255,17 +255,12 @@ describe("FloatingInspector", () => {
editorSettings.cursorShow = false;
try {
const moving = () =>
- screen.queryByRole("button", { name: "settings.zoom.camera.preset.followCursor" });
+ screen.queryByRole("button", { name: "settings.zoom.camera.preset.orbit" });
const { tl } = zoomTl({});
const { unmount } = render(<FloatingInspector {...defaultProps} tl={tl} />);
expect(moving()).toBeNull();
unmount();
- render(
- <FloatingInspector
- {...defaultProps}
- tl={zoomTl({ rotationPreset: "follow-cursor" }).tl}
- />,
- );
+ render(<FloatingInspector {...defaultProps} tl={zoomTl({ rotationPreset: "orbit" }).tl} />);
expect(moving()).not.toBeNull();
} finally {
editorSettings.cursorShow = true;
diff --git a/src/components/ai-edition/v4/FloatingInspector.tsx b/src/components/ai-edition/v4/FloatingInspector.tsx
index be312afbc..282384bda 100644
--- a/src/components/ai-edition/v4/FloatingInspector.tsx
+++ b/src/components/ai-edition/v4/FloatingInspector.tsx
@@ -346,13 +346,6 @@ function paneStack(label: string, control: React.ReactNode, value?: string) {
);
}
-/** Clé i18n (`zoom.camera.preset.*`) de chaque caméra 3D. */
-const CAMERA_KEYS: Record<Rotation3DPreset, string> = {
- left: "left",
- right: "right",
- "follow-cursor": "followCursor",
-};
-
/** What each camera does to the screen (viewBox 0 0 32 22, as the camera layout tiles). A fixed
* angle is the outline of its pose: `ROTATION_3D_PRESETS` projected with the shipped
* perspective and centred. The moving camera leaves the screen flat and circles it. */
@@ -360,7 +353,7 @@ const CAMERA_ICONS: Record<Rotation3DPreset | "off", React.ReactNode> = {
off: <rect x="6.5" y="5.5" width="19" height="11" rx="1.5" />,
left: <polygon points="6.1,6.2 25.9,4.7 24.7,17.3 7.2,15.1" />,
right: <polygon points="6.1,4.7 25.9,6.2 24.8,15.1 7.3,17.3" />,
- "follow-cursor": (
+ orbit: (
<>
<rect x="10.5" y="7.5" width="11" height="7" rx="1" />
<ellipse cx="16" cy="11" rx="14" ry="7.5" strokeDasharray="2 2.5" />
@@ -805,7 +798,7 @@ function SelectionPane({ tl, onClose }: { tl: TimelineApi; onClose: () => void }
const region = tl.zoomRegions.find((z) => z.id === selection.id);
if (!region) return null;
const cameraLabel = (preset: Rotation3DPreset | "off") =>
- ts(preset === "off" ? "zoom.camera.off" : `zoom.camera.preset.${CAMERA_KEYS[preset]}`);
+ ts(preset === "off" ? "zoom.camera.off" : `zoom.camera.preset.${preset}`);
return (
<div style={{ display: "flex", flexDirection: "column", minHeight: 0 }}>
{paneHeader(<ZoomIn size={16} />, tt("labels.zoom"), onClose, tc("actions.close"))}
@@ -822,13 +815,13 @@ function SelectionPane({ tl, onClose }: { tl: TimelineApi; onClose: () => void }
tiles
options={[
"off" as const,
- ...FIXED_ROTATION_3D_PRESETS,
- // A moving camera reads the cursor track, which the export only loads while
- // the cursor is shown: not offered then, rather than a camera that silently
- // holds still. Still listed once picked, so the row can show it.
- ...(settings.cursorShow || region.rotationPreset === "follow-cursor"
+ // The orbit follows the cursor under auto focus, the default for a new zoom,
+ // and a hidden cursor drives nothing: not offered then, rather than a camera
+ // that silently holds still. Still listed once picked, so the row can show it.
+ ...(settings.cursorShow || region.rotationPreset === "orbit"
? MOVING_ROTATION_3D_PRESETS
: []),
+ ...FIXED_ROTATION_3D_PRESETS,
].map((preset) => ({
value: preset,
label: cameraLabel(preset),
diff --git a/src/components/video-editor/projectPersistence.test.ts b/src/components/video-editor/projectPersistence.test.ts
index 34e3e7a84..f26edec23 100644
--- a/src/components/video-editor/projectPersistence.test.ts
+++ b/src/components/video-editor/projectPersistence.test.ts
@@ -210,7 +210,7 @@ describe("projectPersistence media compatibility", () => {
const [iso, unknown] = normalizeProjectEditor({
zoomRegions: [
{ ...zoom, id: "iso", rotationPreset: "iso" as never },
- { ...zoom, id: "unknown", rotationPreset: "orbit" as never },
+ { ...zoom, id: "unknown", rotationPreset: "swing-clicks" as never },
],
}).zoomRegions;
expect(iso.rotationPreset).toBe("left");
diff --git a/src/components/video-editor/types.ts b/src/components/video-editor/types.ts
index 0d4bbb298..c2ae8db81 100644
--- a/src/components/video-editor/types.ts
+++ b/src/components/video-editor/types.ts
@@ -81,20 +81,21 @@ export const FIXED_ROTATION_3D_PRESETS = ["left", "right"] as const;
export type FixedRotation3DPreset = (typeof FIXED_ROTATION_3D_PRESETS)[number];
/**
- * A moving 3D camera. `follow-cursor` keeps the screen still and moves a real camera around it:
- * the camera orbits to the side the cursor is on and rises or dips with it, always level. The
- * native compositor renders it (`crates/compositor/src/camera.rs`). It needs the cursor track,
- * which only drives it while the cursor is shown.
+ * A moving 3D camera. `orbit` keeps the screen still and moves a real camera around it, always
+ * level: to the side of a point of the screen, rising or dipping with it. The zoom's focus mode
+ * picks the point: the cursor under auto focus, which only drives it while the cursor is shown,
+ * the focus point under manual. The native compositor renders it
+ * (`crates/compositor/src/camera.rs`).
*/
-export const MOVING_ROTATION_3D_PRESETS = ["follow-cursor"] as const;
+export const MOVING_ROTATION_3D_PRESETS = ["orbit"] as const;
export type MovingRotation3DPreset = (typeof MOVING_ROTATION_3D_PRESETS)[number];
/** The zoom's "3D camera": absent means a flat screen. */
export type Rotation3DPreset = FixedRotation3DPreset | MovingRotation3DPreset;
export const ROTATION_3D_PRESET_ORDER: Rotation3DPreset[] = [
- ...FIXED_ROTATION_3D_PRESETS,
...MOVING_ROTATION_3D_PRESETS,
+ ...FIXED_ROTATION_3D_PRESETS,
];
export function isRotation3DPreset(value: unknown): value is Rotation3DPreset {
@@ -128,7 +129,7 @@ export function readRotation3DPreset(value: unknown): Rotation3DPreset | undefin
export const ROTATION_3D_PRESETS: Record<Rotation3DPreset, Rotation3D> = {
left: { rotationX: -12, rotationY: -18, rotationZ: -2 },
right: { rotationX: -12, rotationY: 18, rotationZ: 2 },
- "follow-cursor": { rotationX: -4, rotationY: 0, rotationZ: 0 },
+ orbit: { rotationX: -4, rotationY: 0, rotationZ: 0 },
};
/** Perspective distance in CSS px is this factor times min(viewport w, h). Same
diff --git a/src/i18n/locales/ar/settings.json b/src/i18n/locales/ar/settings.json
index aebebe17d..3f7daf9df 100644
--- a/src/i18n/locales/ar/settings.json
+++ b/src/i18n/locales/ar/settings.json
@@ -368,7 +368,7 @@
"preset": {
"left": "الشاشة مستديرة لليسار",
"right": "الشاشة مستديرة لليمين",
- "followCursor": "يدور مع المؤشر"
+ "orbit": "مدار ثلاثي الأبعاد"
}
},
"level": "مستوى التكبير",
diff --git a/src/i18n/locales/cs/settings.json b/src/i18n/locales/cs/settings.json
index 0f4e42b9d..7fc41fa8b 100644
--- a/src/i18n/locales/cs/settings.json
+++ b/src/i18n/locales/cs/settings.json
@@ -368,7 +368,7 @@
"preset": {
"left": "Obrazovka natočená doleva",
"right": "Obrazovka natočená doprava",
- "followCursor": "Obíhá s kurzorem"
+ "orbit": "3D orbita"
}
},
"level": "Úroveň přiblížení",
diff --git a/src/i18n/locales/de/settings.json b/src/i18n/locales/de/settings.json
index c56c8cb40..c78163a73 100644
--- a/src/i18n/locales/de/settings.json
+++ b/src/i18n/locales/de/settings.json
@@ -368,7 +368,7 @@
"preset": {
"left": "Bildschirm nach links gedreht",
"right": "Bildschirm nach rechts gedreht",
- "followCursor": "Kreist mit dem Cursor"
+ "orbit": "3D-Orbit"
}
},
"level": "Zoomstufe",
diff --git a/src/i18n/locales/en/settings.json b/src/i18n/locales/en/settings.json
index 10d5a2681..c73f7d27d 100644
--- a/src/i18n/locales/en/settings.json
+++ b/src/i18n/locales/en/settings.json
@@ -368,7 +368,7 @@
"preset": {
"left": "Screen turned left",
"right": "Screen turned right",
- "followCursor": "Orbits with the cursor"
+ "orbit": "3D Orbit"
}
},
"level": "Zoom level",
diff --git a/src/i18n/locales/es/settings.json b/src/i18n/locales/es/settings.json
index 224541210..c3e45ed32 100644
--- a/src/i18n/locales/es/settings.json
+++ b/src/i18n/locales/es/settings.json
@@ -368,7 +368,7 @@
"preset": {
"left": "Pantalla girada a la izquierda",
"right": "Pantalla girada a la derecha",
- "followCursor": "Gira con el cursor"
+ "orbit": "Órbita 3D"
}
},
"level": "Nivel de zoom",
diff --git a/src/i18n/locales/fr/settings.json b/src/i18n/locales/fr/settings.json
index e05d59a74..19d292f9b 100644
--- a/src/i18n/locales/fr/settings.json
+++ b/src/i18n/locales/fr/settings.json
@@ -368,7 +368,7 @@
"preset": {
"left": "Écran tourné à gauche",
"right": "Écran tourné à droite",
- "followCursor": "Tourne avec le curseur"
+ "orbit": "Orbite 3D"
}
},
"level": "Niveau de zoom",
diff --git a/src/i18n/locales/it/settings.json b/src/i18n/locales/it/settings.json
index 7a931f1e6..e7c8b2a6e 100644
--- a/src/i18n/locales/it/settings.json
+++ b/src/i18n/locales/it/settings.json
@@ -368,7 +368,7 @@
"preset": {
"left": "Schermo ruotato a sinistra",
"right": "Schermo ruotato a destra",
- "followCursor": "Ruota con il cursore"
+ "orbit": "Orbita 3D"
}
},
"level": "Livello zoom",
diff --git a/src/i18n/locales/ja-JP/settings.json b/src/i18n/locales/ja-JP/settings.json
index d0a0578e1..cace44f74 100644
--- a/src/i18n/locales/ja-JP/settings.json
+++ b/src/i18n/locales/ja-JP/settings.json
@@ -368,7 +368,7 @@
"preset": {
"left": "画面を左向きに",
"right": "画面を右向きに",
- "followCursor": "カーソルに合わせて回り込む"
+ "orbit": "3D オービット"
}
},
"level": "ズーム倍率",
diff --git a/src/i18n/locales/ko-KR/settings.json b/src/i18n/locales/ko-KR/settings.json
index 10156b5b2..11b41220e 100644
--- a/src/i18n/locales/ko-KR/settings.json
+++ b/src/i18n/locales/ko-KR/settings.json
@@ -368,7 +368,7 @@
"preset": {
"left": "화면 왼쪽으로 돌림",
"right": "화면 오른쪽으로 돌림",
- "followCursor": "커서를 따라 회전"
+ "orbit": "3D 궤도"
}
},
"level": "줌 레벨",
diff --git a/src/i18n/locales/pt-BR/settings.json b/src/i18n/locales/pt-BR/settings.json
index 9274b124c..a1f4b7122 100644
--- a/src/i18n/locales/pt-BR/settings.json
+++ b/src/i18n/locales/pt-BR/settings.json
@@ -368,7 +368,7 @@
"preset": {
"left": "Tela virada para a esquerda",
"right": "Tela virada para a direita",
- "followCursor": "Gira com o cursor"
+ "orbit": "Órbita 3D"
}
},
"level": "Nível de Zoom",
diff --git a/src/i18n/locales/ru/settings.json b/src/i18n/locales/ru/settings.json
index ec697e81d..31a105eff 100644
--- a/src/i18n/locales/ru/settings.json
+++ b/src/i18n/locales/ru/settings.json
@@ -368,7 +368,7 @@
"preset": {
"left": "Экран повёрнут влево",
"right": "Экран повёрнут вправо",
- "followCursor": "Облетает за курсором"
+ "orbit": "3D-орбита"
}
},
"level": "Уровень масштабирования",
diff --git a/src/i18n/locales/tr/settings.json b/src/i18n/locales/tr/settings.json
index 87db90eee..1a1f2ba4f 100644
--- a/src/i18n/locales/tr/settings.json
+++ b/src/i18n/locales/tr/settings.json
@@ -368,7 +368,7 @@
"preset": {
"left": "Ekran sola dönük",
"right": "Ekran sağa dönük",
- "followCursor": "İmleçle birlikte döner"
+ "orbit": "3D Yörünge"
}
},
"level": "Yakınlaştırma Seviyesi",
diff --git a/src/i18n/locales/vi/settings.json b/src/i18n/locales/vi/settings.json
index f672f1be6..57e93ce6c 100644
--- a/src/i18n/locales/vi/settings.json
+++ b/src/i18n/locales/vi/settings.json
@@ -368,7 +368,7 @@
"preset": {
"left": "Màn hình xoay sang trái",
"right": "Màn hình xoay sang phải",
- "followCursor": "Xoay quanh theo con trỏ"
+ "orbit": "Quỹ đạo 3D"
}
},
"level": "Mức độ thu phóng",
diff --git a/src/i18n/locales/zh-CN/settings.json b/src/i18n/locales/zh-CN/settings.json
index 0f52d11c0..101aab97d 100644
--- a/src/i18n/locales/zh-CN/settings.json
+++ b/src/i18n/locales/zh-CN/settings.json
@@ -368,7 +368,7 @@
"preset": {
"left": "画面向左转",
"right": "画面向右转",
- "followCursor": "随光标环绕"
+ "orbit": "3D 环绕"
}
},
"level": "缩放级别",
diff --git a/src/i18n/locales/zh-TW/settings.json b/src/i18n/locales/zh-TW/settings.json
index bc7319a96..782944603 100644
--- a/src/i18n/locales/zh-TW/settings.json
+++ b/src/i18n/locales/zh-TW/settings.json
@@ -368,7 +368,7 @@
"preset": {
"left": "畫面向左轉",
"right": "畫面向右轉",
- "followCursor": "隨游標環繞"
+ "orbit": "3D 環繞"
}
},
"level": "縮放級別",
diff --git a/src/lib/ai-edition/schema/index.test.ts b/src/lib/ai-edition/schema/index.test.ts
index bf1f0e5f1..edc37804a 100644
--- a/src/lib/ai-edition/schema/index.test.ts
+++ b/src/lib/ai-edition/schema/index.test.ts
@@ -11,6 +11,7 @@ import {
documentSchema,
ensureDocument,
legacyEditorSchema,
+ parseDocumentFile,
rangeSchema,
timelineSchema,
trimRangeSchema,
@@ -1190,3 +1191,40 @@ describe("zoom click impact lifted to the cursor setting", () => {
expect(migrateRawDocumentToCurrent(raw)).toBe(raw);
});
});
+
+// --- follow-cursor -> orbit : the orbit camera gains a manual mode ---------------------------
+
+describe("follow-cursor zooms read as orbits under auto focus", () => {
+ const zoom = (extra: Record<string, unknown>) => ({
+ id: "z",
+ startMs: 0,
+ endMs: 1000,
+ depth: 3,
+ focus: { cx: 0.2, cy: 0.7 },
+ ...extra,
+ });
+ const docWith = (zoomRanges: unknown[]) => ({
+ ...createEmptyDocument({ projectId: "p", title: "t" }),
+ zoomRanges,
+ });
+
+ it("keeps them following the cursor, whatever focus mode they stored", () => {
+ const doc = parseDocumentFile(
+ docWith([
+ zoom({ id: "manual", rotationPreset: "follow-cursor", focusMode: "manual" }),
+ zoom({ id: "unset", rotationPreset: "follow-cursor" }),
+ zoom({ id: "left", rotationPreset: "left" }),
+ ]),
+ );
+ expect(doc.zoomRanges.map((z) => [z.id, z.rotationPreset, z.focusMode])).toEqual([
+ ["manual", "orbit", "auto"],
+ ["unset", "orbit", "auto"],
+ ["left", "left", undefined],
+ ]);
+ });
+
+ it("leaves an orbit set to manual alone, so a second load changes nothing", () => {
+ const manualOrbit = docWith([zoom({ rotationPreset: "orbit", focusMode: "manual" })]);
+ expect(migrateRawDocumentToCurrent(manualOrbit)).toBe(manualOrbit);
+ });
+});
diff --git a/src/lib/ai-edition/schema/index.ts b/src/lib/ai-edition/schema/index.ts
index ba07f7b59..39acf68d6 100644
--- a/src/lib/ai-edition/schema/index.ts
+++ b/src/lib/ai-edition/schema/index.ts
@@ -504,12 +504,13 @@ export const zoomRegionSchema = endGteStart(
}),
focusMode: z.enum(["manual", "auto"]).optional(),
/** The zoom's 3D camera (`Rotation3DPreset` in `components/video-editor/types.ts` — same
- * literal list, duplicated here): a fixed angle, or the camera that turns to the cursor
- * (`crates/compositor/src/camera.rs`). Absent means a flat screen. A stored `iso`, the
- * retired "turned left, seen from above" angle, reads as `left`, which kept its look
- * (`readRotation3DPreset`): every document load goes through this parse. */
+ * literal list, duplicated here): a fixed angle, or the camera that orbits the screen
+ * (`crates/compositor/src/camera.rs`), placed by the zoom's focus mode. Absent means a flat
+ * screen. A stored `iso`, the retired "turned left, seen from above" angle, reads as
+ * `left`, which kept its look (`readRotation3DPreset`): every document load goes through
+ * this parse. A stored `follow-cursor` never reaches it (`readFollowCursorAsAutoOrbit`). */
rotationPreset: z
- .enum(["iso", "left", "right", "follow-cursor"])
+ .enum(["iso", "left", "right", "orbit"])
.transform((preset) => (preset === "iso" ? "left" : preset))
.optional(),
customScale: z.number().positive().optional(),
@@ -1051,13 +1052,42 @@ function liftZoomClickImpact(raw: unknown): unknown {
return { ...doc, legacyEditor: { ...legacy, cursorClickImpact: true } };
}
+/**
+ * Read a zoom stored with the `follow-cursor` camera as the `orbit` camera under auto focus.
+ *
+ * `follow-cursor` was the orbit before it had a manual mode: it followed the cursor whatever the
+ * zoom's focus mode said, and most such zooms carry "manual", the default. The camera now reads
+ * the focus mode like every other zoom, so the auto focus is written down along with the new
+ * name, and the zoom keeps following the cursor as it did.
+ *
+ * No `schemaVersion` bump, as for `iso` → `left`: the retired value is the marker, and nothing
+ * writes it any more, so a second run finds nothing. A document without such a zoom comes back
+ * untouched. Runs on RAW, untrusted input, so every read is guarded.
+ */
+function readFollowCursorAsAutoOrbit(raw: unknown): unknown {
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return raw;
+ const doc = raw as Record<string, unknown>;
+ if (!Array.isArray(doc.zoomRanges)) return raw;
+ let renamed = false;
+ const zoomRanges = doc.zoomRanges.map((entry) => {
+ if (!entry || typeof entry !== "object" || Array.isArray(entry)) return entry;
+ const zoom = entry as Record<string, unknown>;
+ if (zoom.rotationPreset !== "follow-cursor") return entry;
+ renamed = true;
+ return { ...zoom, rotationPreset: "orbit", focusMode: "auto" };
+ });
+ return renamed ? { ...doc, zoomRanges } : raw;
+}
+
export function migrateRawDocumentToCurrent(raw: unknown): unknown {
- return raiseInvertedTranscriptEnds(
- dropAudioAnchoredTrims(
- liftZoomClickImpact(
- upgradeV7DocumentToV8(
- upgradeV6DocumentToV7(
- upgradeV5DocumentToV6(upgradeV4DocumentToV5(upgradeV3DocumentToV4(raw))),
+ return readFollowCursorAsAutoOrbit(
+ raiseInvertedTranscriptEnds(
+ dropAudioAnchoredTrims(
+ liftZoomClickImpact(
+ upgradeV7DocumentToV8(
+ upgradeV6DocumentToV7(
+ upgradeV5DocumentToV6(upgradeV4DocumentToV5(upgradeV3DocumentToV4(raw))),
+ ),
),
),
),
diff --git a/src/lib/ai-edition/store/useTimeline.test.ts b/src/lib/ai-edition/store/useTimeline.test.ts
index d5aaf58bc..b82f8dcf4 100644
--- a/src/lib/ai-edition/store/useTimeline.test.ts
+++ b/src/lib/ai-edition/store/useTimeline.test.ts
@@ -821,10 +821,10 @@ describe("useTimeline zoom modifiers (rotation + focus mode)", () => {
await result.current.updateZoomRotation("zoom_a", "left");
});
await act(async () => {
- await result.current.updateZoomRotation("zoom_a", "follow-cursor");
+ await result.current.updateZoomRotation("zoom_a", "orbit");
});
const zoom = useProjectStore.getState().document?.zoomRanges[0];
- expect(zoom?.rotationPreset).toBe("follow-cursor");
+ expect(zoom?.rotationPreset).toBe("orbit");
expect(zoom).not.toHaveProperty("cameraMotion");
});
diff --git a/technical-documentation/testing/manual-e2e-checklist.md b/technical-documentation/testing/manual-e2e-checklist.md
index b0dca5458..fd9c024e0 100644
--- a/technical-documentation/testing/manual-e2e-checklist.md
+++ b/technical-documentation/testing/manual-e2e-checklist.md
@@ -138,7 +138,7 @@ Sections marked **post-1.10.0** cover what has landed on `main` since the v1.10.
- [ ] Activate the timeline tool with the visible zoom label and confirm a zoom region appears.
- [ ] Select the zoom region and cycle its level through multiple available depths; confirm the preview scale changes.
- [ ] Drag the zoom focus point in the preview and confirm the zoom follows the new focus.
-- [ ] Change the zoom's 3D camera among Off, the three fixed angles and the follow-cursor camera, and confirm the preview orientation changes; with the follow-cursor camera, move the cursor or click from one side of the recording to the other and confirm the screen turns to that side.
+- [ ] Change the zoom's 3D camera among Off, 3D Orbit, Left and Right, and confirm the preview orientation changes; with 3D Orbit under Auto focus, move the cursor or click from one side of the recording to the other and confirm the screen turns to that side; under Manual focus, drag the focus point to one side and confirm the camera settles on that side and stays there while the cursor moves.
- [ ] Set a zoom region to automatic focus and confirm its focus follows cursor telemetry across the whole region.
- [ ] Use the automatic-zooms menu and confirm it adds suggested zoom regions when cursor telemetry supports suggestions.
- [ ] Select a zoom region and delete it from the selection inspector; confirm it disappears from the lane.