Skip to content

Conversation

@Sahil-Gupta584
Copy link

Closes #3422

Preview:

cursorful-video-1767970758932.mp4

Since we dont have any layer to export, only an infinite canvas is left though which we can calculate the bounding box.

I tried to create bounding box around extreme drawing points, but still as you can see the final exported image in preview is weird, is it ok ?or what i am thinking is when export mode is all-artwork i can apply 10% (or more) padding to it.

@Sahil-Gupta584 Sahil-Gupta584 marked this pull request as draft January 9, 2026 15:16
Comment on lines +1198 to +1210
let non_layer_export_bounds = self
.document_network()
.exports
.iter()
.filter_map(|export| {
if let NodeInput::Node { node_id, .. } = export {
if !self.is_layer(node_id, &[]) {
return self.document_metadata().bounding_box_document(LayerNodeIdentifier::new_unchecked(*node_id));
}
}
None
})
.reduce(Quad::combine_bounds);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't do anything since only layers are put into the bounding box. This is always None.

.reduce(Quad::combine_bounds)
.reduce(Quad::combine_bounds);

let root_artwork_bounds = self.document_metadata().bounding_box_document(LayerNodeIdentifier::ROOT_PARENT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The transform_to_viewport doesn't work for the LayerNodeIdentifier::ROOT_PARENT for legacy reasons. This causes the bounds here to be incorrect.

pub fn transform_to_viewport(&self, layer: LayerNodeIdentifier) -> DAffine2 {
// We're not allowed to convert the root parent to a node id
if layer == LayerNodeIdentifier::ROOT_PARENT {
return self.document_to_viewport;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Export fails for documents with vector data direcly connected to canvas

2 participants