From 4dd3809f84aa85dc35e84c42822b07fc384172b5 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 13 Nov 2026 17:43:37 -0800 Subject: [PATCH] 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. --- crates/engine/src/cmd/buildcmds/live_paint.rs | 5 +++-- crates/tools/src/builder/tests.rs | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd/buildcmds/live_paint.rs b/crates/engine/src/cmd/buildcmds/live_paint.rs index 073b0f8bd5..b049f59f0c 100644 --- a/crates/engine/src/cmd/buildcmds/live_paint.rs +++ b/crates/engine/src/cmd/buildcmds/live_paint.rs @@ -331,8 +331,9 @@ fn lp_segments(pd: &PathData) -> Vec { /// 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 { diff --git a/crates/tools/src/builder/tests.rs b/crates/tools/src/builder/tests.rs index 80a2dbd7a4..1e22c67b26 100644 --- a/crates/tools/src/builder/tests.rs +++ b/crates/tools/src/builder/tests.rs @@ -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 = [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();