Masks and Project panel: selecting a mask selects its points; linked Mask Feather; selection box (#203)

- Selecting a mask in the Timeline (its row or Mask Path), or a shape's
  Path, selects all its points, so dragging one in the viewer moves the
  whole mask, as in After Effects. Delete still removes the mask, and
  selecting another property deselects the points.
- Mask Feather has the chain link (Constrain Proportions, on by
  default, Alt edits one value) and no longer takes negative values;
  Scale's link shows as a toggle too.
- Dragging in the Project panel's empty area draws a selection box
  (Shift / Cmd adds); a click there deselects.

Tests: selecting_a_mask_selects_its_points,
mask_feather_values_are_linked_and_not_negative,
dragging_in_the_empty_area_box_selects_items.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018gnTnH3Jmk5zr4tMq1Mc9f
This commit is contained in:
Claude
2026-10-07 22:13:19 +00:00
parent b26f55a775
commit b4d2d58eeb
8 changed files with 208 additions and 18 deletions
+24
View File
@@ -95,3 +95,27 @@ fn label_swatch_opens_the_label_menu() {
assert_eq!(h.state().session.history.undo.len(), undo + 1);
assert!(h.query_by_label(&green).is_none(), "the menu closed after the choice");
}
/// Dragging from the Project panel's empty area draws a selection box that selects the rows it
/// touches; a click there deselects (#203).
#[test]
fn dragging_in_the_empty_area_box_selects_items() {
let (mut h, folder, _, solid) = harness();
let list = h.state().auto.find("project.empty").unwrap().rect;
let from = pos2(list[0] + 40.0, list[1] + list[3] - 6.0);
let to = center(&h, &format!("project.item.{}.name", folder.0));
h.input_mut().events.push(Event::PointerMoved(from));
h.step();
button(&mut h, from, true);
h.step();
for k in 1..=6 {
h.input_mut().events.push(Event::PointerMoved(from + (to - from) * (k as f32 / 6.0)));
h.step();
}
button(&mut h, to, false);
h.run_steps(2);
let sel = h.state().session.state.project_selection.clone();
assert!(sel.contains(&folder) && sel.contains(&solid), "{sel:?}");
click_at(&mut h, from);
assert!(h.state().session.state.project_selection.is_empty());
}
+33 -3
View File
@@ -1,6 +1,6 @@
//! Timeline rows for shape layers and keyframing: the Contents "Add:" menu and the Classic 3D
//! "Change Renderer…" row (#206), Alt+Shift+P revealing the key it adds, clicks below the layers
//! deselecting them and the toolbar's Stroke on a selected shape layer (#205).
//! Timeline rows for shape layers, masks and keyframing: the Contents "Add:" menu and the Classic
//! 3D "Change Renderer…" row (#206), Alt+Shift+P revealing the key it adds and clicks below the
//! layers deselecting them (#205), and Mask Feather's linked values (#203).
use effectcraft_engine::Session;
use effectcraft_engine::project::LayerId;
@@ -106,6 +106,36 @@ fn clicking_below_the_layers_deselects_them() {
assert!(h.state().session.state.selected_layers.is_empty());
}
#[test]
fn mask_feather_values_are_linked_and_not_negative() {
let mut s = session();
let l = s.execute("layer.newSolid", json!({"color": "#808080"})).unwrap()["layer"].as_u64().unwrap();
s.execute("layer.addMask", json!({"layer": l, "shape": "rect"})).unwrap();
let feather = |h: &Harness<'_, EffectcraftApp>| {
let p = h.state().session.active_comp().unwrap().layer(LayerId(l)).unwrap().props.prop("masks/#1/feather").unwrap().clone();
(p.uid, p.value.components())
};
let mut h = harness(s);
h.state_mut().ui.timeline.open_layers.insert(l);
h.state_mut().ui.timeline.layer_reveal.insert(l, vec!["feather".into()]);
h.run_steps(2);
let (uid, _) = feather(&h);
let type_value = |h: &mut Harness<'_, EffectcraftApp>, d: usize, v: &str| {
click(h, &format!("timeline.prop.{uid}.value.{d}"));
h.input_mut().events.push(Event::Text(v.into()));
h.step();
h.input_mut().events.push(Event::Key { key: Key::Enter, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::NONE });
h.run_steps(3);
};
type_value(&mut h, 0, "12");
assert_eq!(feather(&h).1, vec![12.0, 12.0], "linked by default");
type_value(&mut h, 1, "-5");
assert_eq!(feather(&h).1, vec![0.0, 0.0], "never negative");
click(&mut h, &format!("timeline.prop.{uid}.link"));
type_value(&mut h, 1, "7");
assert_eq!(feather(&h).1, vec![0.0, 7.0], "unlinked");
}
#[test]
fn toolbar_stroke_edits_the_selected_shape_layer() {
let mut s = session();