Offer intersection in the mask panel: an Intersect button and a third chip state
The pipeline could now keep only where two selections agree, but the panel had no way to ask for it: the part row's chip flipped between + and -, and the buttons under the parts joined an added or a subtracted correction. An "∩ Intersect" button joins a painted part that intersects, and the chip on a part row cycles + -> - -> ∩ and round, so an existing part can be turned into an intersection without being repainted. Both go through the same session calls as before, indexing Join::ALL, whose first two entries kept their places. The chip is now a tagged gesture, so it is in the gesture book.
This commit is contained in:
@@ -1534,6 +1534,31 @@ mod tests {
|
||||
assert_eq!(s.mask_feather(&id), 0.03, "and the base was left alone");
|
||||
}
|
||||
|
||||
/// TRACES: FR-DEV-19a
|
||||
/// The panel's third join reaches the layer: the "∩ Intersect" button
|
||||
/// joins an intersecting part, the part row reports it as the chip's third
|
||||
/// state, and cycling the chip on from there comes back round to a union.
|
||||
#[test]
|
||||
fn the_intersect_button_joins_a_part_that_intersects() {
|
||||
use dr_pipeline::mask::Join;
|
||||
let Some(mut s) = session() else {
|
||||
eprintln!("no adapter; skipping");
|
||||
return;
|
||||
};
|
||||
let id = s.add_gradient_mask(true).expect("radial");
|
||||
s.set_active_mask(Some(&id));
|
||||
|
||||
let index = s.add_mask_part(&id, 2).expect("a part was joined");
|
||||
let join = |s: &DevelopSession| {
|
||||
s.masks().get(&id).expect("layer").part(index).expect("part").join
|
||||
};
|
||||
assert_eq!(join(&s), Join::Intersect);
|
||||
assert_eq!(s.mask_parts(&id)[index].2, 2, "the chip shows ∩");
|
||||
|
||||
s.set_mask_part_join(&id, index, (2 + 1) % 3);
|
||||
assert_eq!(join(&s), Join::Union, "and the chip cycles back to +");
|
||||
}
|
||||
|
||||
/// TRACES: FR-DEV-3 | FR-UI-1
|
||||
/// The fault this pass exists for, stated as a test.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user