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(cursor): move click impact to the cursor settings, for every camera

EtienneLescot4d071a73a1f0
diff --git a/crates/compositor/src/frame_geometry.rs b/crates/compositor/src/frame_geometry.rs
index 2976299bf..9fe7bfbd6 100644
--- a/crates/compositor/src/frame_geometry.rs
+++ b/crates/compositor/src/frame_geometry.rs
@@ -2859,7 +2859,6 @@ pub fn plan_frame(input: &FrameGeometryInput) -> FrameGeometry {
let mut zoom_rotation = [0.0f32; 3];
let mut zoom_rotation_prev = [0.0f32; 3];
let mut zoom_tilt = 0.0f32;
- let mut zoom_click_impact = 0.0f32;
let mut zoom_camera = 0.0f32;
let mut zoom_camera_prev = 0.0f32;
let mut zoom_aim = [0.5f32; 2];
@@ -2889,7 +2888,6 @@ pub fn plan_frame(input: &FrameGeometryInput) -> FrameGeometry {
p.focus = zs.focus;
zoom_rotation = zs.rotation;
zoom_tilt = zs.tilt;
- zoom_click_impact = zs.click_impact;
zoom_camera = zs.camera;
zoom_aim = zs.aim;
zoom_orbit = zs.orbit;
@@ -3120,15 +3118,26 @@ pub fn plan_frame(input: &FrameGeometryInput) -> FrameGeometry {
let shown = |i: usize| (crop_cut[i + 2] - crop_cut[i]) / (window[i + 2] - window[i]).max(1e-6);
let screen_unit_px =
screen_unit_px([s_base[2] * rw * shown(0), s_base[3] * rh * shown(1)], padding_scale);
- // Impact du clic : mêmes piste, coupe, porte et budget que la parallaxe sous un angle fixe ;
- // sous la caméra réelle, les mêmes clics font reculer l'œil.
+ // Impact du clic, un réglage du curseur qui vaut sous toutes les caméras : sous un angle
+ // fixe, mêmes piste, coupe, porte et budget que la parallaxe ; sous la caméra réelle, les
+ // mêmes clics font reculer l'œil ; sur un écran droit, l'écran lui-même (`pressed`).
let (impact, press) = match (scene, parallax_track) {
- (Some(s), Some(track)) if zoom_click_impact > 0.0 => {
- let (tilt, press) = click_impact_at(s, cfg, &lp, track, source_t, cut, [u_max, v_max]);
- (tilt.map(|d| d * zoom_click_impact), press * zoom_click_impact)
+ (Some(s), Some(track)) if s.cursor.click_impact => {
+ click_impact_at(s, cfg, &lp, track, source_t, cut, [u_max, v_max])
}
_ => ([0.0; 3], 0.0),
};
+ // Sur un écran droit, le clic fait reculer l'écran comme l'œil recule sous la caméra réelle
+ // (`camera::PRESS`) : la boîte rapetisse autour de son centre, puis revient. Le faire
+ // basculer depuis l'écran droit amènerait des arêtes sur les axes (la règle des 2°). Là où
+ // un angle fixe est installé, la bascule prend le relais (`tilt_gate`) ; sous la caméra
+ // réelle, l'œil (son poids). Même recul aux deux frames : comme la bascule, l'impact
+ // n'entre pas dans le flou de mouvement.
+ let flat_press = press * (1.0 - crate::regions::tilt_gate(zoom_tilt)) * (1.0 - zoom_camera);
+ let pressed = |b: [f32; 4]| -> [f32; 4] {
+ let k = 1.0 / (1.0 - crate::camera::PRESS * flat_press);
+ [b[0] + b[2] * (1.0 - k) * 0.5, b[1] + b[3] * (1.0 - k) * 0.5, b[2] * k, b[3] * k]
+ };
// Sous la caméra réelle, la visée et l'orbite vivent dans le recadrage, comme le focus :
// même report dans la coupe (un cover la rogne). La mise au point suit le pointeur lissé
// (l'orbite), pas le point visé : celui-ci reste au centre au zoom 1 et bute sur sa portée
@@ -3154,7 +3163,7 @@ pub fn plan_frame(input: &FrameGeometryInput) -> FrameGeometry {
Some(pose) => pose.orbit,
None => focus_in_cut(u_max, v_max, active_crop, p.focus, cut),
};
- let s_dst = remap_box(s_base, cut_ref, cut);
+ let s_dst = pressed(remap_box(s_base, cut_ref, cut));
// Parallaxe : calculée ici, une fois la coupe connue — elle mesure la vitesse du curseur
// en coupes VISIBLES par seconde. La coupe visible est `cut_ref`, zoom compris : `cut`
// ne porte plus que le crop depuis #179, et sous un x2 le même geste traverse deux fois
@@ -3172,7 +3181,7 @@ pub fn plan_frame(input: &FrameGeometryInput) -> FrameGeometry {
zoom_tilt,
impact,
);
- let s_dst_prev = remap_box(s_base_prev, cut_ref_prev, cut);
+ let s_dst_prev = pressed(remap_box(s_base_prev, cut_ref_prev, cut));
// le padding n'affecte QUE l'écran (la quantité de fond révélée). La webcam reste ancrée
// en bas-droite à sa marge fixe, quelle que soit la valeur de padding (pas de scale_frame)
// — SAUF quand l'app a résolu un placement explicite (`app_webcam_rect`, drag-to-reposition
@@ -3464,9 +3473,9 @@ pub fn cursor_plane_point(cut: [f32; 4], uv_max: [f32; 2], p: (f32, f32)) -> Opt
((0.0..=1.0).contains(&fx) && (0.0..=1.0).contains(&fy)).then_some([fx, fy])
}
-/// L'impact des clics (`regions::click_impact`) avec les portes qui dépendent de la scène, à
-/// multiplier encore par le poids des régions (`ZoomState::click_impact`) ; la porte du préset
-/// vient ensuite, dans `dynamic_tilt`.
+/// L'impact des clics (la bascule `regions::click_impact`, le recul `regions::click_press`) avec
+/// les portes qui dépendent de la scène ; la porte du préset vient ensuite, dans `dynamic_tilt`
+/// pour la bascule, dans `plan_frame` pour le recul.
///
/// - curseur visible (`cursor_alpha`) : `cursor.show` explicite, la piste étant chargée même
/// curseur masqué (le focus auto la suit) ;
@@ -6399,9 +6408,10 @@ mod tests {
assert!(zoomed > flat * 1.4, "zoom x2 : {zoomed} devrait dépasser {flat} nettement");
}
- /// L'impact du clic passe par `plan_frame` et chacune de ses portes l'éteint : région sans
- /// l'option ou sans préset, curseur masqué (réglage ou région), clic hors du clip actif ou
- /// de la coupe, vitesse ≥ 2×, masque de flou visible.
+ /// L'impact du clic passe par `plan_frame` et chacune de ses portes l'éteint : réglage absent,
+ /// curseur masqué (réglage ou région), clic hors du clip actif ou de la coupe, vitesse ≥ 2×,
+ /// masque de flou visible. Sous un angle fixe il fait basculer le plan ; sans préset, il fait
+ /// reculer l'écran droit, par les mêmes portes.
#[test]
fn every_gate_cancels_the_click_impact() {
let cfg = crate::config::all().pop().expect("au moins une config");
@@ -6416,30 +6426,48 @@ mod tests {
};
let on_edge = track_at(0.6);
let impact_json = zoomed_golden_scene_json()
- .replace(r#""rotation":"none""#, r#""rotation":"iso","clickImpact":true"#);
- let dyn_of = |edit: &dyn Fn(String) -> String, track| {
+ .replace(r#""rotation":"none""#, r#""rotation":"iso""#)
+ .replace(r#""cursor":{"#, r#""cursor":{"clickImpact":true,"#);
+ let plan_of = |edit: &dyn Fn(String) -> String, track| {
let scene = Scene::from_json(&edit(impact_json.clone())).expect("scène");
plan_frame(&FrameGeometryInput { cursor: Some(track), ..golden_input(&scene, &cfg) })
- .zoom_rotation_dyn
};
+ let dyn_of = |edit: &dyn Fn(String) -> String, track| plan_of(edit, track).zoom_rotation_dyn;
let same = |s: String| s;
let on = dyn_of(&same, on_edge);
assert!(on[1] > 0.75 * crate::regions::CLICK_IMPACT_DEG, "clic à droite → +Y : {on:?}");
+ // Sans préset, rien ne bascule : l'écran droit recule, puis revient.
+ let flat = |s: String| s.replace(r#""rotation":"iso""#, r#""rotation":"none""#);
+ let off = |s: String| s.replace(r#""clickImpact":true,"#, "");
+ assert_eq!(plan_of(&same, on_edge).s_dst, plan_of(&off, on_edge).s_dst, "le plan bascule, il ne recule pas");
+ let box_of = |edit: &dyn Fn(String) -> String, track| plan_of(&|s| flat(edit(s)), track).s_dst;
+ let rest = box_of(&off, on_edge);
+ let pushed = plan_of(&flat, on_edge);
+ assert_eq!(pushed.zoom_rotation_dyn, [0.0; 3]);
+ let shrink = [pushed.s_dst[2] / rest[2], pushed.s_dst[3] / rest[3]];
+ assert!(shrink[0] < 0.97 && (shrink[0] - shrink[1]).abs() < 1e-5, "{shrink:?}");
+ let centre = |b: [f32; 4]| [b[0] + b[2] * 0.5, b[1] + b[3] * 0.5];
+ let (a, b) = (centre(pushed.s_dst), centre(rest));
+ assert!((a[0] - b[0]).abs() < 1e-5 && (a[1] - b[1]).abs() < 1e-5, "autour du centre : {a:?} {b:?}");
+ let prev = pushed.s_dst_prev[2] / plan_of(&|s| flat(off(s)), on_edge).s_dst_prev[2];
+ assert!((prev - shrink[0]).abs() < 1e-6, "hors du flou de mouvement : {prev} {shrink:?}");
+ assert_eq!(box_of(&same, track_at(0.9)), box_of(&off, track_at(0.9)), "clic hors du crop");
+
let insert = |field: &'static str| {
move |s: String| s.replace(r#""cursor":"#, &format!(r#"{field},"cursor":"#))
};
- let cases: [(&str, Box<dyn Fn(String) -> String>); 7] = [
- ("option absente", Box::new(|s: String| s.replace(r#","clickImpact":true"#, ""))),
- ("sans préset", Box::new(|s: String| s.replace(r#""rotation":"iso""#, r#""rotation":"none""#))),
+ let cases: [(&str, Box<dyn Fn(String) -> String>); 6] = [
+ ("option absente", Box::new(off)),
("curseur masqué", Box::new(|s: String| s.replace(r#""show":true"#, r#""show":false"#))),
- ("région hideCursor", Box::new(|s: String| s.replace(r#""clickImpact":true"#, r#""clickImpact":true,"hideCursor":true"#))),
+ ("région hideCursor", Box::new(|s: String| s.replace(r#""rotation":"iso""#, r#""rotation":"iso","hideCursor":true"#))),
("clic avant le clip", Box::new(|s: String| s.replace(r#""sourceStartSec":0"#, r#""sourceStartSec":1.46"#))),
("vitesse 2x", Box::new(insert(r#""speedRegions":[{"clipIndex":0,"startSec":1.0,"endSec":2.0,"speed":2.0}]"#))),
("flou visible", Box::new(insert(r#""annotations":[{"id":"b","startSec":1.0,"endSec":2.0,"kind":"blur","x":0.1,"y":0.1,"w":0.2,"h":0.2,"blur":{"style":"mosaic","shape":"rectangle","color":"black","intensity":8,"blockSize":16}}]"#))),
];
for (name, edit) in &cases {
assert_eq!(dyn_of(edit.as_ref(), on_edge), [0.0; 3], "{name}");
+ assert_eq!(box_of(edit.as_ref(), on_edge), box_of(&|s| off(edit(s)), on_edge), "{name}, écran droit");
}
assert_eq!(dyn_of(&same, track_at(0.9)), [0.0; 3], "clic hors du crop");
@@ -6491,7 +6519,8 @@ 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","clickImpact":true"#);
+ .replace(r#""rotation":"none""#, r#""rotation":"follow-cursor""#)
+ .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 {
Box::leak(Box::new(crate::cursor::CursorTrack::new(
@@ -6542,9 +6571,10 @@ mod tests {
assert_eq!((clicked.zoom_rotation, clicked.zoom_rotation_dyn), ([0.0; 3], [0.0; 3]));
let pose = clicked.camera.expect("caméra");
assert!(pose.press < -0.9, "{pose:?}");
+ assert_eq!(clicked.s_dst, right.s_dst, "la boîte ne recule pas, l'œil si");
let pushed = clicked.screen_tilt(s_px).expect("caméra");
assert!(pushed.half_extents_px().0 < 0.98 * qr.half_extents_px().0);
- let off = Scene::from_json(&json.replace(r#","clickImpact":true"#, "")).expect("scène");
+ let off = Scene::from_json(&json.replace(r#""clickImpact":true,"#, "")).expect("scène");
assert_eq!(plan(&off, parked(0.55, vec![1.45])).camera.expect("caméra").press, 0.0);
let hidden = Scene::from_json(&json.replace(r#""show":true"#, r#""show":false"#)).expect("scène");
@@ -7908,6 +7938,7 @@ mod tests {
/// `plan_cursor`, scène dorée (recadrée, zoomée) sous `rotation`.
fn model_frame(
rotation: &str,
+ click_impact: bool,
blur: f32,
track: &'static crate::cursor::CursorTrack,
t: f32,
@@ -7915,6 +7946,7 @@ mod tests {
let cfg = crate::config::all().pop().expect("cfg");
let json = zoomed_golden_scene_json().replace(r#""rotation":"none""#, rotation);
let mut scene = Scene::from_json(&json).expect("scène");
+ scene.cursor.click_impact = click_impact;
scene.cursor.theme = "default".into();
scene.cursor.cursor_sprites = model_scene().cursor.cursor_sprites;
let live = LiveParams {
@@ -7963,21 +7995,23 @@ mod tests {
/// Au contact, la pointe du curseur modélisé tombe sur le pixel du clic BRUT, à 0,5 px près :
/// quel que soit le lissage (le ressort traîne derrière la souris), la vitesse d'arrivée, un
- /// départ immédiat, l'angle fixe (impact du plan compris), la caméra réelle, et la traînée de
- /// flou (repliée sur la tête pendant le contact).
+ /// départ immédiat, la caméra (impact du clic compris : l'écran droit recule, l'angle fixe
+ /// bascule, l'œil de la caméra réelle recule), et la traînée de flou (repliée sur la tête
+ /// pendant le contact).
#[test]
fn the_modelled_tip_touches_the_raw_click_pixel() {
const TC: f32 = 1.5;
let presets = [
- ("flat", r#""rotation":"none""#),
- ("iso", r#""rotation":"iso","clickImpact":true"#),
- ("left", r#""rotation":"left","clickImpact":true"#),
- ("right", r#""rotation":"right","clickImpact":true"#),
- ("follow", r#""rotation":"follow-cursor""#),
+ ("flat", r#""rotation":"none""#, false),
+ ("flat+impact", r#""rotation":"none""#, true),
+ ("iso", r#""rotation":"iso""#, true),
+ ("left", r#""rotation":"left""#, true),
+ ("right", r#""rotation":"right""#, true),
+ ("follow", r#""rotation":"follow-cursor""#, true),
];
let (to, from, away) = ([0.3, 0.18], [0.08, 0.05], [0.45, 0.32]);
let mut worst = 0.0f32;
- for (name, rotation) in presets {
+ for (name, rotation, impact) in presets {
for smoothing in [0.0, 0.25, 0.5, 1.0] {
for speed in [0.5, 2.0] {
for dwell in [0.0, 0.15] {
@@ -7990,7 +8024,7 @@ mod tests {
let shape = SpriteShape { hotspot: hotspot_of(key), ..shape };
for k in 0..=15 {
let t = TC + 0.02 + k as f32 * 0.004;
- let (g, plan) = model_frame(rotation, 1.0, track, t);
+ let (g, plan) = model_frame(rotation, impact, 1.0, track, t);
let plan = plan.expect("curseur visible au contact");
let pose = plan.model.expect("modèle");
if pose.clearance > 0.0 {
@@ -8027,12 +8061,12 @@ mod tests {
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""#] {
- let impacts = |track, t| model_frame(rotation, 0.0, track, t).1.expect("curseur").impacts;
+ 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");
assert!(impacts(track, TC + IMPACT_DELAY_S + IMPACT_S + 0.001).is_empty(), "{rotation}: après");
for age in [0.06, 0.1, 0.2, 0.4] {
- let (g, plan) = model_frame(rotation, 0.0, track, TC + age);
+ let (g, plan) = model_frame(rotation, false, 0.0, track, TC + age);
let cb = &plan.expect("curseur").impacts;
assert_eq!(cb.len(), 1, "{rotation} +{age}");
let cb = cb[0];
diff --git a/crates/compositor/src/regions.rs b/crates/compositor/src/regions.rs
index c09e4b24b..42047c3d7 100644
--- a/crates/compositor/src/regions.rs
+++ b/crates/compositor/src/regions.rs
@@ -466,13 +466,8 @@ pub struct ZoomState {
pub rotation: [f32; 3],
/// À quel point un préset 3D est installé (0..1) : la force de la région quand elle en porte
/// 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`.
+ /// quand leurs présets diffèrent. C'est la porte de `dynamic_tilt` (`tilt_gate`).
pub tilt: f32,
- /// Poids de l'impact du clic (0..1) : 1 sur une région qui l'active (`click_impact`),
- /// interpolé entre deux régions chaînées. Ne suffit pas seul : sous un angle fixe, l'impact
- /// passe aussi par la porte de `tilt` (`dynamic_tilt`) ; sous la caméra réelle, par son poids
- /// (l'œil recule, `camera::PRESS`).
- pub click_impact: f32,
/// Poids de la caméra réelle (`camera.rs`, 0..1) : la force de la région `follow-cursor`, 0
/// sinon. Jamais non nul en même temps que `rotation` (cf. la transition chaînée).
pub camera: f32,
@@ -487,7 +482,6 @@ const IDENTITY_ZOOM: ZoomState = ZoomState {
focus: [0.5, 0.5],
rotation: [0.0, 0.0, 0.0],
tilt: 0.0,
- click_impact: 0.0,
camera: 0.0,
aim: [0.5, 0.5],
orbit: [0.5, 0.5],
@@ -573,16 +567,6 @@ fn weighted(p: [f32; 2], camera: f32) -> [f32; 2] {
p.map(|a| 0.5 + (a - 0.5) * camera)
}
-/// 1 si la région active l'impact du clic, 0 sinon. Sous un angle fixe, le clic presse l'écran ;
-/// sous la caméra réelle, l'écran reste immobile et c'est l'œil qui recule.
-fn impact_flag(region: &SceneZoomRegion) -> f32 {
- if region.click_impact {
- 1.0
- } else {
- 0.0
- }
-}
-
/// Port de `easeConnectedPan` (TS) : cubic-bezier(0.1, 0, 0.2, 1).
fn ease_connected_pan(t: f32) -> f32 {
cubic_bezier(0.1, 0.0, 0.2, 1.0, t)
@@ -883,7 +867,6 @@ pub fn zoom_state_in(
],
rotation,
tilt: lerp(fixed_flag(cur), fixed_flag(next), progress) * crossing,
- click_impact: lerp(impact_flag(cur), impact_flag(next), progress),
camera,
aim: weighted(mix(a.aim, b.aim), camera),
orbit: weighted(mix(a.orbit, b.orbit), camera),
@@ -902,7 +885,6 @@ pub fn zoom_state_in(
focus: resolve_focus(next, t, cursor, clock),
rotation: fixed_rotation(next),
tilt: fixed_flag(next),
- click_impact: impact_flag(next),
camera,
aim: weighted(seen.aim, camera),
orbit: weighted(seen.orbit, camera),
@@ -956,7 +938,6 @@ pub fn zoom_state_in(
focus: [ease(focus[0]), ease(focus[1])],
rotation: lerp_rotation3d([0.0, 0.0, 0.0], fixed_rotation(r), strength),
tilt: fixed_flag(r) * strength,
- click_impact: impact_flag(r),
camera,
aim: weighted(seen.aim, camera),
orbit: weighted(seen.orbit, camera),
@@ -1389,7 +1370,7 @@ pub fn dynamic_tilt(
strength: f32,
impact: [f32; 3],
) -> [f32; 3] {
- let gate = smoothstep(PARALLAX_GATE_START, 1.0, strength);
+ let gate = tilt_gate(strength);
if gate <= 0.0 {
return [0.0; 3];
}
@@ -1414,6 +1395,13 @@ pub fn dynamic_tilt(
clamp_dynamic_tilt(sum).map(|d| d * gate)
}
+/// La porte de `dynamic_tilt` : 0 tant qu'un angle fixe n'est pas installé, 1 une fois en place.
+/// Sur l'écran qu'elle laisse droit, l'impact du clic fait reculer l'écran à la place
+/// (`frame_geometry::plan_frame`) : aucune bascule ne part de l'écran droit.
+pub fn tilt_gate(strength: f32) -> f32 {
+ smoothstep(PARALLAX_GATE_START, 1.0, strength)
+}
+
/// Durée de l'impact du clic : la fenêtre de `CursorTrack::bounce`, pour que le plan et le
/// pointeur lisent comme un seul contact.
pub const CLICK_IMPACT_WINDOW_S: f32 = 0.26;
@@ -1488,9 +1476,9 @@ pub fn click_impact(
]
}
-/// Le recul de la caméra réelle au temps `t` : la somme des `tap` des mêmes clics que
-/// `click_impact` (dans la fenêtre du clip, visibles), bornée à [−1, 1], −1 au contact. Sans leur
-/// position : l'écran ne bascule pas, l'œil recule tout droit.
+/// Le recul au temps `t`, celui de l'œil sous la caméra réelle ou celui de l'écran droit : la somme
+/// des `tap` des mêmes clics que `click_impact` (dans la fenêtre du clip, visibles), bornée à
+/// [−1, 1], −1 au contact. Sans leur position : rien ne bascule, tout recule droit.
pub fn click_press(
t: f32,
track: &CursorTrack,
@@ -1615,7 +1603,6 @@ mod zoom_focus_tests {
rotation: None,
under_trim: false,
hide_cursor: false,
- click_impact: false,
}
}
@@ -2494,7 +2481,6 @@ mod tilt_tests {
rotation: rotation.map(Into::into),
under_trim: false,
hide_cursor: false,
- click_impact: false,
};
// `follow-cursor` 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.
@@ -2902,31 +2888,6 @@ mod tilt_tests {
}
}
- #[test]
- fn the_click_impact_weight_follows_the_region_flag() {
- let region = |click_impact: bool| SceneZoomRegion {
- id: "z".into(),
- clip_index: None,
- start_sec: 2.0,
- end_sec: 8.0,
- scale: 2.0,
- focus_x: 0.5,
- focus_y: 0.5,
- focus_mode: None,
- rotation: Some("left".into()),
- under_trim: false,
- hide_cursor: false,
- click_impact,
- };
- assert_eq!(zoom_state_at(&[region(true)], 5.0, None).click_impact, 1.0);
- assert_eq!(zoom_state_at(&[region(false)], 5.0, None).click_impact, 0.0);
- assert_eq!(
- zoom_state_at(&[region(true)], 0.0, None).click_impact,
- 0.0,
- "hors région"
- );
- }
-
/// `ZoomState::tilt` : la force pour une région à préset, 0 sans préset.
#[test]
fn the_tilt_gate_follows_the_region_strength_only_with_a_preset() {
@@ -2942,7 +2903,6 @@ mod tilt_tests {
rotation: rotation.map(Into::into),
under_trim: false,
hide_cursor: false,
- click_impact: false,
};
assert_eq!(zoom_state_at(&[region(Some("left"))], 5.0, None).tilt, 1.0);
assert_eq!(zoom_state_at(&[region(None)], 5.0, None).tilt, 0.0);
@@ -3249,7 +3209,6 @@ mod follow_camera_tests {
rotation: Some(rotation.into()),
under_trim: false,
hide_cursor: false,
- click_impact: true,
}
}
@@ -3278,8 +3237,7 @@ 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. L'impact du clic passe (l'œil recule). Hors région, l'état plat
- /// exact.
+ /// tourne avec le pointeur. Hors région, l'état plat exact.
#[test]
fn follow_cursor_rides_the_zoom_envelope() {
let tr = track(|_| (0.85, 0.5));
@@ -3287,8 +3245,8 @@ mod follow_camera_tests {
let r = [region("follow-cursor", 2.0, 8.0)];
let full = zoom_state_in(&r, 5.0, Some(&tr), &f, &ScreenClock::default());
assert_eq!(
- (full.rotation, full.tilt, full.click_impact, full.camera),
- ([0.0; 3], 0.0, 1.0, 1.0)
+ (full.rotation, full.tilt, full.camera),
+ ([0.0; 3], 0.0, 1.0)
);
assert_eq!((full.scale, full.focus), (2.0, [0.5, 0.5]));
assert!(
@@ -3326,7 +3284,7 @@ mod follow_camera_tests {
assert_eq!((blind.aim, blind.orbit), ([0.5, 0.5], [0.5, 0.5]));
// 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, left.click_impact), ([-12.0, -18.0, -2.0], 0.0, 1.0));
+ 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());
assert_eq!((unknown.rotation, unknown.tilt, unknown.camera), ([0.0; 3], 0.0, 0.0));
}
diff --git a/crates/compositor/src/scene.rs b/crates/compositor/src/scene.rs
index becb44895..c041d21ca 100644
--- a/crates/compositor/src/scene.rs
+++ b/crates/compositor/src/scene.rs
@@ -490,11 +490,6 @@ pub struct SceneZoomRegion {
/// Masque le curseur pendant cette région de zoom.
#[serde(default)]
pub hide_cursor: bool,
- /// Chaque clic enfonce le plan incliné (`regions::click_impact`). Sans effet hors préset
- /// 3D : c'est le préset qui installe le plan que le clic fait basculer.
- /// `#[serde(default)]` : l'app omet la clé quand elle est fausse.
- #[serde(default)]
- pub click_impact: bool,
}
/// Une zone de vitesse portée par le temps source d'un clip.
@@ -540,6 +535,12 @@ pub struct SceneCursor {
/// projets et des JSON écrits avant le réglage, qui gardent donc le curseur plat.
#[serde(default)]
pub model3d: bool,
+ /// Chaque clic donne un impact à l'écran, quelle que soit la caméra : sous un angle fixe le
+ /// plan bascule du côté cliqué (`regions::click_impact`), sous la caméra réelle l'œil recule,
+ /// sur un écran droit l'écran recule (`frame_geometry::plan_frame`).
+ /// `#[serde(default)]` : l'app omet la clé quand elle est fausse.
+ #[serde(default)]
+ pub click_impact: bool,
pub clip_to_bounds: bool,
/// id du thème (jeu de sprites) — informatif ici : le natif consomme `cursor_sprites`.
pub theme: String,
diff --git a/crates/compositor/tests/click_impact_render.rs b/crates/compositor/tests/click_impact_render.rs
index 44aa73ffe..6661a1502 100644
--- a/crates/compositor/tests/click_impact_render.rs
+++ b/crates/compositor/tests/click_impact_render.rs
@@ -1,5 +1,6 @@
-//! Sous un préset 3D avec « Click impact », un clic fait basculer le plan du côté cliqué puis le
-//! laisse revenir (`regions::click_impact`). Rend de vraies frames par le compositeur D3D11.
+//! Avec « Click impact » (réglage du curseur), un clic fait basculer le plan d'un préset 3D du
+//! côté cliqué puis le laisse revenir (`regions::click_impact`) ; sans préset, il fait reculer
+//! l'écran droit. Rend de vraies frames par le compositeur D3D11.
//!
//! Même harnais que `tilt_parallax_render.rs`, mêmes variables d'environnement : une source
//! 1920×1080 de 6 s, de préférence quadrillée. La piste curseur (immobile, un clic) est écrite
@@ -40,9 +41,9 @@ fn write_sidecar(path: &std::path::Path) {
std::fs::write(path, format!(r#"{{"samples":[{}]}}"#, samples.join(","))).expect("sidecar");
}
-fn scene_json(source: &str, click_impact: bool) -> String {
+fn scene_json(source: &str, rotation: &str, click_impact: bool) -> String {
let s = source.replace('\\', "/");
- let flag = if click_impact { r#","clickImpact":true"# } else { "" };
+ let flag = if click_impact { r#""clickImpact":true,"# } else { "" };
format!(
r##"{{
"clips": [{{"screenPath":"{s}","webcamPath":"","sourceStartSec":0,"sourceEndSec":6,"webcamOffsetSec":0,"hasAudio":false}}],
@@ -50,10 +51,10 @@ fn scene_json(source: &str, click_impact: bool) -> String {
"screenRect":{{"x":0.15,"y":0.15,"width":0.7,"height":0.7}}}},
"effects": {{"padding":0.1,"blur":false,"shadow":0.5,"roundnessFrac":0.02,"motionBlur":0.0}},
"background": {{"kind":"color","color":"#2060d0"}},
- "zoomRegions": [{{"id":"z","startSec":0,"endSec":6,"scale":1.15,"focusX":0.5,"focusY":0.5,"focusMode":"manual","rotation":"iso"{flag}}}],
+ "zoomRegions": [{{"id":"z","startSec":0,"endSec":6,"scale":1.15,"focusX":0.5,"focusY":0.5,"focusMode":"manual","rotation":"{rotation}"}}],
"annotations": [],
"speedRegions": [],
- "cursor": {{"show":true,"size":1,"smoothing":0,"motionBlur":0,"clickBounce":0,"clipToBounds":false,"theme":"default"}},
+ "cursor": {{{flag}"show":true,"size":1,"smoothing":0,"motionBlur":0,"clickBounce":0,"clipToBounds":false,"theme":"default"}},
"cropByClip": [null],
"output": {{"width":{W},"height":{H},"fps":null}}
}}"##
@@ -116,8 +117,8 @@ fn a_click_presses_the_clicked_side_of_the_tilted_plane() {
let comp = Compositor::new_sized(&gpu, W, H).expect("compositor");
comp.set_cursor(track.smoothed(0.0));
- let render = |click_impact: bool, t: f64| -> Vec<u8> {
- let scene = Scene::from_json(&scene_json(&source, click_impact)).expect("scene valide");
+ let render = |rotation: &str, click_impact: bool, t: f64| -> Vec<u8> {
+ let scene = Scene::from_json(&scene_json(&source, rotation, click_impact)).expect("scene valide");
comp.set_live_params(live_params_from_scene(&scene));
comp.set_scene(Some(scene));
unsafe {
@@ -141,7 +142,7 @@ fn a_click_presses_the_clicked_side_of_the_tilted_plane() {
};
let mut frames = Vec::new();
for (name, t) in instants {
- let rgba = render(true, t);
+ let rgba = render("iso", true, t);
if let Some(dir) = &out_dir {
write_ppm(&dir.join(format!("click-{name}.ppm")), &rgba);
}
@@ -149,7 +150,7 @@ fn a_click_presses_the_clicked_side_of_the_tilted_plane() {
println!("{name:<12} t={t:<6} bords {l:>4}..{r:>4} hauteur droite {hr:>4} gauche {hl:>4}");
frames.push((rgba, (l, r, hr, hl)));
}
- let off = render(false, CLICK_S + 0.0495);
+ let off = render("iso", false, CLICK_S + 0.0495);
if let Some(dir) = &out_dir {
write_ppm(&dir.join("click-off-at-contact.ppm"), &off);
}
@@ -172,4 +173,17 @@ fn a_click_presses_the_clicked_side_of_the_tilted_plane() {
assert!(contact.0 < rest.0, "bord gauche {} au repos {}", contact.0, rest.0);
assert!(contact.2 < rest.2, "hauteur droite {} au repos {}", contact.2, rest.2);
assert!(contact.3 > rest.3, "hauteur gauche {} au repos {}", contact.3, rest.3);
+
+ // Sans préset, rien ne bascule : l'écran droit recule au contact, les quatre bords rentrent.
+ let flat_rest = render("none", true, CLICK_S - 0.5);
+ let flat_contact = render("none", true, CLICK_S + 0.0495);
+ let flat_off = render("none", false, CLICK_S + 0.0495);
+ if let Some(dir) = &out_dir {
+ write_ppm(&dir.join("click-flat-contact.ppm"), &flat_contact);
+ }
+ let (rest, contact) = (probe(&flat_rest), probe(&flat_contact));
+ println!("écran droit : repos {rest:?}, contact {contact:?}");
+ assert_eq!(silhouette_diff(&flat_off, &flat_rest), 0, "sans l'option, le clic ne doit rien changer");
+ assert!(contact.0 > rest.0 && contact.1 < rest.1, "bords {contact:?} au repos {rest:?}");
+ assert!(contact.2 < rest.2 && contact.3 < rest.3, "hauteurs {contact:?} au repos {rest:?}");
}
diff --git a/crates/compositor/tests/follow_camera_render.rs b/crates/compositor/tests/follow_camera_render.rs
index 8678a8f87..d1f28e4da 100644
--- a/crates/compositor/tests/follow_camera_render.rs
+++ b/crates/compositor/tests/follow_camera_render.rs
@@ -380,7 +380,7 @@ fn orbit_scene(source: &str, regions: &str, (w, h): (u32, u32)) -> Scene {
"background":{{"kind":"gradient","angleDeg":135,"stops":["#3b4fd1","#c86fa6"]}},
"zoomRegions":[{regions}],
"annotations":[],
- "cursor":{{"show":true,"size":2.2,"smoothing":0,"motionBlur":0,"clickBounce":2.5,"model3d":true,"clipToBounds":false,"theme":"default",
+ "cursor":{{"show":true,"size":2.2,"smoothing":0,"motionBlur":0,"clickBounce":2.5,"model3d":true,"clickImpact":true,"clipToBounds":false,"theme":"default",
"cursorSprites":{{"arrow":{{"path":"{arrow}","hotspotX":0.1205,"hotspotY":0.0881}}}}}},
"cropByClip":[null],
"output":{{"width":{w},"height":{h},"fps":30}}}}"##
@@ -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","clickImpact":true}}"#
+ r#"{{"clipIndex":0,"startSec":{start},"endSec":{end},"scale":{scale},"focusX":0.5,"focusY":0.5,"focusMode":"manual","rotation":"follow-cursor"}}"#
)
}
diff --git a/docs/3d-effects-v2.md b/docs/3d-effects-v2.md
index 771704a22..7694bf9b8 100644
--- a/docs/3d-effects-v2.md
+++ b/docs/3d-effects-v2.md
@@ -25,6 +25,17 @@ deux effets qui partagent un unique budget d'angle dynamique (`DYNAMIC_TILT_BUDG
`rotated_quad_corners_px(w, h, base, dyn)` projette les coins ; l'échelle de containment est
calculée sur la **base seule** (« échelle gelée »), la part dynamique ne fait que reprojeter.
+**L'impact du clic est un réglage du curseur** (`cursor.clickImpact`, « Click impact » dans le
+panneau du curseur, éteint par défaut), pas une option de zoom : il vaut sous **toutes** les
+caméras, dans une région de zoom ou hors d'elle. Chaque caméra le rend à sa façon : l'angle fixe
+bascule du côté cliqué (ci-dessus), la caméra mobile recule l'œil (A.3), et l'écran droit
+**recule** : sa boîte rapetisse autour de son centre de `camera::PRESS` au contact (−3,8 %), sur la
+même courbe `tap()`, puis revient (`frame_geometry::plan_frame`). Pas de bascule depuis l'écran
+droit : elle mettrait des arêtes sur les axes (règle des 2°). Le recul prend le complément de la
+porte des angles fixes (`regions::tilt_gate`) et du poids de la caméra mobile, donc les trois se
+relaient sans saut pendant les transitions. Un document qui portait `clickImpact` sur un zoom
+allume le réglage du curseur à son ouverture (`liftZoomClickImpact`).
+
### A.2 Le modèle : une seule liste « caméra 3D »
**Révisé trois fois après test produit.** La première version séparait l'attitude
@@ -121,8 +132,8 @@ d'azimut (`CAMERA_LIGHT_GAIN`, 0,5 donnait ±10 % avec l'œil en orbite).
**Impact du clic** : l'écran reste immobile, c'est **l'œil qui recule** de 4 % de sa distance au
contact, sur la courbe `tap()` de l'impact des angles fixes (mêmes clics, mêmes portes : fenêtre du
clip, clic visible, masque, vitesse, opacité du curseur), puis revient avec un léger rebond. Sur la
-vidéo, l'écran perd 2 à 3 % de taille pendant deux images : un tapotement, pas un saut. Le panneau
-l'active sous cette caméra, avec sa propre description.
+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
diff --git a/electron/ai-edition/style-preset-service.test.ts b/electron/ai-edition/style-preset-service.test.ts
index aa946b3e3..b7bc7fd56 100644
--- a/electron/ai-edition/style-preset-service.test.ts
+++ b/electron/ai-edition/style-preset-service.test.ts
@@ -33,6 +33,7 @@ const APPEARANCE: StylePresetAppearance = {
clickBounce: 1,
model3d: false,
alwaysArrow: false,
+ clickImpact: false,
},
cursorShow: true,
cursorAutoHide: false,
diff --git a/electron/ipc/nativeBridge.presets.test.ts b/electron/ipc/nativeBridge.presets.test.ts
index e48e420a8..8183140e4 100644
--- a/electron/ipc/nativeBridge.presets.test.ts
+++ b/electron/ipc/nativeBridge.presets.test.ts
@@ -53,6 +53,7 @@ const APPEARANCE: StylePresetAppearance = {
clickBounce: 1,
model3d: false,
alwaysArrow: false,
+ clickImpact: false,
},
cursorShow: true,
cursorAutoHide: false,
diff --git a/src/components/ai-edition/CursorPane.levels.test.tsx b/src/components/ai-edition/CursorPane.levels.test.tsx
index 73fa1ffe4..4d5807260 100644
--- a/src/components/ai-edition/CursorPane.levels.test.tsx
+++ b/src/components/ai-edition/CursorPane.levels.test.tsx
@@ -1,5 +1,5 @@
// @vitest-environment jsdom
-import { cleanup, render, screen } from "@testing-library/react";
+import { cleanup, fireEvent, render, screen } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { I18nProvider } from "@/contexts/I18nContext";
import { LOCALE_STORAGE_KEY } from "@/i18n/config";
@@ -62,3 +62,22 @@ describe("CursorPane size", () => {
expect([slider.min, slider.max, slider.value]).toEqual(["1.5", "6", "4.5"]);
});
});
+
+describe("CursorPane click impact", () => {
+ const toggle = () => screen.queryByRole("button", { name: "Click impact" });
+
+ it("is a project-wide switch, off by default", () => {
+ renderWithCursor({});
+ expect(toggle()?.getAttribute("aria-pressed")).toBe("false");
+ fireEvent.click(toggle() as HTMLElement);
+ expect(useProjectStore.getState().document?.legacyEditor).toMatchObject({
+ cursorClickImpact: true,
+ });
+ });
+
+ // The impact follows the pointer you see: with the cursor hidden it has nothing to show.
+ it("is not offered while the cursor is hidden", () => {
+ renderWithCursor({ cursorShow: false });
+ expect(toggle()).toBeNull();
+ });
+});
diff --git a/src/components/ai-edition/RightPanes.tsx b/src/components/ai-edition/RightPanes.tsx
index 45821a645..de03769a4 100644
--- a/src/components/ai-edition/RightPanes.tsx
+++ b/src/components/ai-edition/RightPanes.tsx
@@ -3702,7 +3702,8 @@ export function CursorPane() {
}}
/>
</div>
- {/* A hidden cursor has nothing to model or restyle, so these rows are not offered then. */}
+ {/* A hidden cursor has nothing to model, restyle or click with, so these rows are not
+ offered then. */}
{settings.cursorShow ? (
<>
<div className={styles.paneRow}>
@@ -3728,6 +3729,15 @@ export function CursorPane() {
onChange={(v) => void set({ cursor: { alwaysArrow: v } })}
/>
</div>
+ <div className={styles.paneRow}>
+ <span className={styles.label}>{ts("cursor.clickImpact")}</span>
+ <Toggle
+ ariaLabel={ts("cursor.clickImpact")}
+ checked={settings.cursor.clickImpact}
+ disabled={!hasDocument}
+ onChange={(v) => void set({ cursor: { clickImpact: v } })}
+ />
+ </div>
</>
) : null}
{/* One option is not a choice: the picker shows once a pack ships beside the
diff --git a/src/components/ai-edition/v4/FloatingInspector.test.tsx b/src/components/ai-edition/v4/FloatingInspector.test.tsx
index 5eb43d45f..e67d28aaf 100644
--- a/src/components/ai-edition/v4/FloatingInspector.test.tsx
+++ b/src/components/ai-edition/v4/FloatingInspector.test.tsx
@@ -25,27 +25,6 @@ vi.mock("../RightPanes", async (importOriginal) => ({
CursorPane: () => <div data-testid="cursor-pane">CursorPane</div>,
LayoutPane: () => <div data-testid="layout-pane">LayoutPane</div>,
SliderCell: () => <div data-testid="slider-cell">SliderCell</div>,
- // The real switch contract (a button carrying aria-pressed), so the click-impact tests below
- // can find, read and press it.
- Toggle: ({
- checked,
- disabled,
- ariaLabel,
- onChange,
- }: {
- checked: boolean;
- disabled?: boolean;
- ariaLabel?: string;
- onChange: (next: boolean) => void;
- }) => (
- <button
- type="button"
- aria-pressed={checked}
- aria-label={ariaLabel}
- disabled={disabled}
- onClick={() => onChange(!checked)}
- />
- ),
TranscriptPane: () => <div data-testid="transcript-pane">TranscriptPane</div>,
VideoEffectsPane: () => <div data-testid="effects-pane">VideoEffectsPane</div>,
}));
@@ -124,55 +103,6 @@ describe("FloatingInspector", () => {
expect(clearSelection).toHaveBeenCalledTimes(1);
});
- describe("click impact toggle", () => {
- const zoomTl = (region: Record<string, unknown>) => {
- const updateZoomClickImpact = vi.fn();
- const tl = {
- ...defaultProps.tl,
- selection: { kind: "zoom", id: "z" },
- zoomRegions: [
- { id: "z", startMs: 0, endMs: 1000, depth: 3, focus: { cx: 0.5, cy: 0.5 }, ...region },
- ],
- updateZoomClickImpact,
- } as unknown as React.ComponentProps<typeof FloatingInspector>["tl"];
- return { tl, updateZoomClickImpact };
- };
-
- const toggle = () => screen.queryByRole("button", { name: "settings.zoom.clickImpact.title" });
-
- it("is not offered without a 3D preset", () => {
- const { tl } = zoomTl({});
- render(<FloatingInspector {...defaultProps} tl={tl} />);
- expect(toggle()).toBeNull();
- });
-
- it("is not offered when the region hides the cursor", () => {
- const { tl } = zoomTl({ rotationPreset: "left", hideCursor: true });
- render(<FloatingInspector {...defaultProps} tl={tl} />);
- expect(toggle()).toBeNull();
- });
-
- it("is not offered when the cursor is hidden globally", () => {
- editorSettings.cursorShow = false;
- try {
- const { tl } = zoomTl({ rotationPreset: "left" });
- render(<FloatingInspector {...defaultProps} tl={tl} />);
- expect(toggle()).toBeNull();
- } finally {
- editorSettings.cursorShow = true;
- }
- });
-
- it("toggles the region's clickImpact under a 3D preset, off by default", () => {
- const { tl, updateZoomClickImpact } = zoomTl({ rotationPreset: "follow-cursor" });
- render(<FloatingInspector {...defaultProps} tl={tl} />);
- const box = toggle();
- expect(box).toHaveAttribute("aria-pressed", "false");
- fireEvent.click(box as HTMLElement);
- expect(updateZoomClickImpact).toHaveBeenCalledWith("z", true);
- });
- });
-
describe("annotation pane", () => {
const text = {
id: "a",
diff --git a/src/components/ai-edition/v4/FloatingInspector.tsx b/src/components/ai-edition/v4/FloatingInspector.tsx
index 9e93869b1..be312afbc 100644
--- a/src/components/ai-edition/v4/FloatingInspector.tsx
+++ b/src/components/ai-edition/v4/FloatingInspector.tsx
@@ -70,7 +70,6 @@ import {
CursorPane,
LayoutPane,
SliderCell,
- Toggle,
TranscriptPane,
VideoEffectsPane,
} from "../RightPanes";
@@ -858,20 +857,6 @@ function SelectionPane({ tl, onClose }: { tl: TimelineApi; onClose: () => void }
cameraLabel(region.rotationPreset ?? "off"),
)}
</div>
- {
- // The click follows the visible pointer: without a preset, or with the cursor
- // hidden, the switch would move nothing, so it is not offered.
- region.rotationPreset && settings.cursorShow && !region.hideCursor
- ? paneRow(
- ts("zoom.clickImpact.title"),
- <Toggle
- checked={region.clickImpact === true}
- ariaLabel={ts("zoom.clickImpact.title")}
- onChange={(on) => void tl.updateZoomClickImpact(region.id, on)}
- />,
- )
- : null
- }
{paneStack(
ts("zoom.focusMode.title"),
// While the global toggle is on it OVERRIDES every region, so the control shows
diff --git a/src/components/video-editor/editorDefaults.ts b/src/components/video-editor/editorDefaults.ts
index 299dada30..e1b770597 100644
--- a/src/components/video-editor/editorDefaults.ts
+++ b/src/components/video-editor/editorDefaults.ts
@@ -83,6 +83,7 @@ export const DEFAULT_CURSOR_SETTINGS: CursorVisualSettings & { show: boolean; th
clickBounce: DEFAULT_CURSOR_CLICK_BOUNCE,
model3d: DEFAULT_CURSOR_MODEL3D,
alwaysArrow: false,
+ clickImpact: false,
theme: DEFAULT_CURSOR_THEME_ID,
};
diff --git a/src/components/video-editor/projectPersistence.test.ts b/src/components/video-editor/projectPersistence.test.ts
index f976995b2..34e3e7a84 100644
--- a/src/components/video-editor/projectPersistence.test.ts
+++ b/src/components/video-editor/projectPersistence.test.ts
@@ -205,20 +205,6 @@ describe("projectPersistence media compatibility", () => {
expect(editor.annotationRegions[1].blurData?.blockSize).toBe(4);
});
- it("keeps clickImpact only when it is exactly true", () => {
- const zoom = { startMs: 0, endMs: 1000, depth: 3 as const, focus: { cx: 0.5, cy: 0.5 } };
- const [on, off, junk] = normalizeProjectEditor({
- zoomRegions: [
- { ...zoom, id: "on", rotationPreset: "left", clickImpact: true },
- { ...zoom, id: "off" },
- { ...zoom, id: "junk", clickImpact: "yes" as never },
- ],
- }).zoomRegions;
- expect(on.clickImpact).toBe(true);
- expect("clickImpact" in off).toBe(false);
- expect("clickImpact" in junk).toBe(false);
- });
-
it("reads the retired iso camera as Left, which kept its look", () => {
const zoom = { startMs: 0, endMs: 1000, depth: 3 as const, focus: { cx: 0.5, cy: 0.5 } };
const [iso, unknown] = normalizeProjectEditor({
diff --git a/src/components/video-editor/projectPersistence.ts b/src/components/video-editor/projectPersistence.ts
index 3bef10b14..233c7d848 100644
--- a/src/components/video-editor/projectPersistence.ts
+++ b/src/components/video-editor/projectPersistence.ts
@@ -293,7 +293,6 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Pro
focusMode: region.focusMode === "auto" ? "auto" : "manual",
source: region.source === "auto" ? "auto" : "manual",
...(validPreset ? { rotationPreset: validPreset } : {}),
- ...(region.clickImpact === true ? { clickImpact: true as const } : {}),
};
})
: [];
diff --git a/src/components/video-editor/types.ts b/src/components/video-editor/types.ts
index 448437b2c..0d4bbb298 100644
--- a/src/components/video-editor/types.ts
+++ b/src/components/video-editor/types.ts
@@ -161,8 +161,6 @@ export interface ZoomRegion {
source?: ZoomRegionSource;
/** When true, cursor is hidden during this zoom region. */
hideCursor?: boolean;
- /** When true, each click presses the tilted plane, or recoils the `follow-cursor` camera (needs a `rotationPreset`). Omitted when off. */
- clickImpact?: true;
}
export function getRotation3D(region: Pick<ZoomRegion, "rotationPreset">): Rotation3D {
@@ -289,6 +287,12 @@ export interface CursorVisualSettings {
model3d: boolean;
/** Draws every cursor state (text, hand, resize…) with the theme's arrow sprite. */
alwaysArrow: boolean;
+ /**
+ * Each click gives the screen an impact, whatever the zoom's camera: a fixed angle rocks the
+ * tilted screen toward the clicked side, the moving camera recoils, a flat screen is pushed
+ * back (`frame_geometry::plan_frame`).
+ */
+ clickImpact: boolean;
autoHide?: boolean;
}
diff --git a/src/i18n/locales/ar/settings.json b/src/i18n/locales/ar/settings.json
index 3225530d5..aebebe17d 100644
--- a/src/i18n/locales/ar/settings.json
+++ b/src/i18n/locales/ar/settings.json
@@ -371,9 +371,6 @@
"followCursor": "يدور مع المؤشر"
}
},
- "clickImpact": {
- "title": "أثر النقر"
- },
"level": "مستوى التكبير",
"previewHold": "اضغط مع الاستمرار لمعاينة تأثير التكبير",
"customScale": "تكبير مخصص",
@@ -408,6 +405,7 @@
"smoothing": "التنعيم",
"clickBounce": "ارتداد النقر",
"model3d": "مؤشر ثلاثي الأبعاد",
+ "clickImpact": "أثر النقر",
"help": "عرض المؤشر اعتمادًا على بيانات التتبع المسجّلة: السمة، والحجم، والتنعيم، وضبابية الحركة، وارتداد النقر.",
"size": "الحجم",
"title": "المؤشر",
diff --git a/src/i18n/locales/cs/settings.json b/src/i18n/locales/cs/settings.json
index 0b953d38e..0f4e42b9d 100644
--- a/src/i18n/locales/cs/settings.json
+++ b/src/i18n/locales/cs/settings.json
@@ -371,9 +371,6 @@
"followCursor": "Obíhá s kurzorem"
}
},
- "clickImpact": {
- "title": "Odezva kliknutí"
- },
"level": "Úroveň přiblížení",
"previewHold": "Podržte pro náhled efektu přiblížení",
"customScale": "Vlastní přiblížení",
@@ -408,6 +405,7 @@
"smoothing": "Vyhlazení",
"clickBounce": "Odraz při kliknutí",
"model3d": "3D kurzor",
+ "clickImpact": "Odezva kliknutí",
"help": "Renderování kurzoru ze zaznamenané telemetrie: motiv, velikost, vyhlazení, pohybové rozmazání a zdůraznění odrazu při kliknutí.",
"size": "Velikost",
"title": "Kurzor",
diff --git a/src/i18n/locales/de/settings.json b/src/i18n/locales/de/settings.json
index 2ae53aed4..c56c8cb40 100644
--- a/src/i18n/locales/de/settings.json
+++ b/src/i18n/locales/de/settings.json
@@ -371,9 +371,6 @@
"followCursor": "Kreist mit dem Cursor"
}
},
- "clickImpact": {
- "title": "Klick-Impuls"
- },
"level": "Zoomstufe",
"previewHold": "Gedrückt halten für die Zoom-Vorschau",
"customScale": "Eigener Zoom",
@@ -408,6 +405,7 @@
"smoothing": "Glättung",
"clickBounce": "Klick-Federung",
"model3d": "3D-Cursor",
+ "clickImpact": "Klick-Impuls",
"help": "Cursor-Darstellung aus der aufgezeichneten Telemetrie: Stil, Größe, Glättung, Bewegungsunschärfe und Klick-Federung.",
"size": "Größe",
"title": "Cursor",
diff --git a/src/i18n/locales/en/settings.json b/src/i18n/locales/en/settings.json
index 31085ce3f..10d5a2681 100644
--- a/src/i18n/locales/en/settings.json
+++ b/src/i18n/locales/en/settings.json
@@ -371,9 +371,6 @@
"followCursor": "Orbits with the cursor"
}
},
- "clickImpact": {
- "title": "Click impact"
- },
"level": "Zoom level",
"previewHold": "Hold to preview zoom effect",
"customScale": "Custom zoom",
@@ -408,6 +405,7 @@
"smoothing": "Smoothing",
"clickBounce": "Click bounce",
"model3d": "3D cursor",
+ "clickImpact": "Click impact",
"help": "How the recorded cursor is drawn: style, size, smoothing, motion blur and click bounce.",
"size": "Size",
"title": "Cursor",
diff --git a/src/i18n/locales/es/settings.json b/src/i18n/locales/es/settings.json
index b22b8eaf5..224541210 100644
--- a/src/i18n/locales/es/settings.json
+++ b/src/i18n/locales/es/settings.json
@@ -371,9 +371,6 @@
"followCursor": "Gira con el cursor"
}
},
- "clickImpact": {
- "title": "Impacto del clic"
- },
"level": "Nivel de zoom",
"previewHold": "Mantener para previsualizar el efecto de zoom",
"customScale": "Zoom personalizado",
@@ -408,6 +405,7 @@
"smoothing": "Suavizado",
"clickBounce": "Rebote al clic",
"model3d": "Cursor 3D",
+ "clickImpact": "Impacto del clic",
"help": "Representación del cursor a partir de la telemetría grabada: tema, tamaño, suavizado, desenfoque de movimiento y rebote al hacer clic.",
"size": "Tamaño",
"title": "Cursor",
diff --git a/src/i18n/locales/fr/settings.json b/src/i18n/locales/fr/settings.json
index d42d331d1..e05d59a74 100644
--- a/src/i18n/locales/fr/settings.json
+++ b/src/i18n/locales/fr/settings.json
@@ -371,9 +371,6 @@
"followCursor": "Tourne avec le curseur"
}
},
- "clickImpact": {
- "title": "Impact du clic"
- },
"level": "Niveau de zoom",
"previewHold": "Maintenir pour prévisualiser l'effet de zoom",
"customScale": "Zoom personnalisé",
@@ -408,6 +405,7 @@
"smoothing": "Lissage",
"clickBounce": "Rebond au clic",
"model3d": "Curseur 3D",
+ "clickImpact": "Impact du clic",
"help": "Rendu du curseur à partir de la télémétrie enregistrée : thème, taille, lissage, flou de mouvement et rebond au clic.",
"size": "Taille",
"title": "Curseur",
diff --git a/src/i18n/locales/it/settings.json b/src/i18n/locales/it/settings.json
index a4acb69b0..7a931f1e6 100644
--- a/src/i18n/locales/it/settings.json
+++ b/src/i18n/locales/it/settings.json
@@ -371,9 +371,6 @@
"followCursor": "Ruota con il cursore"
}
},
- "clickImpact": {
- "title": "Impatto del clic"
- },
"level": "Livello zoom",
"previewHold": "Tieni premuto per vedere l'anteprima dell'effetto zoom",
"customScale": "Zoom personalizzato",
@@ -408,6 +405,7 @@
"smoothing": "Smussatura",
"clickBounce": "Rimbalzo clic",
"model3d": "Cursore 3D",
+ "clickImpact": "Impatto del clic",
"help": "Resa del cursore dalla telemetria registrata: tema, dimensione, smussatura, sfocatura di movimento e rimbalzo al clic.",
"size": "Dimensione",
"title": "Cursore",
diff --git a/src/i18n/locales/ja-JP/settings.json b/src/i18n/locales/ja-JP/settings.json
index cdfa2ab17..d0a0578e1 100644
--- a/src/i18n/locales/ja-JP/settings.json
+++ b/src/i18n/locales/ja-JP/settings.json
@@ -371,9 +371,6 @@
"followCursor": "カーソルに合わせて回り込む"
}
},
- "clickImpact": {
- "title": "クリックの押し込み"
- },
"level": "ズーム倍率",
"previewHold": "押している間ズーム効果をプレビュー",
"customScale": "カスタムズーム",
@@ -408,6 +405,7 @@
"smoothing": "スムージング",
"clickBounce": "クリックバウンス",
"model3d": "3D カーソル",
+ "clickImpact": "クリックの押し込み",
"help": "記録されたテレメトリからのカーソル描画: テーマ、サイズ、スムージング、モーションブラー、クリック時のバウンス。",
"size": "サイズ",
"title": "カーソル",
diff --git a/src/i18n/locales/ko-KR/settings.json b/src/i18n/locales/ko-KR/settings.json
index 110a2d4c8..10156b5b2 100644
--- a/src/i18n/locales/ko-KR/settings.json
+++ b/src/i18n/locales/ko-KR/settings.json
@@ -371,9 +371,6 @@
"followCursor": "커서를 따라 회전"
}
},
- "clickImpact": {
- "title": "클릭 눌림"
- },
"level": "줌 레벨",
"previewHold": "누르고 있으면 줌 효과 미리보기",
"customScale": "커스텀 줌",
@@ -408,6 +405,7 @@
"smoothing": "부드러움",
"clickBounce": "클릭 바운스",
"model3d": "3D 커서",
+ "clickImpact": "클릭 눌림",
"help": "기록된 텔레메트리를 기반으로 한 커서 렌더링: 테마, 크기, 스무딩, 모션 블러, 클릭 바운스.",
"size": "크기",
"title": "커서",
diff --git a/src/i18n/locales/pt-BR/settings.json b/src/i18n/locales/pt-BR/settings.json
index 8d0010fcd..9274b124c 100644
--- a/src/i18n/locales/pt-BR/settings.json
+++ b/src/i18n/locales/pt-BR/settings.json
@@ -371,9 +371,6 @@
"followCursor": "Gira com o cursor"
}
},
- "clickImpact": {
- "title": "Impacto do clique"
- },
"level": "Nível de Zoom",
"previewHold": "Mantenha pressionado para pré-visualizar o efeito de zoom",
"customScale": "Zoom Personalizado",
@@ -408,6 +405,7 @@
"smoothing": "Suavização",
"clickBounce": "Rebote ao clicar",
"model3d": "Cursor 3D",
+ "clickImpact": "Impacto do clique",
"help": "Renderização do cursor a partir da telemetria gravada: tema, tamanho, suavização, desfoque de movimento e salto ao clicar.",
"size": "Tamanho",
"title": "Cursor",
diff --git a/src/i18n/locales/ru/settings.json b/src/i18n/locales/ru/settings.json
index ec99302b6..ec697e81d 100644
--- a/src/i18n/locales/ru/settings.json
+++ b/src/i18n/locales/ru/settings.json
@@ -371,9 +371,6 @@
"followCursor": "Облетает за курсором"
}
},
- "clickImpact": {
- "title": "Отклик на клик"
- },
"level": "Уровень масштабирования",
"previewHold": "Удерживайте для предпросмотра эффекта зума",
"customScale": "Пользовательский масштаб",
@@ -408,6 +405,7 @@
"smoothing": "Сглаживание",
"clickBounce": "Отскок при клике",
"model3d": "3D-курсор",
+ "clickImpact": "Отклик на клик",
"help": "Отрисовка курсора по записанной телеметрии: тема, размер, сглаживание, размытие движения и отскок при клике.",
"size": "Размер",
"title": "Курсор",
diff --git a/src/i18n/locales/tr/settings.json b/src/i18n/locales/tr/settings.json
index 2e2fa3ec5..87db90eee 100644
--- a/src/i18n/locales/tr/settings.json
+++ b/src/i18n/locales/tr/settings.json
@@ -371,9 +371,6 @@
"followCursor": "İmleçle birlikte döner"
}
},
- "clickImpact": {
- "title": "Tıklama etkisi"
- },
"level": "Yakınlaştırma Seviyesi",
"previewHold": "Yakınlaştırma efektini önizlemek için basılı tutun",
"customScale": "Özel Yakınlaştırma",
@@ -408,6 +405,7 @@
"smoothing": "Yumuşatma",
"clickBounce": "Tıklama Sıçraması",
"model3d": "3B imleç",
+ "clickImpact": "Tıklama etkisi",
"help": "Kaydedilen telemetriden imleç çizimi: tema, boyut, yumuşatma, hareket bulanıklığı ve tıklama sıçraması.",
"size": "Boyut",
"title": "İmleç",
diff --git a/src/i18n/locales/vi/settings.json b/src/i18n/locales/vi/settings.json
index 0ae2421fe..f672f1be6 100644
--- a/src/i18n/locales/vi/settings.json
+++ b/src/i18n/locales/vi/settings.json
@@ -371,9 +371,6 @@
"followCursor": "Xoay quanh theo con trỏ"
}
},
- "clickImpact": {
- "title": "Hiệu ứng nhấp"
- },
"level": "Mức độ thu phóng",
"previewHold": "Giữ để xem trước hiệu ứng phóng to",
"customScale": "Thu phóng tùy chỉnh",
@@ -408,6 +405,7 @@
"smoothing": "Làm mượt",
"clickBounce": "Nảy khi nhấp",
"model3d": "Con trỏ 3D",
+ "clickImpact": "Hiệu ứng nhấp",
"help": "Cách vẽ con trỏ từ dữ liệu đã ghi: chủ đề, kích thước, làm mượt, mờ chuyển động và hiệu ứng nảy khi nhấp.",
"size": "Kích thước",
"title": "Con trỏ",
diff --git a/src/i18n/locales/zh-CN/settings.json b/src/i18n/locales/zh-CN/settings.json
index bcaefd1c2..0f52d11c0 100644
--- a/src/i18n/locales/zh-CN/settings.json
+++ b/src/i18n/locales/zh-CN/settings.json
@@ -371,9 +371,6 @@
"followCursor": "随光标环绕"
}
},
- "clickImpact": {
- "title": "点击按压"
- },
"level": "缩放级别",
"previewHold": "按住预览放大效果",
"customScale": "自定义缩放",
@@ -408,6 +405,7 @@
"smoothing": "平滑",
"clickBounce": "点击弹跳",
"model3d": "3D 光标",
+ "clickImpact": "点击按压",
"help": "基于录制遥测数据的光标渲染:主题、大小、平滑、运动模糊和点击回弹。",
"size": "大小",
"title": "光标",
diff --git a/src/i18n/locales/zh-TW/settings.json b/src/i18n/locales/zh-TW/settings.json
index 4db6a6596..bc7319a96 100644
--- a/src/i18n/locales/zh-TW/settings.json
+++ b/src/i18n/locales/zh-TW/settings.json
@@ -371,9 +371,6 @@
"followCursor": "隨游標環繞"
}
},
- "clickImpact": {
- "title": "點擊按壓"
- },
"level": "縮放級別",
"previewHold": "按住預覽放大效果",
"customScale": "自訂縮放",
@@ -408,6 +405,7 @@
"smoothing": "平滑",
"clickBounce": "點擊彈跳",
"model3d": "3D 游標",
+ "clickImpact": "點擊按壓",
"help": "根據錄製的遙測資料繪製游標:主題、大小、平滑、動態模糊與點擊回彈。",
"size": "大小",
"title": "游標",
diff --git a/src/lib/ai-edition/document/migrate.test.ts b/src/lib/ai-edition/document/migrate.test.ts
index 5168e7e6a..d0f7f8092 100644
--- a/src/lib/ai-edition/document/migrate.test.ts
+++ b/src/lib/ai-edition/document/migrate.test.ts
@@ -114,7 +114,6 @@ describe("migrateProjectDataToAxcutDocument", () => {
customScale: 2.5,
source: "manual",
hideCursor: true,
- clickImpact: true,
},
],
},
@@ -131,7 +130,6 @@ describe("migrateProjectDataToAxcutDocument", () => {
// `iso`, retired, reads as Left: the angle that kept its look.
expect(z.rotationPreset).toBe("left");
expect(z.hideCursor).toBe(true);
- expect(z.clickImpact).toBe(true);
});
it("converts annotationRegions to seconds with type and content preserved", () => {
@@ -373,7 +371,6 @@ describe("migrateAxcutDocumentToProjectData", () => {
depth: 4,
focus: { cx: 0.5, cy: 0.5 },
hideCursor: true,
- clickImpact: true,
},
{ id: "z_2", startMs: 3000, endMs: 4000, depth: 2, focus: { cx: 0.5, cy: 0.5 } },
],
@@ -406,9 +403,6 @@ describe("migrateAxcutDocumentToProjectData", () => {
expect(back.editor.zoomRegions[0].startMs).toBe(0);
expect(back.editor.zoomRegions[0].endMs).toBe(2000);
expect(back.editor.zoomRegions[0].hideCursor).toBe(true);
- expect(back.editor.zoomRegions[0].clickImpact).toBe(true);
- expect("clickImpact" in back.editor.zoomRegions[1]).toBe(false);
- expect("clickImpact" in doc.zoomRanges[1]).toBe(false);
expect(back.editor.annotationRegions[0].startMs).toBe(1000);
expect(back.editor.annotationRegions[0].endMs).toBe(3000);
});
diff --git a/src/lib/ai-edition/document/migrate.ts b/src/lib/ai-edition/document/migrate.ts
index 6a32d52ab..cb7516660 100644
--- a/src/lib/ai-edition/document/migrate.ts
+++ b/src/lib/ai-edition/document/migrate.ts
@@ -221,7 +221,6 @@ export function migrateProjectDataToAxcutDocument(
...(typeof region.customScale === "number" ? { customScale: region.customScale } : {}),
...(region.source === "auto" || region.source === "manual" ? { source: region.source } : {}),
...(region.hideCursor ? { hideCursor: true } : {}),
- ...(region.clickImpact === true ? { clickImpact: true as const } : {}),
}));
const migratedAnnotations: AxcutAnnotationRegion[] = annotationRegions
@@ -360,7 +359,6 @@ export function migrateAxcutDocumentToProjectData(input: AxcutDocument): EditorP
...(typeof region.customScale === "number" ? { customScale: region.customScale } : {}),
...(region.source ? { source: region.source } : {}),
...(region.hideCursor ? { hideCursor: true } : {}),
- ...(region.clickImpact ? { clickImpact: true as const } : {}),
}));
editor.zoomRegions = reverseZoomRegions;
diff --git a/src/lib/ai-edition/schema/index.test.ts b/src/lib/ai-edition/schema/index.test.ts
index ace20ecf8..bf1f0e5f1 100644
--- a/src/lib/ai-edition/schema/index.test.ts
+++ b/src/lib/ai-edition/schema/index.test.ts
@@ -1156,3 +1156,37 @@ describe("v7 -> v8 default ratio pin", () => {
expect(fresh.legacyEditor).toBeNull();
});
});
+
+describe("zoom click impact lifted to the cursor setting", () => {
+ const doc = (zoomRanges: unknown[], legacyEditor: Record<string, unknown> | null = null) => ({
+ ...createEmptyDocument({ projectId: "p", title: "t" }),
+ zoomRanges,
+ legacyEditor,
+ });
+ const zoom = (extra: Record<string, unknown> = {}) => ({
+ id: "z",
+ startMs: 0,
+ endMs: 1000,
+ depth: 3,
+ focus: { cx: 0.5, cy: 0.5 },
+ rotationPreset: "left",
+ ...extra,
+ });
+ const load = (raw: unknown) => documentSchema.parse(migrateRawDocumentToCurrent(raw));
+
+ it("turns the cursor setting on when any zoom had it, and drops the zoom's key", () => {
+ const out = load(doc([zoom(), zoom({ id: "y", clickImpact: true })], { padding: 20 }));
+ expect(out.legacyEditor).toEqual({ padding: 20, cursorClickImpact: true });
+ expect(out.zoomRanges.every((z) => !("clickImpact" in z))).toBe(true);
+ });
+
+ it("keeps a cursor setting the document already states", () => {
+ const out = load(doc([zoom({ clickImpact: true })], { cursorClickImpact: false }));
+ expect(out.legacyEditor).toEqual({ cursorClickImpact: false });
+ });
+
+ it("leaves a document without it untouched", () => {
+ const raw = doc([zoom()]);
+ expect(migrateRawDocumentToCurrent(raw)).toBe(raw);
+ });
+});
diff --git a/src/lib/ai-edition/schema/index.ts b/src/lib/ai-edition/schema/index.ts
index 844ed8e90..ba07f7b59 100644
--- a/src/lib/ai-edition/schema/index.ts
+++ b/src/lib/ai-edition/schema/index.ts
@@ -515,10 +515,6 @@ export const zoomRegionSchema = endGteStart(
customScale: z.number().positive().optional(),
source: z.enum(["auto", "manual"]).optional(),
hideCursor: z.boolean().optional(),
- /** Each click gives an impact: a fixed-angle `rotationPreset` presses the tilted plane
- * toward the clicked side, `follow-cursor` recoils the camera. Needs a `rotationPreset`;
- * omitted (never `false`) when off. */
- clickImpact: z.literal(true).optional(),
}),
"endMs",
"startMs",
@@ -1026,12 +1022,43 @@ function raiseInvertedTranscriptEnds(raw: unknown): unknown {
return repaired ? { ...doc, transcript, transcripts } : raw;
}
+/**
+ * Carry a zoom's click impact over to the cursor setting it became.
+ *
+ * Builds up to v1.13.0 stored `clickImpact` on each zoom range, and only a 3D camera used it.
+ * It is now a cursor setting (`legacyEditor.cursorClickImpact`) that acts under every camera,
+ * and the zoom range schema no longer has the key, so the parse would drop it silently. A
+ * document that turned it on for any zoom keeps it on, now for the whole project; one that
+ * never did, or already stores the cursor setting, comes back untouched.
+ *
+ * No `schemaVersion` bump, like `dropAudioAnchoredTrims`. Runs on RAW, untrusted input, so
+ * every read is guarded.
+ */
+function liftZoomClickImpact(raw: unknown): unknown {
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return raw;
+ const doc = raw as Record<string, unknown>;
+ const zooms = Array.isArray(doc.zoomRanges) ? doc.zoomRanges : [];
+ const on = zooms.some(
+ (zoom) =>
+ zoom && typeof zoom === "object" && (zoom as Record<string, unknown>).clickImpact === true,
+ );
+ if (!on) return raw;
+ const legacy =
+ doc.legacyEditor && typeof doc.legacyEditor === "object" && !Array.isArray(doc.legacyEditor)
+ ? (doc.legacyEditor as Record<string, unknown>)
+ : null;
+ if (typeof legacy?.cursorClickImpact === "boolean") return raw;
+ return { ...doc, legacyEditor: { ...legacy, cursorClickImpact: true } };
+}
+
export function migrateRawDocumentToCurrent(raw: unknown): unknown {
return raiseInvertedTranscriptEnds(
dropAudioAnchoredTrims(
- upgradeV7DocumentToV8(
- upgradeV6DocumentToV7(
- upgradeV5DocumentToV6(upgradeV4DocumentToV5(upgradeV3DocumentToV4(raw))),
+ liftZoomClickImpact(
+ upgradeV7DocumentToV8(
+ upgradeV6DocumentToV7(
+ upgradeV5DocumentToV6(upgradeV4DocumentToV5(upgradeV3DocumentToV4(raw))),
+ ),
),
),
),
diff --git a/src/lib/ai-edition/store/editorSettings.test.ts b/src/lib/ai-edition/store/editorSettings.test.ts
index effa44e44..5371fd362 100644
--- a/src/lib/ai-edition/store/editorSettings.test.ts
+++ b/src/lib/ai-edition/store/editorSettings.test.ts
@@ -176,6 +176,14 @@ describe("patchEditorSettings", () => {
expect(on.cursor.size).toBe(2);
});
+ it("switches the click impact without clobbering its siblings, off by default", () => {
+ expect(getEditorSettings(baseDoc).cursor.clickImpact).toBe(false);
+ const seed = patchEditorSettings(baseDoc, { cursor: { size: 2 } });
+ const next = patchEditorSettings(seed, { cursor: { clickImpact: true } });
+ expect(next.legacyEditor).toMatchObject({ cursorClickImpact: true, cursorSize: 2 });
+ expect(getEditorSettings(next).cursor.clickImpact).toBe(true);
+ });
+
it("toggles cursorAutoHide on and off via patch", () => {
const enabled = patchEditorSettings(baseDoc, { cursorAutoHide: true });
expect(getEditorSettings(enabled).cursorAutoHide).toBe(true);
diff --git a/src/lib/ai-edition/store/editorSettings.ts b/src/lib/ai-edition/store/editorSettings.ts
index dd5f14d69..c4d4b9dd3 100644
--- a/src/lib/ai-edition/store/editorSettings.ts
+++ b/src/lib/ai-edition/store/editorSettings.ts
@@ -182,6 +182,7 @@ interface LegacyShape {
cursorClickBounce?: number;
cursorModel3d?: boolean;
cursorAlwaysArrow?: boolean;
+ cursorClickImpact?: boolean;
cursorShow?: boolean;
cursorAutoHide?: boolean;
cursorTheme?: string;
@@ -226,6 +227,7 @@ export function getEditorSettings(doc: AxcutDocument | null | undefined): Editor
// Absent in every project saved before the setting existed: those keep the flat cursor.
model3d: bool(legacy?.cursorModel3d, DEFAULT_EDITOR_SETTINGS.cursor.model3d),
alwaysArrow: bool(legacy?.cursorAlwaysArrow, DEFAULT_EDITOR_SETTINGS.cursor.alwaysArrow),
+ clickImpact: bool(legacy?.cursorClickImpact, DEFAULT_EDITOR_SETTINGS.cursor.clickImpact),
autoHide: bool(legacy?.cursorAutoHide, DEFAULT_EDITOR_SETTINGS.cursorAutoHide),
};
@@ -374,6 +376,7 @@ function nextLegacy(current: LegacyShape | null, patch: EditorSettingsPatch): Le
if (c.clickBounce !== undefined) next.cursorClickBounce = c.clickBounce;
if (c.model3d !== undefined) next.cursorModel3d = c.model3d;
if (c.alwaysArrow !== undefined) next.cursorAlwaysArrow = c.alwaysArrow;
+ if (c.clickImpact !== undefined) next.cursorClickImpact = c.clickImpact;
if (c.theme !== undefined) next.cursorTheme = c.theme;
if (c.show !== undefined) next.cursorShow = c.show;
if (c.autoHide !== undefined) next.cursorAutoHide = c.autoHide;
diff --git a/src/lib/ai-edition/store/useTimeline.test.ts b/src/lib/ai-edition/store/useTimeline.test.ts
index 27eb35f9c..d5aaf58bc 100644
--- a/src/lib/ai-edition/store/useTimeline.test.ts
+++ b/src/lib/ai-edition/store/useTimeline.test.ts
@@ -841,19 +841,6 @@ describe("useTimeline zoom modifiers (rotation + focus mode)", () => {
expect(useProjectStore.getState().document?.zoomRanges[0].hideCursor).toBeUndefined();
});
- it("updates clickImpact on a zoom region and drops the key when off", async () => {
- const { result } = renderTimeline();
- await act(async () => {
- await result.current.updateZoomClickImpact("zoom_a", true);
- });
- expect(useProjectStore.getState().document?.zoomRanges[0].clickImpact).toBe(true);
-
- await act(async () => {
- await result.current.updateZoomClickImpact("zoom_a", false);
- });
- expect(useProjectStore.getState().document?.zoomRanges[0].clickImpact).toBeUndefined();
- });
-
it("rolls a live focus edit back when its commit cannot be saved", async () => {
bridgeMocks.save.mockResolvedValueOnce({ success: false, error: "project file locked" });
const { result } = renderTimeline();
@@ -1288,31 +1275,6 @@ describe("useTimeline undo history", () => {
});
});
- // Rebase compatibility (#694 × current main): `updateZoomClickImpact` joined the zoom pane
- // after this PR was authored, as one more one-field whole-document writer. While a level
- // write is still pending, a click-impact toggle built from the render's document would
- // rebuild the pill from the stale pre-level document — and whichever save landed last won,
- // so the pending level could come back off. Click impact must share the zoom chain so both
- // values survive.
- it("keeps a pending zoom level when click impact toggles before it lands", async () => {
- seed(docWithZoom);
- const gate = gateFirstSave();
- const { result } = renderTimeline();
-
- const pDepth = result.current.updateZoomDepth("zoom_a", 4);
- const pImpact = result.current.updateZoomClickImpact("zoom_a", true);
- await waitFor(() => expect(gate.release).toEqual(expect.any(Function)));
- await act(async () => {
- gate.release?.();
- await Promise.all([pDepth, pImpact]);
- });
-
- expect(useProjectStore.getState().document?.zoomRanges[0]).toMatchObject({
- depth: 4,
- clickImpact: true,
- });
- });
-
// A resize built its save from the render's document, outside the zoom chain: whichever of
// the two saves landed last put the other's field back.
it("keeps a pending zoom level when the pill is resized before it lands", async () => {
diff --git a/src/lib/ai-edition/store/useTimeline.ts b/src/lib/ai-edition/store/useTimeline.ts
index c31483a28..3f7c1e457 100644
--- a/src/lib/ai-edition/store/useTimeline.ts
+++ b/src/lib/ai-edition/store/useTimeline.ts
@@ -655,7 +655,7 @@ export function useTimeline() {
});
// Every whole-document write to one zoom goes through this chain: the pane's one-field
- // writes (level, 3D tilt, focus mode, cursor, click impact), a pill's span, and the focus
+ // writes (level, 3D tilt, focus mode, cursor), a pill's span, and the focus
// commit. `write` runs INSIDE the chain, on the document the previous zoom write left, and
// returns its `saveDocument`. The level buttons step while the previous save is still out,
// and 3 -> 4 -> 5 built both saves from the render's depth-3 document: the main process does
@@ -916,16 +916,6 @@ export function useTimeline() {
[saveZoomPatch],
);
- // Per-region, like the preset it animates. `undefined` rather than `false` so the document
- // keeps omitting the key when the option is off. Shares `saveZoomPatch` with the pane's
- // other one-field writes: a toggle arriving while a level write is still pending must not
- // rebuild the pill from the stale pre-level document and drop the level on the floor.
- const updateZoomClickImpact = useCallback(
- (id: string, clickImpact: boolean) =>
- saveZoomPatch(id, { clickImpact: clickImpact ? true : undefined }),
- [saveZoomPatch],
- );
-
const updateAnnotationSpan = useCallback(
async (id: string, startMs: number, endMs: number) => {
if (!document) return;
@@ -1671,7 +1661,6 @@ export function useTimeline() {
updateZoomRotation,
updateZoomFocusMode,
updateZoomHideCursor,
- updateZoomClickImpact,
updateAnnotationSpan,
updateAnnotationLive,
commitAnnotationChange,
diff --git a/src/lib/ai-edition/stylePresets.test.ts b/src/lib/ai-edition/stylePresets.test.ts
index adc3a5938..4f5f8b3b0 100644
--- a/src/lib/ai-edition/stylePresets.test.ts
+++ b/src/lib/ai-edition/stylePresets.test.ts
@@ -41,6 +41,7 @@ function appearance(overrides: Partial<StylePresetAppearance> = {}): StylePreset
clickBounce: 1,
model3d: false,
alwaysArrow: false,
+ clickImpact: false,
},
cursorShow: true,
cursorAutoHide: false,
@@ -155,6 +156,15 @@ describe("parseStylePresetAppearance", () => {
).toThrow(/cursor\.model3d/);
});
+ it("reads a preset written before the click impact as without one, and type-checks it", () => {
+ const { clickImpact: _clickImpact, ...older } = appearance().cursor;
+ const read = (cursor: unknown) =>
+ parseStylePresetAppearance({ ...appearance(), cursor }).cursor;
+ expect(read(older).clickImpact).toBe(false);
+ expect(read({ ...older, clickImpact: true }).clickImpact).toBe(true);
+ expect(() => read({ ...older, clickImpact: "yes" })).toThrow(/cursor\.clickImpact/);
+ });
+
it("reads a preset saved before the frame existed as frameless, and rejects an unknown frame", () => {
const { frame: _frame, ...older } = appearance();
expect(parseStylePresetAppearance(older).frame).toBe("none");
diff --git a/src/lib/ai-edition/stylePresets.ts b/src/lib/ai-edition/stylePresets.ts
index 9c7b2acc9..40d129484 100644
--- a/src/lib/ai-edition/stylePresets.ts
+++ b/src/lib/ai-edition/stylePresets.ts
@@ -307,6 +307,9 @@ export function parseStylePresetAppearance(value: unknown): StylePresetAppearanc
// Presets written before the option existed kept every cursor state.
alwaysArrow:
cursor.alwaysArrow === undefined ? false : readBoolean(cursor, "alwaysArrow", "cursor."),
+ // Presets written before the option existed gave clicks no impact.
+ clickImpact:
+ cursor.clickImpact === undefined ? false : readBoolean(cursor, "clickImpact", "cursor."),
},
cursorShow: readBoolean(value, "cursorShow"),
cursorAutoHide: readBoolean(value, "cursorAutoHide"),
@@ -399,6 +402,7 @@ export const LOOK_LEGACY_EDITOR_KEYS = [
"cursorClickBounce",
"cursorModel3d",
"cursorAlwaysArrow",
+ "cursorClickImpact",
"cursorShow",
"cursorAutoHide",
"cursorTheme",
@@ -415,6 +419,7 @@ export function stylePresetLegacyEditor(appearance: StylePresetAppearance): Fiel
cursorClickBounce: cursor.clickBounce,
cursorModel3d: cursor.model3d,
cursorAlwaysArrow: cursor.alwaysArrow,
+ cursorClickImpact: cursor.clickImpact,
};
}
diff --git a/src/lib/ai-edition/stylePresetsEditor.test.ts b/src/lib/ai-edition/stylePresetsEditor.test.ts
index 7f6135860..cbb5b2e29 100644
--- a/src/lib/ai-edition/stylePresetsEditor.test.ts
+++ b/src/lib/ai-edition/stylePresetsEditor.test.ts
@@ -57,6 +57,7 @@ function styledSettings(): EditorSettingsSnapshot {
clickBounce: 1.5,
model3d: true,
alwaysArrow: false,
+ clickImpact: true,
},
cursorShow: false,
cursorAutoHide: true,
diff --git a/src/lib/ai-edition/stylePresetsEditor.ts b/src/lib/ai-edition/stylePresetsEditor.ts
index e5613ef37..c38caed53 100644
--- a/src/lib/ai-edition/stylePresetsEditor.ts
+++ b/src/lib/ai-edition/stylePresetsEditor.ts
@@ -41,6 +41,7 @@ export function stylePresetAppearanceFromSettings(
clickBounce: settings.cursor.clickBounce,
model3d: settings.cursor.model3d,
alwaysArrow: settings.cursor.alwaysArrow,
+ clickImpact: settings.cursor.clickImpact,
},
cursorShow: settings.cursorShow,
cursorAutoHide: settings.cursorAutoHide,
diff --git a/src/lib/projectDefaults.ts b/src/lib/projectDefaults.ts
index f1f6bf0d7..66911a92f 100644
--- a/src/lib/projectDefaults.ts
+++ b/src/lib/projectDefaults.ts
@@ -195,6 +195,7 @@ export interface ProjectAppearanceDefaults {
clickBounce: number;
model3d: boolean;
alwaysArrow: boolean;
+ clickImpact: boolean;
autoHide: boolean;
};
cursorShow: boolean;
@@ -241,6 +242,7 @@ export const DEFAULT_PROJECT_APPEARANCE: ProjectAppearanceDefaults = {
clickBounce: 1,
model3d: false,
alwaysArrow: false,
+ clickImpact: false,
autoHide: false,
},
cursorShow: true,
diff --git a/src/native/browserShim.presets.test.ts b/src/native/browserShim.presets.test.ts
index 2e36daf09..c7464a103 100644
--- a/src/native/browserShim.presets.test.ts
+++ b/src/native/browserShim.presets.test.ts
@@ -37,6 +37,7 @@ const APPEARANCE: StylePresetAppearance = {
clickBounce: 1,
model3d: false,
alwaysArrow: false,
+ clickImpact: false,
},
cursorShow: true,
cursorAutoHide: false,
diff --git a/src/native/sceneDescription.test.ts b/src/native/sceneDescription.test.ts
index 63ddcb6ba..2156e3084 100644
--- a/src/native/sceneDescription.test.ts
+++ b/src/native/sceneDescription.test.ts
@@ -731,26 +731,6 @@ describe("buildSceneDescription.zoomRegions", () => {
expect(zoomRegions[0].hideCursor).toBe(true);
});
- it("emits clickImpact only when it is on", () => {
- const base = {
- startMs: 0,
- endMs: 1000,
- depth: 3 as const,
- focus: { cx: 0.5, cy: 0.5 },
- rotationPreset: "left" as const,
- };
- const doc = makeDoc({
- zoomRanges: [
- makeZoom({ ...base, id: "on", clickImpact: true }),
- makeZoom({ ...base, id: "off" }),
- ],
- });
- const { zoomRegions } = buildSceneDescription(doc);
- expect(zoomRegions[0].clickImpact).toBe(true);
- // Omitted, not `false`: scene payloads without the option stay byte-identical.
- expect("clickImpact" in zoomRegions[1]).toBe(false);
- });
-
it("converts ms→sec for start/end", () => {
const z = makeZoom({
id: "z",
@@ -1286,6 +1266,14 @@ describe("buildSceneDescription.settings mapping", () => {
expect(buildSceneDescription(on).cursor.model3d).toBe(true);
});
+ it("carries the click impact switch, omitted when off", () => {
+ const on = makeDoc({ legacyEditor: { cursorClickImpact: true } });
+ expect(buildSceneDescription(on).cursor.clickImpact).toBe(true);
+ // Omitted, not `false`: scene payloads without the option stay byte-identical.
+ const off = buildSceneDescription(makeDoc({ legacyEditor: {} })).cursor;
+ expect("clickImpact" in off).toBe(false);
+ });
+
it("carries depth of field: on by default, off when the project turns it off", () => {
expect(buildSceneDescription(makeDoc({})).effects.depthOfField).toBe(true);
const off = makeDoc({ legacyEditor: { depthOfField: false } });
diff --git a/src/native/sceneDescription.ts b/src/native/sceneDescription.ts
index 323a46029..633abea35 100644
--- a/src/native/sceneDescription.ts
+++ b/src/native/sceneDescription.ts
@@ -114,9 +114,6 @@ export interface SceneZoomRegion {
underTrim?: boolean;
/** When true, cursor is hidden during this zoom region. */
hideCursor?: boolean;
- /** Each click presses the tilted plane toward the clicked side (`regions::click_impact`).
- * Native ignores it without a `rotation`. Omitted (not `false`) when off. */
- clickImpact?: true;
}
/** A "Full Camera" timeline region (from `legacyEditor.cameraFullscreenRegions`). Times in seconds. */
@@ -445,6 +442,9 @@ export interface SceneCursor {
model3d: boolean;
/** Every cursor state drawn with the arrow sprite (resolved app-side, see compositorViewService). */
alwaysArrow: boolean;
+ /** Each click gives the screen an impact, under every camera (`scene.rs`
+ * `SceneCursor::click_impact`). Omitted (not `false`) when off. */
+ clickImpact?: true;
clipToBounds: boolean;
/** Cursor theme id (sprite set). */
theme: string;
@@ -1243,6 +1243,7 @@ export function buildSceneDescription(
clickBounce: settings.cursor.clickBounce,
model3d: settings.cursor.model3d,
alwaysArrow: settings.cursor.alwaysArrow,
+ ...(settings.cursor.clickImpact ? { clickImpact: true as const } : {}),
// The "Keep inside frame" option is gone: the cursor always overflows into the
// background. The field stays because the compositor's scene requires it.
clipToBounds: false,
@@ -1290,7 +1291,6 @@ export function buildSceneDescription(
clipIndex: region.clipIndex,
...(region.underTrim ? { underTrim: true } : {}),
...(region.hideCursor ? { hideCursor: true } : {}),
- ...(region.clickImpact ? { clickImpact: true as const } : {}),
})),
annotations: projectedAnnotations
.map((region) => {