3D: an Inflate frame places no handles when a fill's solid fails

When a later fill of an Inflate object could not be built, or the solids
together passed the face limit, the graphic frame kept the facets of the
solids built before it and showed graphic handles, while the art drew
its source path. The frame now places no handle in that case. A stroke
left out past its limits still places none of its own.
This commit is contained in:
dotCooCoo
2026-11-15 18:13:55 -08:00
parent 6658ceee58
commit 30f852b62b
2 changed files with 33 additions and 4 deletions
+6 -4
View File
@@ -2412,11 +2412,13 @@ fn frame_of(doc: Option<&Document>, n: &Node, item: Option<usize>, pick: &Pick<'
let (parts, bounds) = solid_parts(&shapes, b);
if fx.id == INFLATE {
// Inflate's graphics lie on its puffed front and back: the pieces the viewer sees place
// their handles. Solids that can't be built place none.
// their handles. A stroke left out places none of its own. When a fill's solid can't be
// built, or the solids together pass the limit, the art draws its source and no piece
// places a handle.
let built: Vec<Facet> = built_solids_cast(INFLATE, &p, &parts, bounds, MAX_OBJECT_FACES, false, true)
.filter_map(|r| r.ok().flatten())
.flat_map(|(f, _)| f)
.collect();
.collect::<Result<Vec<_>, String>>()
.map(|solids| solids.into_iter().flatten().flat_map(|(f, _)| f).collect())
.unwrap_or_default();
return Some(graphics::GraphicFrame::inflated(bounds, graphics::MembraneFrame::of(&built)));
}
let options = extrude_options(&p);
+27
View File
@@ -1206,6 +1206,33 @@ fn a_groups_solids_together_past_the_limit_draw_the_source() {
assert_eq!(three_d_wireframe_in(None, &past), Err(vectorcraft_three_d::TOO_COMPLEX_SOLID.to_string()));
}
/// An Inflate group whose second member's fill is past the limits draws its source art, and its
/// frame places no graphic handle on the first member's puff.
#[test]
fn an_inflate_frame_places_no_handle_when_a_fill_is_past_the_limits() {
let mut b = BezPath::new();
b.move_to((0.0, 0.0));
b.line_to((40_000.0, 0.0));
b.line_to((40_000.0, 40_000.0));
b.line_to((0.0, 40_000.0));
b.close_path();
let square = Node::path(NodeId(1), PathData::from_bezpath(&b), Appearance::basic(Paint::solid(RED), Paint::None, 0.0));
let view = json!({"rotationX": 0.0, "rotationY": 0.0, "rotationZ": 0.0});
let group = |members: Vec<Node>| {
let mut g = Node::group(NodeId(9999), members.into_iter().map(Arc::new).collect());
g.appearance.effects.push(fx(INFLATE, view.clone()));
g
};
let center = MappedGraphic::from_value(&json!({"symbol": "Mark"})).unwrap();
// The square alone builds, and the graphic's handle sits on its puff.
let alone = group(vec![square.clone()]);
assert!(graphic_frame(None, &alone, None).unwrap().handle(&center).is_some());
// 70,000 corners: more points than a fill's solid takes.
let past = group(vec![square, polygon_node(2, 70_000)]);
assert!(solid_art(&past).is_none(), "the source art draws");
assert!(graphic_frame(None, &past, None).unwrap().handle(&center).is_none());
}
/// A fill and strokes whose solids each fit, but not all of them together, draw the source art,
/// and the strokes after the one past the limit are not left out to make room.
#[test]