Merge pull request #1057 from pravdomil/claude/shortcut-toggles

This commit is contained in:
Brandon Thomas
2026-10-13 04:29:03 -04:00
9 changed files with 91 additions and 8 deletions
+1 -1
View File
@@ -676,7 +676,7 @@ pub fn invoke(app: &mut EffectcraftApp, ctx: &egui::Context, id: &str, params: V
crate::panels::timeline::zoom(app, ctx, k);
return Ok(Value::Null);
}
"timeline.zoomFit" => app.ui.timeline.pps = None,
"timeline.zoomFit" => crate::panels::timeline::toggle_fit_zoom(app, ctx),
"timeline.zoomFrameToggle" => crate::panels::timeline::toggle_frame_zoom(app, ctx),
"timeline.column" => {
let col = params.get("column").and_then(Value::as_str).ok_or("timeline.column: need `column`")?;
+15
View File
@@ -553,6 +553,21 @@ pub fn toggle_frame_zoom(app: &mut EffectcraftApp, ctx: &egui::Context) {
set_zoom(&mut app.ui.timeline, &comp, MAX_PPS, fit, cti, w as f64 / 2.0);
}
/// `Shift+;`: show the whole comp; from there, go back to the span it was pressed in.
pub fn toggle_fit_zoom(app: &mut EffectcraftApp, ctx: &egui::Context) {
let tl = &mut app.ui.timeline;
if let Some(pps) = tl.pps {
tl.before_fit = Some((tl.start, pps));
tl.pps = None;
tl.start = 0.0;
return;
}
let Some((start, pps)) = tl.before_fit.take() else { return };
let Some((_, w)) = ctx.data(|d| d.get_temp::<(f32, f32)>(egui::Id::new("timeline-graph-area"))) else { return };
let Some(comp) = app.session.active_comp_arc() else { return };
set_zoom(&mut app.ui.timeline, &comp, pps, fit_pps(w, &comp), start, 0.0);
}
/// Zoom the time ruler around the CTI.
pub fn zoom(app: &mut EffectcraftApp, ctx: &egui::Context, k: f64) {
let Some((_, w)) = ctx.data(|d| d.get_temp::<(f32, f32)>(egui::Id::new("timeline-graph-area"))) else { return };
+4
View File
@@ -331,6 +331,9 @@ pub struct TimelineState {
/// Visible span start (seconds) and pixels per second; None = fit comp.
pub start: f64,
pub pps: Option<f64>,
/// The span (`start`, `pps`) Zoom to Fit Comp left, which it goes back to when pressed again.
#[serde(skip)]
pub before_fit: Option<(f64, f64)>,
pub scroll_y: f32,
/// Left column area width.
pub columns_w: f32,
@@ -415,6 +418,7 @@ impl Default for TimelineState {
TimelineState {
start: 0.0,
pps: None,
before_fit: None,
scroll_y: 0.0,
columns_w: 560.0,
outline_scroll: 0.0,