M5.14: J / K stop at the work area; the Info panel shows a selected keyframe

- Go to Next / Previous Keyframe (K / J) also stops at the work area's start and end, as in
  After Effects.
- With one keyframe selected, the Info panel shows its property, time and value instead of
  "1 keyframes selected".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bflatastic
2026-10-05 08:05:03 +07:00
co-authored by Claude Opus 5.5
parent 43bf2906d3
commit dfb0227468
3 changed files with 39 additions and 8 deletions
+19 -7
View File
@@ -101,13 +101,25 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
p.text(pos2(x0, ly), Align2::LEFT_CENTER, format!("Render: {ms:.0} ms • UI {:.0} fps{rq}", app.fps), Tokens::ui(11.5), t.text_faint);
}
if !app.session.state.selected_keys.is_empty() {
p.text(
pos2(x0, ly + 18.0),
Align2::LEFT_CENTER,
format!("{} keyframes selected", app.session.state.selected_keys.len()),
Tokens::ui(11.5),
t.text_dim,
);
// One key: its property, time and value (as After Effects' Info panel shows them).
let sel = &app.session.state.selected_keys;
let one = match sel.as_slice() {
[k] => c.layer(k.layer).and_then(|l| {
let pr = l.props.find(k.prop)?;
let key = pr.keys.iter().find(|x| x.time == k.time)?;
let tc = crate::panels::timecode(&app.session, &c, l.comp_time(k.time));
let v = match &key.value {
effectcraft_engine::keyframe::Value::Scalar(v) => format!("{v:.2}"),
effectcraft_engine::keyframe::Value::Vec2(v) => format!("{:.1}, {:.1}", v[0], v[1]),
effectcraft_engine::keyframe::Value::Vec3(v) => format!("{:.1}, {:.1}, {:.1}", v[0], v[1], v[2]),
_ => String::new(),
};
Some(format!("{} {tc} {v}", pr.name).trim_end().to_string())
}),
_ => None,
};
let line = one.unwrap_or_else(|| format!("{} keyframes selected", sel.len()));
p.text(pos2(x0, ly + 18.0), Align2::LEFT_CENTER, line, Tokens::ui(11.5), t.text_dim);
}
}
}