EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust
Merge pull request #1730
Brandon Thomas10cf6690c494
diff --cc crates/engine/src/commands/prop_groups.rsindex 3a4c9657e,ea5bf9697..6f7d74aef--- a/crates/engine/src/commands/prop_groups.rs+++ b/crates/engine/src/commands/prop_groups.rs@@@ -190,9 -186,20 +202,21 @@@ pub(crate) fn paste_contents(s: &mut SeOk(json!({"contents": pasted.iter().map(|(_, u)| *u).collect::<Vec<_>>()}))}+ /// Where Merge Paths goes in `contents` when nothing is selected: before the first paint, so the+ /// paints still draw the merged path (the renderer drops the draws above a Merge Paths), else after+ /// the last path item.+ fn merge_spot(contents: &PropGroup) -> usize {+ let is = |n: &Node, ids: &[&str]| matches!(n, Node::Group(g) if ids.contains(&g.match_id.as_str()));+ let paints = ["fill", "stroke", "gfill", "gstroke"];+ match contents.children.iter().position(|n| is(n, &paints)) {+ Some(i) => i,+ None => contents.children.iter().rposition(|n| is(n, &["rect", "ellipse", "star", "path"])).map_or(0, |i| i + 1),+ }+ }+-/// Edit ▸ Duplicate with shape items selected: each is copied in place, above the original and-/// named as After Effects does ("Rectangle 1" → "Rectangle 2"), and the copies are selected.+/// Edit ▸ Duplicate with shape items, text animators or selectors selected: each is copied in+/// place, above the original and named as After Effects does ("Rectangle 1" → "Rectangle 2"),+/// and the copies are selected.pub(crate) fn duplicate_contents(s: &mut Session, items: &[(LayerId, Uid)]) -> Result<Value> {let c = "edit.duplicate";let cid = s.active_comp_id().ok_or(EngineError::NoComp)?;