Nudge selected layers with the arrow keys from any panel but Project (#961)

The viewer.nudge shortcuts bailed out unless Composition, Viewer or Timeline
had focus, so with any other panel focused the arrows silently did nothing.
After Effects nudges from almost anywhere; only the Project panel owns the
arrows for its own keyboard navigation. Typing, dialogs, menus and selected
mask vertices still keep the keys.

Tests: arrow nudge from Effect Controls, no nudge from Project, Shift+arrow
10x, time untouched, click-row path.
This commit is contained in:
Vikram Bhaskaran
2026-10-13 00:39:37 +11:00
parent 9efe75330c
commit 341076359a
2 changed files with 95 additions and 6 deletions
+6 -6
View File
@@ -240,10 +240,11 @@ fn reveal_targets(app: &EffectcraftApp) -> Vec<u64> {
}
}
/// The arrow keys over the Composition panel or the Timeline: move the selected layers 1 pixel
/// at the viewer's magnification (`up`, `down`, `left`, `right`), 10 with Shift (`up10`…), as
/// After Effects does, so zoomed in they move by fractions of a comp pixel. Not while typing,
/// or with mask points selected.
/// The arrow keys nudge the selected layers 1 pixel at the viewer's magnification (`up`,
/// `down`, `left`, `right`), 10 with Shift (`up10`…), as After Effects does, so zoomed in
/// they move by fractions of a comp pixel. From any panel except Project (which owns the
/// arrow keys for its own keyboard navigation, #961); not while typing, with a dialog or
/// menu open, or with mask points selected.
fn nudge(app: &mut EffectcraftApp, ctx: &egui::Context, dir: &str) -> Result<Value, String> {
let (side, n) = match dir.strip_suffix("10") {
Some(side) => (side, 10.0),
@@ -257,8 +258,7 @@ fn nudge(app: &mut EffectcraftApp, ctx: &egui::Context, dir: &str) -> Result<Val
_ => return Err(format!("unknown nudge `{dir}`")),
};
let st = &app.session.state;
let over = matches!(app.ui.focused, PanelKind::Composition | PanelKind::Viewer(_) | PanelKind::Timeline);
if !over || st.selected_layers.is_empty() || st.text_edit.is_some() || !st.selected_vertices.is_empty() {
if app.ui.focused == PanelKind::Project || st.selected_layers.is_empty() || st.text_edit.is_some() || !st.selected_vertices.is_empty() {
return Ok(Value::Null);
}
// Screen pixels per comp pixel.