Fix #2091 clear stale key and vertex selections around mask copy/paste

Selecting a mask group now clears the previous key selection, so Copy/Cut act
on the mask. Pasting masks clears the source mask's vertex selection, so Clear
removes the pasted mask rather than points of the source.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Jerome CAMUS
2026-10-30 08:38:28 +01:00
co-authored by Claude Sonnet 5.5
parent 685448a0b2
commit 73af2379d0
3 changed files with 33 additions and 3 deletions
+2 -3
View File
@@ -794,6 +794,8 @@ fn select_prop(s: &mut Session, p: &Value) -> Result<Value> {
if !add {
s.state.selected_props.clear();
s.state.selected_vertices.clear();
// Groups (masks, effects) have no keys of their own: don't leave the old selection's behind.
s.state.selected_keys.clear();
}
if !s.state.selected_layers.contains(&lid) {
s.state.selected_layers = vec![lid];
@@ -811,9 +813,6 @@ fn select_prop(s: &mut Session, p: &Value) -> Result<Value> {
&& let Some(pr) = s.active_comp().and_then(|c| c.layer(lid)).and_then(|l| l.props.find(uid))
{
let keys: Vec<KeyRef> = pr.keys.iter().map(|k| KeyRef { layer: lid, prop: uid, time: k.time }).collect();
if !add {
s.state.selected_keys.clear();
}
s.state.selected_keys.extend(keys);
}
Ok(Value::Null)
+2
View File
@@ -183,6 +183,8 @@ pub(crate) fn paste_masks(s: &mut Session, p: &Value) -> Result<Value> {
}
proj.next_id = next + 1;
st.selected_props = out.clone();
// The source mask's points (selected with it) must not outlive its selection.
st.selected_vertices.clear();
Ok(out)
})?;
Ok(json!({"masks": pasted.iter().map(|(_, u)| *u).collect::<Vec<_>>()}))