Include stroke thickness in the bounds of document exports sized to fit "All Artwork" or "Selection" (#4112)

* Include stroke thickness in the bounds of document exports sized to fit "All Artwork" or "Selection"

* Code review fixes
This commit is contained in:
Keavon Chambers
2026-05-06 02:05:19 -07:00
committed by GitHub
parent 05f6138b65
commit 9565d43481
4 changed files with 131 additions and 4 deletions

View File

@@ -243,10 +243,12 @@ impl NodeGraphExecutor {
graphene_std::application_io::ExportFormat::Raster
};
// Calculate the bounding box of the region to be exported (artboard bounds always contribute)
// Calculate the bounding box of the region to be exported (artboard bounds always contribute).
// `AllArtwork` and `Selection` expand vector layer bounds by the rendered stroke width so strokes
// drawn at render-time (without a `Solidify Stroke`) aren't clipped at the export canvas edge.
let bounds = match export_config.bounds {
ExportBounds::AllArtwork => document.network_interface.document_bounds_document_space(true),
ExportBounds::Selection => document.network_interface.selected_bounds_document_space(true, &[]),
ExportBounds::AllArtwork => document.network_interface.document_bounds_document_space_with_stroke(true),
ExportBounds::Selection => document.network_interface.selected_bounds_document_space_with_stroke(true, &[]),
ExportBounds::Artboard(id) => document.metadata().bounding_box_document(id),
}
.ok_or_else(|| "No bounding box".to_string())?;