From 30f852b62bb23e35bf7b7e6a37da60327943dcbf Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 18:13:55 -0800 Subject: [PATCH] 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. --- crates/effects/src/solids.rs | 10 ++++++---- crates/effects/src/solids/tests.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/crates/effects/src/solids.rs b/crates/effects/src/solids.rs index 07b10dfada..8ffcb1cef4 100644 --- a/crates/effects/src/solids.rs +++ b/crates/effects/src/solids.rs @@ -2412,11 +2412,13 @@ fn frame_of(doc: Option<&Document>, n: &Node, item: Option, 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 = built_solids_cast(INFLATE, &p, &parts, bounds, MAX_OBJECT_FACES, false, true) - .filter_map(|r| r.ok().flatten()) - .flat_map(|(f, _)| f) - .collect(); + .collect::, 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); diff --git a/crates/effects/src/solids/tests.rs b/crates/effects/src/solids/tests.rs index 986e575689..d2ad2cb0cc 100644 --- a/crates/effects/src/solids/tests.rs +++ b/crates/effects/src/solids/tests.rs @@ -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| { + 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(¢er).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(¢er).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]