Merge pull request #1044 from pravdomil/claude/timeline-chevron-expand-tree-93231f
This commit is contained in:
@@ -2268,7 +2268,8 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
if *has_children {
|
||||
let tw = Rect::from_center_size(pos2(indent, cy), vec2(13.0, 13.0));
|
||||
if widgets::twirl(ui, tw, *open, egui::Id::new(("gtw", uid)), &t).clicked() {
|
||||
ui_actions.push(UiAct::ToggleGroup(*uid));
|
||||
// Alt/Cmd-click twirls the whole tree under the group (as on a layer).
|
||||
ui_actions.push(UiAct::ToggleGroup(layer.id.0, *uid, ui.input(|i| i.modifiers.alt || i.modifiers.command)));
|
||||
}
|
||||
app.auto.add(&format!("timeline.group.{uid}.twirl"), tw, name);
|
||||
}
|
||||
@@ -2337,7 +2338,7 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
actions.push(("prop.select".into(), json!({"layer": layer.id.0, "prop": uid, "selectKeys": false})));
|
||||
actions.push(("window.panel".into(), json!({"panel": "EffectControls"})));
|
||||
} else {
|
||||
ui_actions.push(UiAct::ToggleGroup(*uid));
|
||||
ui_actions.push(UiAct::ToggleGroup(layer.id.0, *uid, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3233,9 +3234,22 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
}
|
||||
}
|
||||
}
|
||||
UiAct::ToggleGroup(uid) => {
|
||||
if !app.ui.timeline.open_groups.remove(&uid) {
|
||||
app.ui.timeline.open_groups.insert(uid);
|
||||
UiAct::ToggleGroup(layer, uid, all) => {
|
||||
let tl = &mut app.ui.timeline;
|
||||
let open = !tl.open_groups.remove(&uid);
|
||||
if open {
|
||||
tl.open_groups.insert(uid);
|
||||
}
|
||||
if all && let Some(g) = comp.layer(LayerId(layer)).and_then(|l| find_group(&l.props, uid)) {
|
||||
let mut uids = vec![];
|
||||
walk_groups(g, &mut uids);
|
||||
for u in uids {
|
||||
if open {
|
||||
tl.open_groups.insert(u);
|
||||
} else {
|
||||
tl.open_groups.remove(&u);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
UiAct::SetTime(tt) => app.session.set_time(tt),
|
||||
@@ -3359,7 +3373,8 @@ fn layer_cells(
|
||||
|
||||
enum UiAct {
|
||||
ToggleLayer(u64, bool),
|
||||
ToggleGroup(u64),
|
||||
/// Layer, group uid, and whether the whole tree under the group follows.
|
||||
ToggleGroup(u64, u64, bool),
|
||||
SetTime(Tick),
|
||||
EndMerge,
|
||||
/// Composition Settings on its 3D Renderer tab.
|
||||
@@ -3367,12 +3382,21 @@ enum UiAct {
|
||||
}
|
||||
|
||||
fn walk_groups(g: &PropGroup, out: &mut Vec<u64>) {
|
||||
// Audio's Waveform row is not in the property tree; it twirls along.
|
||||
if g.match_id == "audio" {
|
||||
out.push(WAVE_BIT | g.uid);
|
||||
}
|
||||
for sg in g.groups() {
|
||||
out.push(sg.uid);
|
||||
walk_groups(sg, out);
|
||||
}
|
||||
}
|
||||
|
||||
/// The group `uid` anywhere under `g`.
|
||||
fn find_group(g: &PropGroup, uid: u64) -> Option<&PropGroup> {
|
||||
g.groups().find_map(|sg| if sg.uid == uid { Some(sg) } else { find_group(sg, uid) })
|
||||
}
|
||||
|
||||
/// A stroke's Dashes "+" / "−" buttons (add or remove a Dash/Gap pair).
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn dash_buttons(
|
||||
@@ -3940,6 +3964,21 @@ fn value_editor(
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// Alt/Cmd-click twirls Audio's Waveform row (not in the property tree) with the rest.
|
||||
#[test]
|
||||
fn the_waveform_row_twirls_with_its_tree() {
|
||||
let mut root = PropGroup::new(1, "", "");
|
||||
let mut audio = PropGroup::new(2, "audio", "Audio");
|
||||
audio.children.push(PropGroup::new(3, "x", "X").into());
|
||||
root.children.push(audio.into());
|
||||
let mut uids = vec![];
|
||||
walk_groups(&root, &mut uids);
|
||||
assert_eq!(uids, vec![2, WAVE_BIT | 2, 3]);
|
||||
let mut uids = vec![];
|
||||
walk_groups(find_group(&root, 2).unwrap(), &mut uids);
|
||||
assert_eq!(uids, vec![WAVE_BIT | 2, 3]);
|
||||
}
|
||||
|
||||
/// #710: with Time Display set to Frames the ruler labels are frame numbers (as under the
|
||||
/// CTI, from Start Numbering Frames At); otherwise seconds:frames.
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user