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): add smart cursor auto-hide and zoom hide (#104)

EtienneLescot8bb67a5f05ae
diff --git a/crates/compositor/src/compositor_linux.rs b/crates/compositor/src/compositor_linux.rs
index d27cbdf1a..2c778f69b 100644
--- a/crates/compositor/src/compositor_linux.rs
+++ b/crates/compositor/src/compositor_linux.rs
@@ -2615,7 +2615,7 @@ impl Compositor {
dst: cursor_sprite_dst(center, pw / rw, ph / rh, hotspot),
src: [0.0, 0.0, 1.0, 1.0],
mode: 7.0,
- color: [1.0, 1.0, 1.0, 1.0],
+ color: [1.0, 1.0, 1.0, plan.alpha],
fx: plan.clip,
..Default::default()
},
@@ -2651,7 +2651,7 @@ impl Compositor {
dst: [min_x / rw, min_y / rh, bw / rw, bh / rh],
quad_px: [bw, bh],
mode: 13.0,
- color: [1.0, 1.0, 1.0, 1.0],
+ color: [1.0, 1.0, 1.0, plan.alpha],
fx: [tl0, tl1, tr0, tr1],
src_prev: [br0, br1, bl0, bl1],
// Le clip vit ici et NON dans `fx` (mode 7) : `fx` porte les coins.
diff --git a/crates/compositor/src/compositor_macos.rs b/crates/compositor/src/compositor_macos.rs
index e3c8cff5e..6589ce3c4 100644
--- a/crates/compositor/src/compositor_macos.rs
+++ b/crates/compositor/src/compositor_macos.rs
@@ -2138,7 +2138,7 @@ impl Compositor {
let kind = plan.cursor_type.as_deref();
if plan.taps <= 1 {
let e = self.begin_pass(cmd_buf, &self.rt, None, &self.pipeline_main)?;
- self.draw_cur_themed(e, &sprites, kind, plan.placement, plan.size_px, 1.0, plan.clip);
+ self.draw_cur_themed(e, &sprites, kind, plan.placement, plan.size_px, plan.alpha, plan.clip);
e.end_encoding();
} else {
// Flou RÉEL, pas des copies discrètes : les N échantillons s'accumulent dans
@@ -2161,7 +2161,7 @@ impl Compositor {
kind,
plan.prev_placement.lerp(plan.placement, f),
plan.size_px,
- 1.0,
+ plan.alpha,
plan.clip,
);
}
diff --git a/crates/compositor/src/compositor_windows.rs b/crates/compositor/src/compositor_windows.rs
index e6ed30ecf..249014b9d 100644
--- a/crates/compositor/src/compositor_windows.rs
+++ b/crates/compositor/src/compositor_windows.rs
@@ -1893,7 +1893,7 @@ impl Compositor {
cursor_type,
plan.placement,
plan.size_px,
- 1.0,
+ plan.alpha,
plan.clip,
);
} else {
@@ -1910,7 +1910,7 @@ impl Compositor {
cursor_type,
plan.prev_placement.lerp(plan.placement, f),
plan.size_px,
- 1.0,
+ plan.alpha,
plan.clip,
);
}
@@ -1921,8 +1921,12 @@ impl Compositor {
self.ctx.PSSetShader(&self.ps_tex, None);
self.ctx.PSSetSamplers(0, Some(&[Some(self.sampler.clone())]));
let vp = D3D11_VIEWPORT {
- TopLeftX: 0.0, TopLeftY: 0.0,
- Width: self.rw(), Height: self.rh(), MinDepth: 0.0, MaxDepth: 1.0,
+ TopLeftX: 0.0,
+ TopLeftY: 0.0,
+ Width: self.rw(),
+ Height: self.rh(),
+ MinDepth: 0.0,
+ MaxDepth: 1.0,
};
self.ctx.RSSetViewports(Some(&[vp]));
self.ctx.OMSetBlendState(&self.blend, None, 0xffffffff);
diff --git a/crates/compositor/src/cursor.rs b/crates/compositor/src/cursor.rs
index a34c2ae00..6624d0735 100644
--- a/crates/compositor/src/cursor.rs
+++ b/crates/compositor/src/cursor.rs
@@ -224,6 +224,83 @@ impl CursorTrack {
// déplace la trajectoire, pas la chronologie de ce que faisait l'utilisateur.
CursorTrack::new(samples, self.clicks.clone(), self.types.clone())
}
+
+ /// Opacité du curseur (0.0..1.0) selon l'inactivité (auto-hide).
+ /// Si `auto_hide` est faux, retourne toujours 1.0.
+ /// Si `auto_hide` est vrai :
+ /// - Le curseur reste à 1.0 tant qu'il bouge ou clique, et pendant 1.5s après le dernier mouvement/clic.
+ /// - Entre 1.5s et 1.8s d'inactivité, il s'estompe linéairement de 1.0 à 0.0 (fade-out 300ms).
+ /// - Au-delà de 1.8s, opacité 0.0.
+ pub fn opacity_at(&self, t: f32, auto_hide: bool) -> f32 {
+ if !auto_hide || self.samples.is_empty() {
+ return 1.0;
+ }
+
+ const IDLE_TIMEOUT_S: f32 = 1.5;
+ const FADE_DURATION_S: f32 = 0.3;
+ const MOVE_THRESH_SQ: f32 = 0.015 * 0.015;
+
+ let last_click = match self.clicks.partition_point(|&tc| tc <= t) {
+ 0 => None,
+ i => Some(self.clicks[i - 1]),
+ };
+
+ let (cx, cy) = match self.at(t) {
+ Some(p) => p,
+ None => return 1.0,
+ };
+
+ let idx = self.samples.partition_point(|s| s.0 <= t);
+ let start_t = self.samples[0].0;
+
+ let mut arrival_t = if idx > 0 { self.samples[idx - 1].0 } else { start_t };
+
+ if idx > 0 {
+ let mut i = idx - 1;
+ while i > 0 {
+ let prev = self.samples[i - 1];
+ let dx = cx - prev.1;
+ let dy = cy - prev.2;
+ if dx * dx + dy * dy > MOVE_THRESH_SQ {
+ arrival_t = self.samples[i].0;
+ break;
+ }
+ if t - prev.0 > IDLE_TIMEOUT_S + FADE_DURATION_S {
+ arrival_t = prev.0;
+ break;
+ }
+ i -= 1;
+ if i == 0 {
+ arrival_t = start_t;
+ }
+ }
+ }
+
+ if idx > 1 {
+ let s1 = self.samples[idx - 1];
+ let s0 = self.samples[idx - 2];
+ let d_step = (s1.1 - s0.1) * (s1.1 - s0.1) + (s1.2 - s0.2) * (s1.2 - s0.2);
+ if d_step > 0.005 * 0.005 && (t - s1.0).abs() < 0.1 {
+ arrival_t = t;
+ }
+ }
+
+ let mut last_activity = arrival_t;
+ if let Some(tc) = last_click {
+ if tc > last_activity {
+ last_activity = tc;
+ }
+ }
+
+ let idle_time = (t - last_activity).max(0.0);
+ if idle_time <= IDLE_TIMEOUT_S {
+ 1.0
+ } else if idle_time >= IDLE_TIMEOUT_S + FADE_DURATION_S {
+ 0.0
+ } else {
+ 1.0 - (idle_time - IDLE_TIMEOUT_S) / FADE_DURATION_S
+ }
+ }
}
/// Ressort-amortisseur, intégration semi-implicite (symplectique) d'Euler — stable pour ces
@@ -341,4 +418,70 @@ mod tests {
"omitted cursorType after pointer must reset to arrow independently"
);
}
+
+ #[test]
+ fn auto_hide_disabled_always_full_opacity() {
+ let track = CursorTrack::new(
+ vec![(0.0, 0.5, 0.5), (10.0, 0.5, 0.5)],
+ vec![],
+ vec![],
+ );
+ assert_eq!(track.opacity_at(0.0, false), 1.0);
+ assert_eq!(track.opacity_at(5.0, false), 1.0);
+ assert_eq!(track.opacity_at(10.0, false), 1.0);
+ }
+
+ #[test]
+ fn auto_hide_fades_out_after_idle_timeout() {
+ // Le curseur est stationnaire à (0.5, 0.5) de 0 à 5s.
+ let track = CursorTrack::new(
+ vec![(0.0, 0.5, 0.5), (1.0, 0.5, 0.5), (2.0, 0.5, 0.5), (3.0, 0.5, 0.5), (4.0, 0.5, 0.5)],
+ vec![],
+ vec![],
+ );
+ // Pendant 1.5s, opacité 1.0
+ assert_eq!(track.opacity_at(0.0, true), 1.0);
+ assert_eq!(track.opacity_at(1.0, true), 1.0);
+ assert_eq!(track.opacity_at(1.5, true), 1.0);
+
+ // Entre 1.5s et 1.8s, estompage linéaire
+ let op_mid = track.opacity_at(1.65, true);
+ assert!((op_mid - 0.5).abs() < 0.05, "mi-parcours d'estompage: {op_mid}");
+
+ // À 1.8s et au-delà, opacité 0.0
+ assert_eq!(track.opacity_at(1.8, true), 0.0);
+ assert_eq!(track.opacity_at(3.0, true), 0.0);
+ }
+
+ #[test]
+ fn auto_hide_wakes_on_movement_or_click() {
+ // Reste immobile jusqu'à 2s, bouge à 2.5s, s'arrête, clic à 4.0s
+ let track = CursorTrack::new(
+ vec![
+ (0.0, 0.1, 0.1),
+ (1.0, 0.1, 0.1),
+ (2.0, 0.1, 0.1),
+ (2.5, 0.8, 0.8), // mouvement net
+ (2.6, 0.8, 0.8),
+ (4.0, 0.8, 0.8),
+ (5.0, 0.8, 0.8),
+ ],
+ vec![4.0], // clic à 4.0s
+ vec![],
+ );
+
+ // À 1.9s, inactif depuis 0s -> 0.0
+ assert_eq!(track.opacity_at(1.9, true), 0.0);
+
+ // À 2.5s, vient de bouger -> réveil à 1.0
+ assert_eq!(track.opacity_at(2.5, true), 1.0);
+ // À 3.5s, 1s après le mouvement -> toujours 1.0
+ assert_eq!(track.opacity_at(3.5, true), 1.0);
+
+ // Sans le clic à 4.0, à 4.5s (2s après 2.5) il serait éteint.
+ // Mais le clic à 4.0s le réveille -> 1.0
+ assert_eq!(track.opacity_at(4.2, true), 1.0);
+ // Et s'éteint 1.8s après le clic (4.0 + 1.8 = 5.8s)
+ assert_eq!(track.opacity_at(5.9, true), 0.0);
+ }
}
diff --git a/crates/compositor/src/frame_geometry.rs b/crates/compositor/src/frame_geometry.rs
index 03a838437..f26d5776e 100644
--- a/crates/compositor/src/frame_geometry.rs
+++ b/crates/compositor/src/frame_geometry.rs
@@ -615,6 +615,8 @@ pub struct LiveParams {
/// vélocité), pas par un flou gaussien variable comme le canvas web — plus simple à
/// réutiliser côté GPU, effet de streak équivalent.
pub cursor_motion_blur: f32,
+ /// Masquage auto du curseur en cas d'inactivité.
+ pub cursor_auto_hide: bool,
/// False when the "webcam" decoder is actually just the screen video again (the TS side
/// falls `webcamPath` back to the screen asset's own path when a clip has no real camera,
/// purely so the decoder pipeline has something valid to open) — drawing the PiP box in
@@ -662,6 +664,7 @@ impl Default for LiveParams {
cursor_size_scale: 1.0,
cursor_bounce_scale: 1.0,
cursor_motion_blur: 0.0,
+ cursor_auto_hide: false,
has_webcam: true,
}
}
@@ -699,6 +702,7 @@ pub fn live_params_from_scene(s: &crate::scene::Scene) -> LiveParams {
cursor_size_scale: s.cursor.size,
cursor_bounce_scale: s.cursor.click_bounce,
cursor_motion_blur: s.cursor.motion_blur,
+ cursor_auto_hide: s.cursor.auto_hide,
..LiveParams::default()
}
}
@@ -1206,6 +1210,8 @@ pub struct CursorPlan {
pub clip: [f32; 4],
/// État du curseur à cet instant (`arrow`, `pointer`, …) pour choisir le sprite.
pub cursor_type: Option<String>,
+ /// Opacité effective (0..1) tenant compte de l'inactivité (auto-hide) et du zoom.
+ pub alpha: f32,
}
/// Ce que `plan_cursor` doit savoir en plus de `FrameGeometry`.
@@ -1229,6 +1235,17 @@ pub fn plan_cursor(g: &FrameGeometry, input: &CursorPlanInput) -> Option<CursorP
if !show {
return None;
}
+
+ let idle_alpha = input.track.opacity_at(input.t, input.live.cursor_auto_hide);
+ let zoom_alpha = match input.scene {
+ Some(s) => crate::regions::zoom_cursor_alpha(&s.zoom_regions, input.t),
+ None => 1.0,
+ };
+ let alpha = idle_alpha * zoom_alpha;
+ if alpha <= 0.001 {
+ return None;
+ }
+
let s_px = [g.s_dst[2] * rw, g.s_dst[3] * rh];
let tilt = (!crate::regions::is_identity_rotation(g.zoom_rotation))
.then(|| crate::regions::rotated_quad_corners_px(s_px[0], s_px[1], g.zoom_rotation));
@@ -1320,6 +1337,7 @@ pub fn plan_cursor(g: &FrameGeometry, input: &CursorPlanInput) -> Option<CursorP
taps,
clip,
cursor_type: input.track.type_at(input.t).map(str::to_string),
+ alpha,
})
}
diff --git a/crates/compositor/src/live.rs b/crates/compositor/src/live.rs
index 9d91fe643..51c9765f2 100644
--- a/crates/compositor/src/live.rs
+++ b/crates/compositor/src/live.rs
@@ -631,6 +631,7 @@ struct InspectorParams {
cursor_smoothing: f32,
/// 0..1 : force du flou de mouvement DU CURSEUR (indépendant du motion blur écran).
cursor_motion_blur: f32,
+ cursor_auto_hide: bool,
}
impl Default for InspectorParams {
@@ -650,6 +651,7 @@ impl Default for InspectorParams {
cursor_bounce_scale: 1.0,
cursor_smoothing: 0.0,
cursor_motion_blur: 0.0,
+ cursor_auto_hide: false,
}
}
}
@@ -905,6 +907,7 @@ impl LiveView {
"backgroundBlur" => p.bg_blur = value,
"webcamMirror" => p.webcam_mirror = value,
"cursorShow" => p.cursor_show = value,
+ "cursorAutoHide" => p.cursor_auto_hide = value,
_ => {}
}
}
@@ -964,6 +967,10 @@ impl LiveView {
pub fn set_scene(&self, json: &str) {
match Scene::from_json(json) {
Ok(scene) => {
+ if let Ok(mut p) = self.shared.inspector.lock() {
+ p.cursor_show = scene.cursor.show;
+ p.cursor_auto_hide = scene.cursor.auto_hide;
+ }
if let Ok(mut s) = self.shared.scene.lock() {
*s = Some(scene);
self.shared.scene_dirty.store(true, Ordering::Relaxed);
@@ -1522,6 +1529,7 @@ unsafe fn render_thread(
cursor_size_scale: ip.cursor_size_scale,
cursor_bounce_scale: ip.cursor_bounce_scale,
cursor_motion_blur: ip.cursor_motion_blur,
+ cursor_auto_hide: ip.cursor_auto_hide,
has_webcam: has_real_webcam,
});
// Lissage ressort-amortisseur : re-génère la piste (240 Hz) uniquement quand la valeur
diff --git a/crates/compositor/src/regions.rs b/crates/compositor/src/regions.rs
index 3be707066..e6f645b89 100644
--- a/crates/compositor/src/regions.rs
+++ b/crates/compositor/src/regions.rs
@@ -203,6 +203,72 @@ fn zoom_region_strength(region: &SceneZoomRegion, t: f32) -> f32 {
1.0 - ease_out_screen_studio(progress)
}
+/// Facteur d'opacité du curseur (0.0..1.0) induit par les régions de zoom ayant `hide_cursor = true`.
+/// Si aucune région masquant le curseur n'est active, retourne 1.0.
+/// S'estompe avec l'ease-in du zoom (1.0 -> 0.0) et réapparaît avec l'ease-out (0.0 -> 1.0).
+/// En cas de transition chaînée (connected pan), suit le même enchaînement que `zoom_state_at`.
+pub fn zoom_cursor_alpha(regions: &[SceneZoomRegion], t: f32) -> f32 {
+ if regions.is_empty() || !regions.iter().any(|r| r.hide_cursor) {
+ return 1.0;
+ }
+ let pairs = connected_pairs(regions);
+
+ // 1) transition chaînée : pan lissé de la région courante vers la suivante.
+ for &(ci, ni, t_start, t_end) in &pairs {
+ if t < t_start || t > t_end {
+ continue;
+ }
+ let progress = ease_connected_pan(clamp01((t - t_start) / (t_end - t_start).max(1e-3)));
+ let cur_alpha = if regions[ci].hide_cursor { 0.0 } else { 1.0 };
+ let next_alpha = if regions[ni].hide_cursor { 0.0 } else { 1.0 };
+ return lerp(cur_alpha, next_alpha, progress).clamp(0.0, 1.0);
+ }
+
+ // 2) palier chaîné : entre la fin de la transition et le début officiel de la région
+ // suivante, celle-ci est déjà pleinement active (anticipe son propre ease-in).
+ for &(_, ni, _, t_end) in &pairs {
+ let next = &regions[ni];
+ if t > t_end && t < next.start_sec as f32 {
+ return if next.hide_cursor { 0.0 } else { 1.0 };
+ }
+ }
+
+ // 3) région dominante indépendante — exclut celles déjà couvertes par une transition/palier
+ // chaîné ci-dessus.
+ let mut best: Option<(usize, f32)> = None;
+ for (i, r) in regions.iter().enumerate() {
+ let outgoing_past_end =
+ pairs.iter().any(|&(ci, _, _, _)| ci == i && t > regions[i].end_sec as f32);
+ let incoming_before_transition_end =
+ pairs.iter().any(|&(_, ni, _, t_end)| ni == i && t < t_end);
+ if outgoing_past_end || incoming_before_transition_end {
+ continue;
+ }
+ let s = zoom_region_strength(r, t);
+ if s <= 0.0 {
+ continue;
+ }
+ let better = match best {
+ None => true,
+ Some((bi, bs)) => s > bs || (s == bs && r.start_sec > regions[bi].start_sec),
+ };
+ if better {
+ best = Some((i, s));
+ }
+ }
+
+ match best {
+ Some((i, strength)) => {
+ if regions[i].hide_cursor {
+ (1.0 - strength).clamp(0.0, 1.0)
+ } else {
+ 1.0
+ }
+ }
+ None => 1.0,
+ }
+}
+
/// État de zoom complet au temps `t` : échelle, focus, ET tilt 3D (degrés X/Y/Z — rendu en
/// pixel shader par `compositor.rs`, ce module ne fait que le calcul temporel).
pub struct ZoomState {
@@ -642,9 +708,73 @@ mod zoom_focus_tests {
focus_mode: Some("manual".into()),
rotation: None,
under_trim: false,
+ hide_cursor: false,
}
}
+ #[test]
+ fn zoom_cursor_alpha_hides_during_zoom() {
+ let mut r = region(2.0, 0.5);
+ r.start_sec = 3.0;
+ r.end_sec = 6.0;
+ r.hide_cursor = true;
+
+ let regions = vec![r];
+
+ // Bien avant le zoom (t=0.0) -> pleine opacité
+ assert_eq!(zoom_cursor_alpha(&regions, 0.0), 1.0);
+
+ // Plein milieu du zoom (t=4.5) -> complètement masqué
+ assert_eq!(zoom_cursor_alpha(&regions, 4.5), 0.0);
+
+ // Bien après le zoom (t=10.0) -> pleine opacité
+ assert_eq!(zoom_cursor_alpha(&regions, 10.0), 1.0);
+ }
+
+ #[test]
+ fn zoom_cursor_alpha_connected_regions_stay_hidden() {
+ let mut r1 = region(2.0, 0.5);
+ r1.start_sec = 2.0;
+ r1.end_sec = 4.0;
+ r1.hide_cursor = true;
+
+ let mut r2 = region(2.5, 0.5);
+ r2.start_sec = 4.5;
+ r2.end_sec = 7.0;
+ r2.hide_cursor = true;
+
+ let regions = vec![r1, r2];
+
+ // Pendant la région 1 (t=3.0) -> masqué
+ assert_eq!(zoom_cursor_alpha(&regions, 3.0), 0.0);
+ // Pendant la transition chaînée (connected pan entre t=4.0 et t=4.3) -> reste masqué
+ assert_eq!(zoom_cursor_alpha(&regions, 4.15), 0.0);
+ // Pendant le palier chaîné (t=4.4) -> reste masqué
+ assert_eq!(zoom_cursor_alpha(&regions, 4.4), 0.0);
+ // Pendant la région 2 (t=5.5) -> masqué
+ assert_eq!(zoom_cursor_alpha(&regions, 5.5), 0.0);
+ }
+
+ #[test]
+ fn zoom_cursor_alpha_connected_regions_transition() {
+ let mut r1 = region(2.0, 0.5);
+ r1.start_sec = 2.0;
+ r1.end_sec = 4.0;
+ r1.hide_cursor = true;
+
+ let mut r2 = region(2.5, 0.5);
+ r2.start_sec = 4.5;
+ r2.end_sec = 7.0;
+ r2.hide_cursor = false;
+
+ let regions = vec![r1, r2];
+
+ // Avant la transition (r1 actif) -> 0.0
+ assert_eq!(zoom_cursor_alpha(&regions, 3.0), 0.0);
+ // Après la transition (r2 actif avec hide_cursor=false) -> 1.0
+ assert_eq!(zoom_cursor_alpha(&regions, 5.5), 1.0);
+ }
+
/// Où le point source `f` atterrit à l'écran (0..1) : le crop est centré sur `focus` et
/// couvre `1/scale` de la source, donc l'écran mappe `0.5 + (f - focus) * scale`.
fn screen_x(state: &ZoomState, f: f32) -> f32 {
diff --git a/crates/compositor/src/scene.rs b/crates/compositor/src/scene.rs
index a42241672..f1e26c151 100644
--- a/crates/compositor/src/scene.rs
+++ b/crates/compositor/src/scene.rs
@@ -343,6 +343,9 @@ pub struct SceneZoomRegion {
/// `#[serde(default)]` : absent de tout payload sans trim sous un modificateur (issue #216).
#[serde(default)]
pub under_trim: bool,
+ /// Masque le curseur pendant cette région de zoom.
+ #[serde(default)]
+ pub hide_cursor: bool,
}
/// Une zone de vitesse portée par le temps source d'un clip.
@@ -375,6 +378,9 @@ pub struct SceneCameraFullscreenRegion {
#[serde(rename_all = "camelCase")]
pub struct SceneCursor {
pub show: bool,
+ /// Masque automatiquement le curseur après une période d'inactivité.
+ #[serde(default)]
+ pub auto_hide: bool,
/// échelle directe (1 = défaut).
pub size: f32,
pub smoothing: f32,
diff --git a/src/components/ai-edition/RightPanes.i18n.test.tsx b/src/components/ai-edition/RightPanes.i18n.test.tsx
index fb9fc07ba..0be64122b 100644
--- a/src/components/ai-edition/RightPanes.i18n.test.tsx
+++ b/src/components/ai-edition/RightPanes.i18n.test.tsx
@@ -70,6 +70,7 @@ describe("right-rail panes are localized", () => {
expect(screen.getByRole("heading", { name: "Curseur" })).toBeInTheDocument();
expect(screen.getByText("Lissage")).toBeInTheDocument();
expect(screen.getByText("Rebond au clic")).toBeInTheDocument();
+ expect(screen.getByText("Masquer si inactif")).toBeInTheDocument();
});
it("falls back to English when the locale is English", () => {
diff --git a/src/components/ai-edition/RightPanes.tsx b/src/components/ai-edition/RightPanes.tsx
index 2c0548f81..bfa10f273 100644
--- a/src/components/ai-edition/RightPanes.tsx
+++ b/src/components/ai-edition/RightPanes.tsx
@@ -3300,6 +3300,7 @@ export function CursorPane() {
<div className={styles.paneRow}>
<span className={styles.label}>{ts("cursor.show")}</span>
<Toggle
+ ariaLabel={ts("cursor.show")}
checked={settings.cursorShow}
disabled={!hasDocument}
onChange={(v) => {
@@ -3310,9 +3311,24 @@ export function CursorPane() {
}}
/>
</div>
+ <div className={styles.paneRow}>
+ <span className={styles.label}>{ts("cursor.autoHide")}</span>
+ <Toggle
+ ariaLabel={ts("cursor.autoHide")}
+ checked={settings.cursorAutoHide}
+ disabled={!hasDocument || !settings.cursorShow}
+ onChange={(v) => {
+ void set({ cursorAutoHide: v });
+ if (isNativeCompositorActive()) {
+ setNativeParam("cursorAutoHide", v);
+ }
+ }}
+ />
+ </div>
<div className={styles.paneRow}>
<span className={styles.label}>{ts("cursor.clipToBounds")}</span>
<Toggle
+ ariaLabel={ts("cursor.clipToBounds")}
checked={settings.cursor.clipToBounds}
disabled={!hasDocument}
onChange={(v) => void set({ cursor: { clipToBounds: v } })}
diff --git a/src/components/ai-edition/v4/FloatingInspector.tsx b/src/components/ai-edition/v4/FloatingInspector.tsx
index 36c3da3cc..2a4a4904c 100644
--- a/src/components/ai-edition/v4/FloatingInspector.tsx
+++ b/src/components/ai-edition/v4/FloatingInspector.tsx
@@ -580,6 +580,18 @@ function SelectionPane({ tl, onClose }: { tl: TimelineApi; onClose: () => void }
<option value="auto">{ts("zoom.focusMode.auto")}</option>
</select>,
)}
+ {paneRow(
+ ts("zoom.cursor.title"),
+ <select
+ aria-label={ts("zoom.cursor.title")}
+ value={region.hideCursor ? "hide" : "show"}
+ onChange={(e) => void tl.updateZoomHideCursor(region.id, e.target.value === "hide")}
+ style={selectStyle}
+ >
+ <option value="show">{ts("zoom.cursor.show")}</option>
+ <option value="hide">{ts("zoom.cursor.hide")}</option>
+ </select>,
+ )}
{autoFocusAll || region.focusMode === "auto" ? (
// Auto resamples the focus from cursor telemetry every frame, so there is no fixed
// point to reset and no gimbal on the canvas (ZoomFocusOverlay bows out) — the
diff --git a/src/components/video-editor/editorDefaults.ts b/src/components/video-editor/editorDefaults.ts
index a98c93c5d..55bf565e5 100644
--- a/src/components/video-editor/editorDefaults.ts
+++ b/src/components/video-editor/editorDefaults.ts
@@ -5,6 +5,7 @@ import type { AspectRatio } from "@/utils/aspectRatioUtils";
import {
type CursorVisualSettings,
DEFAULT_CROP_REGION,
+ DEFAULT_CURSOR_AUTO_HIDE,
DEFAULT_CURSOR_CLICK_BOUNCE,
DEFAULT_CURSOR_CLIP_TO_BOUNDS,
DEFAULT_CURSOR_MOTION_BLUR,
@@ -70,6 +71,7 @@ export const DEFAULT_WEBCAM_SETTINGS = {
export const DEFAULT_CURSOR_SETTINGS: CursorVisualSettings & { show: boolean; theme: string } = {
show: true,
+ autoHide: DEFAULT_CURSOR_AUTO_HIDE,
size: DEFAULT_CURSOR_SIZE,
smoothing: DEFAULT_CURSOR_SMOOTHING,
motionBlur: DEFAULT_CURSOR_MOTION_BLUR,
diff --git a/src/components/video-editor/types.ts b/src/components/video-editor/types.ts
index 243252703..9922231a2 100644
--- a/src/components/video-editor/types.ts
+++ b/src/components/video-editor/types.ts
@@ -109,6 +109,8 @@ export interface ZoomRegion {
/** Custom scale overriding the preset depth (1.0-5.0, two decimal precision). */
customScale?: number;
source?: ZoomRegionSource;
+ /** When true, cursor is hidden during this zoom region. */
+ hideCursor?: boolean;
}
export function getRotation3D(region: Pick<ZoomRegion, "rotationPreset">): Rotation3D {
@@ -228,6 +230,7 @@ export interface CursorVisualSettings {
motionBlur: number;
clickBounce: number;
clipToBounds: boolean;
+ autoHide?: boolean;
}
export const DEFAULT_CURSOR_SIZE = 3.0;
@@ -236,6 +239,7 @@ export const DEFAULT_CURSOR_MOTION_BLUR = 0.35;
export const DEFAULT_CURSOR_CLICK_BOUNCE = 2.5;
// false lets the cursor overflow into the background; true clips it to the canvas bounds.
export const DEFAULT_CURSOR_CLIP_TO_BOUNDS = false;
+export const DEFAULT_CURSOR_AUTO_HIDE = false;
export const DEFAULT_ZOOM_MOTION_BLUR = 0.35;
export interface TrimRegion {
diff --git a/src/i18n/locales/ar/settings.json b/src/i18n/locales/ar/settings.json
index 2efb8fc10..c4972175e 100644
--- a/src/i18n/locales/ar/settings.json
+++ b/src/i18n/locales/ar/settings.json
@@ -310,7 +310,12 @@
"level": "مستوى التكبير",
"previewHold": "اضغط مع الاستمرار لمعاينة تأثير التكبير",
"customScale": "تكبير مخصص",
- "selectRegion": "حدد منطقة التكبير للتعديل"
+ "selectRegion": "حدد منطقة التكبير للتعديل",
+ "cursor": {
+ "title": "المؤشر",
+ "show": "مرئي",
+ "hide": "مخفي"
+ }
},
"audio": {
"outputGain": "ضبط مستوى الإخراج",
@@ -342,7 +347,8 @@
"themeDefault": "افتراضي",
"clipToBounds": "القص ضمن اللوحة",
"motionBlur": "ضبابية الحركة",
- "theme": "نمط المؤشر"
+ "theme": "نمط المؤشر",
+ "autoHide": "إخفاء عند عدم النشاط"
},
"export": {
"gifButton": "تصدير GIF",
diff --git a/src/i18n/locales/en/settings.json b/src/i18n/locales/en/settings.json
index cf499104b..edf98dffb 100644
--- a/src/i18n/locales/en/settings.json
+++ b/src/i18n/locales/en/settings.json
@@ -310,7 +310,12 @@
"level": "Zoom Level",
"previewHold": "Hold to preview zoom effect",
"customScale": "Custom Zoom",
- "selectRegion": "Select a zoom region to adjust"
+ "selectRegion": "Select a zoom region to adjust",
+ "cursor": {
+ "title": "Cursor",
+ "show": "Visible",
+ "hide": "Hidden"
+ }
},
"audio": {
"outputGain": "Output level",
@@ -342,7 +347,8 @@
"themeDefault": "Default",
"clipToBounds": "Clip to Canvas",
"motionBlur": "Motion Blur",
- "theme": "Cursor Style"
+ "theme": "Cursor Style",
+ "autoHide": "Auto-hide when inactive"
},
"export": {
"gifButton": "Export GIF",
diff --git a/src/i18n/locales/es/settings.json b/src/i18n/locales/es/settings.json
index dbde8bce8..c8938e35b 100644
--- a/src/i18n/locales/es/settings.json
+++ b/src/i18n/locales/es/settings.json
@@ -310,7 +310,12 @@
"level": "Nivel de zoom",
"previewHold": "Mantener para previsualizar el efecto de zoom",
"customScale": "Zoom personalizado",
- "selectRegion": "Selecciona una región de zoom para ajustar"
+ "selectRegion": "Selecciona una región de zoom para ajustar",
+ "cursor": {
+ "title": "Cursor",
+ "show": "Visible",
+ "hide": "Oculto"
+ }
},
"audio": {
"outputGain": "Ajuste de salida",
@@ -342,7 +347,8 @@
"themeDefault": "Predeterminado",
"clipToBounds": "Recortar al lienzo",
"motionBlur": "Desenfoque de movimiento",
- "theme": "Estilo del cursor"
+ "theme": "Estilo del cursor",
+ "autoHide": "Ocultar si está inactivo"
},
"export": {
"gifButton": "Exportar GIF",
diff --git a/src/i18n/locales/fr/settings.json b/src/i18n/locales/fr/settings.json
index f7ab3d56e..d91f46303 100644
--- a/src/i18n/locales/fr/settings.json
+++ b/src/i18n/locales/fr/settings.json
@@ -310,7 +310,12 @@
"level": "Niveau de zoom",
"previewHold": "Maintenir pour prévisualiser l'effet de zoom",
"customScale": "Zoom personnalisé",
- "selectRegion": "Sélectionnez une région de zoom à ajuster"
+ "selectRegion": "Sélectionnez une région de zoom à ajuster",
+ "cursor": {
+ "title": "Curseur",
+ "show": "Visible",
+ "hide": "Masqué"
+ }
},
"audio": {
"outputGain": "Niveau de sortie",
@@ -342,7 +347,8 @@
"themeDefault": "Par défaut",
"clipToBounds": "Rogner au canevas",
"motionBlur": "Flou de mouvement",
- "theme": "Style du curseur"
+ "theme": "Style du curseur",
+ "autoHide": "Masquer si inactif"
},
"export": {
"gifButton": "Exporter le GIF",
diff --git a/src/i18n/locales/it/settings.json b/src/i18n/locales/it/settings.json
index 0aa569e5c..b8c879a34 100644
--- a/src/i18n/locales/it/settings.json
+++ b/src/i18n/locales/it/settings.json
@@ -310,7 +310,12 @@
"level": "Livello zoom",
"previewHold": "Tieni premuto per vedere l'anteprima dell'effetto zoom",
"customScale": "Zoom personalizzato",
- "selectRegion": "Seleziona una regione zoom da regolare"
+ "selectRegion": "Seleziona una regione zoom da regolare",
+ "cursor": {
+ "title": "Cursore",
+ "show": "Visibile",
+ "hide": "Nascosto"
+ }
},
"audio": {
"outputGain": "Livello di uscita",
@@ -342,7 +347,8 @@
"themeDefault": "Predefinito",
"clipToBounds": "Ritaglia al canvas",
"motionBlur": "Sfocatura movimento",
- "theme": "Stile del cursore"
+ "theme": "Stile del cursore",
+ "autoHide": "Nascondi se inattivo"
},
"export": {
"gifButton": "Esporta GIF",
diff --git a/src/i18n/locales/ja-JP/settings.json b/src/i18n/locales/ja-JP/settings.json
index dc49e7092..e94079d5c 100644
--- a/src/i18n/locales/ja-JP/settings.json
+++ b/src/i18n/locales/ja-JP/settings.json
@@ -310,7 +310,12 @@
"level": "ズーム倍率",
"previewHold": "押している間ズーム効果をプレビュー",
"customScale": "カスタムズーム",
- "selectRegion": "ズーム範囲を選択して調整"
+ "selectRegion": "ズーム範囲を選択して調整",
+ "cursor": {
+ "title": "カーソル",
+ "show": "表示",
+ "hide": "非表示"
+ }
},
"audio": {
"outputGain": "出力レベル",
@@ -342,7 +347,8 @@
"themeDefault": "デフォルト",
"clipToBounds": "キャンバスにクリップ",
"motionBlur": "モーションブラー",
- "theme": "カーソルのスタイル"
+ "theme": "カーソルのスタイル",
+ "autoHide": "非アクティブ時に非表示"
},
"export": {
"gifButton": "GIF をエクスポート",
diff --git a/src/i18n/locales/ko-KR/settings.json b/src/i18n/locales/ko-KR/settings.json
index 9095cb565..a95f404f1 100644
--- a/src/i18n/locales/ko-KR/settings.json
+++ b/src/i18n/locales/ko-KR/settings.json
@@ -310,7 +310,12 @@
"level": "줌 레벨",
"previewHold": "누르고 있으면 줌 효과 미리보기",
"customScale": "커스텀 줌",
- "selectRegion": "조정할 줌 구간을 선택하세요"
+ "selectRegion": "조정할 줌 구간을 선택하세요",
+ "cursor": {
+ "title": "커서",
+ "show": "표시",
+ "hide": "숨기기"
+ }
},
"audio": {
"outputGain": "출력 레벨",
@@ -342,7 +347,8 @@
"themeDefault": "기본",
"clipToBounds": "캔버스에 맞춰 자르기",
"motionBlur": "모션 블러",
- "theme": "커서 스타일"
+ "theme": "커서 스타일",
+ "autoHide": "비활성 시 자동 숨김"
},
"export": {
"gifButton": "GIF 내보내기",
diff --git a/src/i18n/locales/pt-BR/settings.json b/src/i18n/locales/pt-BR/settings.json
index ad216ac3d..d81ab35fd 100644
--- a/src/i18n/locales/pt-BR/settings.json
+++ b/src/i18n/locales/pt-BR/settings.json
@@ -310,7 +310,12 @@
"level": "Nível de Zoom",
"previewHold": "Mantenha pressionado para pré-visualizar o efeito de zoom",
"customScale": "Zoom Personalizado",
- "selectRegion": "Selecione uma região de zoom para ajustar"
+ "selectRegion": "Selecione uma região de zoom para ajustar",
+ "cursor": {
+ "title": "Cursor",
+ "show": "Visível",
+ "hide": "Oculto"
+ }
},
"audio": {
"outputGain": "Nível de saída",
@@ -342,7 +347,8 @@
"themeDefault": "Padrão",
"clipToBounds": "Recortar à tela",
"motionBlur": "Desfoque de movimento",
- "theme": "Estilo do cursor"
+ "theme": "Estilo do cursor",
+ "autoHide": "Ocultar quando inativo"
},
"export": {
"gifButton": "Exportar GIF",
diff --git a/src/i18n/locales/ru/settings.json b/src/i18n/locales/ru/settings.json
index cdf952de0..32e493231 100644
--- a/src/i18n/locales/ru/settings.json
+++ b/src/i18n/locales/ru/settings.json
@@ -310,7 +310,12 @@
"level": "Уровень масштабирования",
"previewHold": "Удерживайте для предпросмотра эффекта зума",
"customScale": "Пользовательский масштаб",
- "selectRegion": "Выберите область масштабирования для настройки"
+ "selectRegion": "Выберите область масштабирования для настройки",
+ "cursor": {
+ "title": "Курсор",
+ "show": "Показывать",
+ "hide": "Скрыть"
+ }
},
"audio": {
"outputGain": "Уровень выхода",
@@ -342,7 +347,8 @@
"themeDefault": "По умолчанию",
"clipToBounds": "Обрезать по холсту",
"motionBlur": "Размытие движения",
- "theme": "Стиль курсора"
+ "theme": "Стиль курсора",
+ "autoHide": "Скрывать при неактивности"
},
"export": {
"gifButton": "Экспорт GIF",
diff --git a/src/i18n/locales/tr/settings.json b/src/i18n/locales/tr/settings.json
index 46812be46..d66434a1f 100644
--- a/src/i18n/locales/tr/settings.json
+++ b/src/i18n/locales/tr/settings.json
@@ -310,7 +310,12 @@
"level": "Yakınlaştırma Seviyesi",
"previewHold": "Yakınlaştırma efektini önizlemek için basılı tutun",
"customScale": "Özel Yakınlaştırma",
- "selectRegion": "Ayarlamak için bir yakınlaştırma bölgesi seçin"
+ "selectRegion": "Ayarlamak için bir yakınlaştırma bölgesi seçin",
+ "cursor": {
+ "title": "İmleç",
+ "show": "Görünür",
+ "hide": "Gizli"
+ }
},
"audio": {
"outputGain": "Çıkış seviyesi",
@@ -342,7 +347,8 @@
"themeDefault": "Varsayılan",
"clipToBounds": "Tuvale Kırp",
"motionBlur": "Hareket Bulanıklığı",
- "theme": "İmleç Stili"
+ "theme": "İmleç Stili",
+ "autoHide": "Hareketsizken gizle"
},
"export": {
"gifButton": "GIF Olarak Dışa Aktar",
diff --git a/src/i18n/locales/vi/settings.json b/src/i18n/locales/vi/settings.json
index ae6323e29..561db53d4 100644
--- a/src/i18n/locales/vi/settings.json
+++ b/src/i18n/locales/vi/settings.json
@@ -310,7 +310,12 @@
"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",
- "selectRegion": "Chọn vùng thu phóng để điều chỉnh"
+ "selectRegion": "Chọn vùng thu phóng để điều chỉnh",
+ "cursor": {
+ "title": "Con trỏ",
+ "show": "Hiện",
+ "hide": "Ẩn"
+ }
},
"audio": {
"outputGain": "Mức đầu ra",
@@ -342,7 +347,8 @@
"themeDefault": "Mặc định",
"clipToBounds": "Cắt theo khung",
"motionBlur": "Làm mờ chuyển động",
- "theme": "Kiểu con trỏ"
+ "theme": "Kiểu con trỏ",
+ "autoHide": "Ẩn khi không hoạt động"
},
"export": {
"gifButton": "Xuất GIF",
diff --git a/src/i18n/locales/zh-CN/settings.json b/src/i18n/locales/zh-CN/settings.json
index 316d6a2a9..53c04087c 100644
--- a/src/i18n/locales/zh-CN/settings.json
+++ b/src/i18n/locales/zh-CN/settings.json
@@ -310,7 +310,12 @@
"level": "缩放级别",
"previewHold": "按住预览放大效果",
"customScale": "自定义缩放",
- "selectRegion": "选择要调整的缩放区域"
+ "selectRegion": "选择要调整的缩放区域",
+ "cursor": {
+ "title": "光标",
+ "show": "显示",
+ "hide": "隐藏"
+ }
},
"audio": {
"outputGain": "输出电平",
@@ -342,7 +347,8 @@
"themeDefault": "默认",
"clipToBounds": "裁剪到画布",
"motionBlur": "运动模糊",
- "theme": "光标样式"
+ "theme": "光标样式",
+ "autoHide": "闲置时隐藏"
},
"export": {
"gifButton": "导出 GIF",
diff --git a/src/i18n/locales/zh-TW/settings.json b/src/i18n/locales/zh-TW/settings.json
index c878478ce..a7a4e922a 100644
--- a/src/i18n/locales/zh-TW/settings.json
+++ b/src/i18n/locales/zh-TW/settings.json
@@ -310,7 +310,12 @@
"level": "縮放級別",
"previewHold": "按住預覽放大效果",
"customScale": "自訂縮放",
- "selectRegion": "選擇要調整的縮放區域"
+ "selectRegion": "選擇要調整的縮放區域",
+ "cursor": {
+ "title": "游標",
+ "show": "顯示",
+ "hide": "隱藏"
+ }
},
"audio": {
"outputGain": "輸出音量",
@@ -342,7 +347,8 @@
"themeDefault": "預設",
"clipToBounds": "裁切至畫布",
"motionBlur": "動態模糊",
- "theme": "游標樣式"
+ "theme": "游標樣式",
+ "autoHide": "閒置時隱藏"
},
"export": {
"gifButton": "匯出 GIF",
diff --git a/src/lib/ai-edition/document/migrate.test.ts b/src/lib/ai-edition/document/migrate.test.ts
index 984faa795..da2f74c2b 100644
--- a/src/lib/ai-edition/document/migrate.test.ts
+++ b/src/lib/ai-edition/document/migrate.test.ts
@@ -111,6 +111,7 @@ describe("migrateProjectDataToAxcutDocument", () => {
rotationPreset: "iso",
customScale: 2.5,
source: "manual",
+ hideCursor: true,
},
],
},
@@ -125,6 +126,7 @@ describe("migrateProjectDataToAxcutDocument", () => {
expect(z.endMs).toBe(2000);
expect(z.customScale).toBe(2.5);
expect(z.rotationPreset).toBe("iso");
+ expect(z.hideCursor).toBe(true);
});
it("converts annotationRegions to seconds with type and content preserved", () => {
@@ -269,6 +271,7 @@ describe("migrateAxcutDocumentToProjectData", () => {
endMs: 2000,
depth: 4,
focus: { cx: 0.5, cy: 0.5 },
+ hideCursor: true,
},
],
annotationRegions: [
@@ -299,6 +302,7 @@ describe("migrateAxcutDocumentToProjectData", () => {
const back = migrateAxcutDocumentToProjectData(doc);
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.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 9315eb8c7..1f7dcc088 100644
--- a/src/lib/ai-edition/document/migrate.ts
+++ b/src/lib/ai-edition/document/migrate.ts
@@ -193,6 +193,7 @@ export function migrateProjectDataToAxcutDocument(
...(region.rotationPreset ? { rotationPreset: region.rotationPreset } : {}),
...(typeof region.customScale === "number" ? { customScale: region.customScale } : {}),
...(region.source === "auto" || region.source === "manual" ? { source: region.source } : {}),
+ ...(region.hideCursor ? { hideCursor: true } : {}),
}));
const migratedAnnotations: AxcutAnnotationRegion[] = annotationRegions
@@ -328,6 +329,7 @@ export function migrateAxcutDocumentToProjectData(input: AxcutDocument): EditorP
...(region.rotationPreset ? { rotationPreset: region.rotationPreset } : {}),
...(typeof region.customScale === "number" ? { customScale: region.customScale } : {}),
...(region.source ? { source: region.source } : {}),
+ ...(region.hideCursor ? { hideCursor: true } : {}),
}));
editor.zoomRegions = reverseZoomRegions;
diff --git a/src/lib/ai-edition/schema/index.ts b/src/lib/ai-edition/schema/index.ts
index 50ff31e14..5f6afb7b2 100644
--- a/src/lib/ai-edition/schema/index.ts
+++ b/src/lib/ai-edition/schema/index.ts
@@ -491,6 +491,7 @@ export const zoomRegionSchema = endGteStart(
rotationPreset: z.enum(["iso", "left", "right"]).optional(),
customScale: z.number().positive().optional(),
source: z.enum(["auto", "manual"]).optional(),
+ hideCursor: z.boolean().optional(),
}),
"endMs",
"startMs",
diff --git a/src/lib/ai-edition/store/documentWriteAudit.test.ts b/src/lib/ai-edition/store/documentWriteAudit.test.ts
index fa6f62a48..eaf367edd 100644
--- a/src/lib/ai-edition/store/documentWriteAudit.test.ts
+++ b/src/lib/ai-edition/store/documentWriteAudit.test.ts
@@ -296,6 +296,7 @@ const DECLARED: WritePath[] = [
w("src/lib/ai-edition/store/useTimeline.ts", "updateZoomDepth", "save", "gesture"),
w("src/lib/ai-edition/store/useTimeline.ts", "updateZoomFocusLive", "set", "automatic"),
w("src/lib/ai-edition/store/useTimeline.ts", "updateZoomFocusMode", "save", "gesture"),
+ w("src/lib/ai-edition/store/useTimeline.ts", "updateZoomHideCursor", "save", "gesture"),
w("src/lib/ai-edition/store/useTimeline.ts", "updateZoomRotation", "save", "gesture"),
w("src/lib/ai-edition/store/useTimeline.ts", "updateZoomSpan", "save", "gesture"),
// Source-dimension backfill for assets a migration left unprobed. On load, for
diff --git a/src/lib/ai-edition/store/editorSettings.test.ts b/src/lib/ai-edition/store/editorSettings.test.ts
index ec37d7176..3501d0e8f 100644
--- a/src/lib/ai-edition/store/editorSettings.test.ts
+++ b/src/lib/ai-edition/store/editorSettings.test.ts
@@ -121,6 +121,21 @@ describe("patchEditorSettings", () => {
expect(snap.cursor.smoothing).toBe(0.9);
});
+ it("toggles cursorAutoHide on and off via patch", () => {
+ const enabled = patchEditorSettings(baseDoc, { cursorAutoHide: true });
+ expect(getEditorSettings(enabled).cursorAutoHide).toBe(true);
+ expect(getEditorSettings(enabled).cursor.autoHide).toBe(true);
+
+ const disabled = patchEditorSettings(enabled, { cursorAutoHide: false });
+ expect(getEditorSettings(disabled).cursorAutoHide).toBe(false);
+ expect(getEditorSettings(disabled).cursor.autoHide).toBe(false);
+
+ // Also verify via nested cursor.autoHide patch
+ const nestedEnabled = patchEditorSettings(disabled, { cursor: { autoHide: true } });
+ expect(getEditorSettings(nestedEnabled).cursorAutoHide).toBe(true);
+ expect(getEditorSettings(nestedEnabled).cursor.autoHide).toBe(true);
+ });
+
it("does not mutate the source document", () => {
const before = getEditorSettings(baseDoc);
patchEditorSettings(baseDoc, { showBlur: true });
diff --git a/src/lib/ai-edition/store/editorSettings.ts b/src/lib/ai-edition/store/editorSettings.ts
index 4892b577f..079a0b7d1 100644
--- a/src/lib/ai-edition/store/editorSettings.ts
+++ b/src/lib/ai-edition/store/editorSettings.ts
@@ -108,6 +108,7 @@ export interface EditorSettingsSnapshot {
webcamBlurIntensity: number;
cursor: CursorVisualSettings;
cursorShow: boolean;
+ cursorAutoHide: boolean;
cursorTheme: string;
autoFocusAll: boolean;
}
@@ -144,8 +145,10 @@ export const DEFAULT_EDITOR_SETTINGS: EditorSettingsSnapshot = {
motionBlur: DEFAULT_CURSOR_MOTION_BLUR,
clickBounce: DEFAULT_CURSOR_CLICK_BOUNCE,
clipToBounds: DEFAULT_CURSOR_CLIP_TO_BOUNDS,
+ autoHide: false,
},
cursorShow: true,
+ cursorAutoHide: false,
cursorTheme: DEFAULT_CURSOR_THEME_ID,
autoFocusAll: false,
};
@@ -177,6 +180,7 @@ interface LegacyShape {
cursorClickBounce?: number;
cursorClipToBounds?: boolean;
cursorShow?: boolean;
+ cursorAutoHide?: boolean;
cursorTheme?: string;
autoFocusAll?: boolean;
}
@@ -206,6 +210,7 @@ export function getEditorSettings(doc: AxcutDocument | null | undefined): Editor
motionBlur: num(legacy?.cursorMotionBlur, DEFAULT_EDITOR_SETTINGS.cursor.motionBlur),
clickBounce: num(legacy?.cursorClickBounce, DEFAULT_EDITOR_SETTINGS.cursor.clickBounce),
clipToBounds: bool(legacy?.cursorClipToBounds, DEFAULT_EDITOR_SETTINGS.cursor.clipToBounds),
+ autoHide: bool(legacy?.cursorAutoHide, DEFAULT_EDITOR_SETTINGS.cursorAutoHide),
};
// The pan is authoritative and the rect's offset is rebuilt from it, so the two cannot
@@ -258,6 +263,7 @@ export function getEditorSettings(doc: AxcutDocument | null | undefined): Editor
),
cursor,
cursorShow: bool(legacy?.cursorShow, DEFAULT_EDITOR_SETTINGS.cursorShow),
+ cursorAutoHide: bool(legacy?.cursorAutoHide, DEFAULT_EDITOR_SETTINGS.cursorAutoHide),
cursorTheme: str(legacy?.cursorTheme, DEFAULT_EDITOR_SETTINGS.cursorTheme),
autoFocusAll: bool(legacy?.autoFocusAll, DEFAULT_EDITOR_SETTINGS.autoFocusAll),
};
@@ -283,7 +289,8 @@ export interface EditorSettingsPatch {
webcamBackgroundMode?: WebcamBackgroundMode;
webcamWallpaper?: string;
webcamBlurIntensity?: number;
- cursor?: Partial<CursorVisualSettings> & { theme?: string; show?: boolean };
+ cursor?: Partial<CursorVisualSettings> & { theme?: string; show?: boolean; autoHide?: boolean };
+ cursorAutoHide?: boolean;
autoFocusAll?: boolean;
}
@@ -310,7 +317,9 @@ function nextLegacy(current: LegacyShape | null, patch: EditorSettingsPatch): Le
if (c.clipToBounds !== undefined) next.cursorClipToBounds = c.clipToBounds;
if (c.theme !== undefined) next.cursorTheme = c.theme;
if (c.show !== undefined) next.cursorShow = c.show;
+ if (c.autoHide !== undefined) next.cursorAutoHide = c.autoHide;
}
+ if (patch.cursorAutoHide !== undefined) next.cursorAutoHide = patch.cursorAutoHide;
return next;
}
diff --git a/src/lib/ai-edition/store/useTimeline.test.ts b/src/lib/ai-edition/store/useTimeline.test.ts
index 9721e3d18..fa6cc96fd 100644
--- a/src/lib/ai-edition/store/useTimeline.test.ts
+++ b/src/lib/ai-edition/store/useTimeline.test.ts
@@ -675,6 +675,19 @@ describe("useTimeline zoom modifiers (rotation + focus mode)", () => {
});
});
+ it("updates hideCursor on a zoom region", async () => {
+ const { result } = renderTimeline();
+ await act(async () => {
+ await result.current.updateZoomHideCursor("zoom_a", true);
+ });
+ expect(useProjectStore.getState().document?.zoomRanges[0].hideCursor).toBe(true);
+
+ await act(async () => {
+ await result.current.updateZoomHideCursor("zoom_a", false);
+ });
+ expect(useProjectStore.getState().document?.zoomRanges[0].hideCursor).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();
diff --git a/src/lib/ai-edition/store/useTimeline.ts b/src/lib/ai-edition/store/useTimeline.ts
index 5241bb591..0a0e6bf03 100644
--- a/src/lib/ai-edition/store/useTimeline.ts
+++ b/src/lib/ai-edition/store/useTimeline.ts
@@ -748,6 +748,20 @@ export function useTimeline() {
[document, saveDocument],
);
+ const updateZoomHideCursor = useCallback(
+ async (id: string, hideCursor: boolean | undefined) => {
+ if (!document) return;
+ const next: AxcutDocument = {
+ ...document,
+ zoomRanges: patchPillById(document.zoomRanges, id, {
+ hideCursor: hideCursor ? true : undefined,
+ }) as AxcutDocument["zoomRanges"],
+ };
+ await saveDocument(next, { history: true });
+ },
+ [document, saveDocument],
+ );
+
const updateAnnotationSpan = useCallback(
async (id: string, startMs: number, endMs: number) => {
if (!document) return;
@@ -1496,6 +1510,7 @@ export function useTimeline() {
updateZoomDepth,
updateZoomRotation,
updateZoomFocusMode,
+ updateZoomHideCursor,
updateAnnotationSpan,
updateAnnotationLive,
commitAnnotationChange,
diff --git a/src/native/nativeCompositorStore.ts b/src/native/nativeCompositorStore.ts
index 65a1e2cc3..27b72f49e 100644
--- a/src/native/nativeCompositorStore.ts
+++ b/src/native/nativeCompositorStore.ts
@@ -143,6 +143,7 @@ export function pushAllNativeParams(settings: EditorSettingsSnapshot): void {
setNativeParam("webcamShape", settings.webcamMaskShape);
setNativeParam("cursorShow", settings.cursorShow);
+ setNativeParam("cursorAutoHide", settings.cursorAutoHide);
setNativeParam("cursorSize", settings.cursor.size);
setNativeParam("cursorClickBounce", settings.cursor.clickBounce);
setNativeParam("cursorSmoothing", settings.cursor.smoothing);
diff --git a/src/native/sceneDescription.test.ts b/src/native/sceneDescription.test.ts
index 346c1af3c..a581b5439 100644
--- a/src/native/sceneDescription.test.ts
+++ b/src/native/sceneDescription.test.ts
@@ -519,12 +519,14 @@ describe("buildSceneDescription.zoomRegions", () => {
depth: 4,
focus: { cx: 0.25, cy: 0.75 },
rotationPreset: "iso",
+ hideCursor: true,
});
const doc = makeDoc({ zoomRanges: [z] });
const { zoomRegions } = buildSceneDescription(doc);
expect(zoomRegions[0].focusX).toBe(0.25);
expect(zoomRegions[0].focusY).toBe(0.75);
expect(zoomRegions[0].rotation).toBe("iso");
+ expect(zoomRegions[0].hideCursor).toBe(true);
});
it("converts ms→sec for start/end", () => {
@@ -1014,6 +1016,7 @@ describe("buildSceneDescription.settings mapping", () => {
webcamMaskShape: "circle",
webcamMirrored: true,
cursorShow: false,
+ cursorAutoHide: true,
cursorTheme: "macos-dark",
},
});
@@ -1021,6 +1024,7 @@ describe("buildSceneDescription.settings mapping", () => {
expect(scene.layout.webcamShape).toBe("circle");
expect(scene.layout.webcamMirror).toBe(true);
expect(scene.cursor.show).toBe(false);
+ expect(scene.cursor.autoHide).toBe(true);
expect(scene.cursor.theme).toBe("macos-dark");
});
diff --git a/src/native/sceneDescription.ts b/src/native/sceneDescription.ts
index ce22db0ed..05e6407c3 100644
--- a/src/native/sceneDescription.ts
+++ b/src/native/sceneDescription.ts
@@ -87,9 +87,11 @@ export interface SceneZoomRegion {
* Native shows it when the playhead is parked on the cut and gates it HARD on its own
* span: no ease-in / ease-out window, and no chaining with a neighbouring zoom. That gate
* is what keeps the render cut — an export never composes a frame at those source times,
- * and a transition envelope would otherwise reach the kept frames beside the cut.
- * Omitted (not `false`) when there is no trim under the region. See issue #216. */
+ * and a transition envelope would otherwise reach the kept frames beside the cut. */
+ /** Omitted (not `false`) when there is no trim under the region. See issue #216. */
underTrim?: boolean;
+ /** When true, cursor is hidden during this zoom region. */
+ hideCursor?: boolean;
}
/** A "Full Camera" timeline region (from `legacyEditor.cameraFullscreenRegions`). Times in seconds. */
@@ -357,6 +359,7 @@ export interface SceneEffects {
/** Cursor rendering, from the editor settings. */
export interface SceneCursor {
show: boolean;
+ autoHide: boolean;
/** Direct scale (1 = default). */
size: number;
smoothing: number;
@@ -1020,6 +1023,7 @@ export function buildSceneDescription(
},
cursor: {
show: settings.cursorShow,
+ autoHide: settings.cursorAutoHide,
size: settings.cursor.size,
smoothing: settings.cursor.smoothing,
motionBlur: settings.cursor.motionBlur,
@@ -1061,6 +1065,7 @@ export function buildSceneDescription(
rotation: region.rotationPreset ?? null,
clipIndex: region.clipIndex,
...(region.underTrim ? { underTrim: true } : {}),
+ ...(region.hideCursor ? { hideCursor: true } : {}),
})),
annotations: projectedAnnotations
.map((region) => {