diff --git a/node-graph/nodes/vector/src/vector_nodes.rs b/node-graph/nodes/vector/src/vector_nodes.rs index 778b9eeab5..39b6266c11 100644 --- a/node-graph/nodes/vector/src/vector_nodes.rs +++ b/node-graph/nodes/vector/src/vector_nodes.rs @@ -786,10 +786,21 @@ async fn extrude(_: impl Ctx, mut source: Table, direction: DVec2, joini } #[node_macro::node(category("Vector: Modifier"), path(core_types::vector))] -async fn box_warp(_: impl Ctx, content: Table, #[expose] rectangle: Table) -> Table { +async fn box_warp(_: impl Ctx, content: Table, #[expose] rectangle: Table, #[expose] combined: bool) -> Table { let Some((target, target_transform)) = rectangle.get(0).map(|rect| (rect.element, rect.transform)) else { return content; }; + + // Compute combined bounding box if needed + let combined_bbox = if combined { +content.iter() + .filter_map(|row| row.element.bounding_box_with_transform(row.transform)) + .reduce(|[min, max], [bbox_min, bbox_max]| { + [min.min(bbox_min), max.max(bbox_max)] + }) + } else { + None + }; content .into_iter() @@ -798,7 +809,7 @@ async fn box_warp(_: impl Ctx, content: Table, #[expose] rectangle: Tabl let vector = row.element; // Get the bounding box of the source vector geometry - let source_bbox = vector.bounding_box_with_transform(transform).unwrap_or([DVec2::ZERO, DVec2::ONE]); + let source_bbox = combined_bbox.unwrap_or_else(|| vector.bounding_box_with_transform(transform).unwrap_or([DVec2::ZERO, DVec2::ONE])); // Extract first 4 points from target shape to form the quadrilateral // Apply the target's transform to get points in world space