#637: double-clicking a layer's bar acts like its name; text layers edit their text

Double-clicking a text layer in the Timeline (its name or its bar) edits its text in the
Composition viewer with the whole text selected, as in After Effects; it used to open the rename
field (Enter still renames). The layer bar had no double-click at all: it now opens a precomp,
opens footage and solids in the Layer panel and edits text, like the name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Anton Iliashenko
2026-10-12 00:35:23 +02:00
co-authored by Claude Opus 5.5
parent 67434e9038
commit e108f460c4
3 changed files with 58 additions and 7 deletions
+20 -7
View File
@@ -563,6 +563,18 @@ pub fn begin_rename(app: &mut EffectcraftApp, ctx: &egui::Context) {
}
}
/// What double-clicking a layer's name or bar does, as in After Effects: a precomp opens, footage
/// and solids open in the Layer panel (paint happens there), text is edited in the viewer with the
/// whole text selected. `None`: the name renames, the bar does nothing.
fn double_click_action(layer: &Layer) -> Option<(String, serde_json::Value)> {
match &layer.source {
LayerSource::Comp { item } => Some(("comp.open".into(), json!({"comp": item.0}))),
LayerSource::Footage { .. } | LayerSource::Solid { .. } => Some(("layer.openLayer".into(), json!({"layer": layer.id.0}))),
LayerSource::Text => Some(("text.edit".into(), json!({"layer": layer.id.0}))),
_ => None,
}
}
/// Open the rename field on layer `id`; it takes the keyboard focus on its first frame only.
fn start_rename(ctx: &egui::Context, id: u64, name: &str) {
ctx.data_mut(|d| {
@@ -1870,13 +1882,9 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
}
}
if row_resp.double_clicked() {
match &layer.source {
LayerSource::Comp { item } => actions.push(("comp.open".into(), json!({"comp": item.0}))),
// Footage and solids open in the Layer panel (paint happens there).
LayerSource::Footage { .. } | LayerSource::Solid { .. } => {
actions.push(("layer.openLayer".into(), json!({"layer": layer.id.0})));
}
_ => start_rename(&ctx, layer.id.0, &layer.name),
match double_click_action(layer) {
Some(a) => actions.push(a),
None => start_rename(&ctx, layer.id.0, &layer.name),
}
}
layer_context_menu(&row_resp, layer, &mut actions);
@@ -2084,6 +2092,11 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
if lin.hovered() || lout.hovered() || lin.dragged() || lout.dragged() {
ctx.set_cursor_icon(egui::CursorIcon::ResizeHorizontal);
}
if body.double_clicked()
&& let Some(a) = double_click_action(layer)
{
actions.push(a);
}
let shift = ui.input(|i| i.modifiers.shift);
if let Some(layers) = (body.clicked() && shift).then(|| shift_range(&ctx, cid, &comp, &rows, &selected, layer.id)).flatten() {
// Shift-click: the layers from the last one clicked to this one, as in