Live Paint: triple-click test checks the face the planar map makes

The test for a triple-click whose first click makes the group now also
builds the planar map from the same two paths and checks that the face
at the click takes its fill from the square. The doc comment of the
double-click flood names the three points it checks along each edge
segment.
This commit is contained in:
dotCooCoo
2026-11-13 17:43:37 -08:00
parent 52aec70e19
commit 4dd3809f84
2 changed files with 12 additions and 2 deletions
@@ -331,8 +331,9 @@ fn lp_segments(pd: &PathData) -> Vec<kurbo::CubicBez> {
/// face that shares with a face already reached an edge that is hidden or draws no stroke
/// ([`unstroked`]). Hidden faces are not reached and do not pass the flood on. A face runs along an
/// edge segment over the part of it between the points nearest the ends of one of the face's
/// outline segments, when that part lies within [`LP_JOIN_TOL`] of the outline segment; one outline
/// segment can run along several edge segments. Two faces share the edge where those parts overlap
/// outline segments, when that part's points at a quarter, half and three quarters of its
/// parameter range lie within [`LP_JOIN_TOL`] of the outline segment; one outline segment can run
/// along several edge segments. Two faces share the edge where those parts overlap
/// along more than [`LP_JOIN_TOL`], so two faces that a Gap Detection gap parts on the same side of
/// an edge, whose parts only touch, do not.
fn flood_faces(group: &Node, start: NodeId) -> Vec<NodeId> {
+9
View File
@@ -1178,6 +1178,15 @@ fn bucket_triple_click_on_a_made_group_skips_open_paths() {
let mut look = Appearance::default_art();
look.set_fill(blue);
d.insert(Some(l), 1, Node::path(front, PathData::single(SubPath::polyline(&u, false)), look)).unwrap();
// The face the planar map makes there takes its fill from the square, as the group's would.
let shapes: Vec<vectorcraft_pathops::Shape> = [back, front]
.iter()
.enumerate()
.filter_map(|(k, id)| node_outline(d.node(*id)?).map(|(path, rule)| vectorcraft_pathops::Shape::new(path, rule, k as u64)))
.collect();
let (regions, _) = vectorcraft_pathops::live_paint(&shapes);
let face = regions.iter().find(|r| r.contains(Point::new(75.0, 25.0))).expect("a face at (75, 25)");
assert_eq!(face.top(), Some(0), "the square is the face's top shape");
let mut s = Selection::default();
s.set([back, front]);
let p = paint();