Merge pull request #7125 from penpot/elenatorro-11842-fix-groups-rendering-on-drag

🐛 Fix Group extrect calculation
This commit is contained in:
Alejandro Alonso
2025-08-18 09:36:58 +02:00
committed by GitHub

View File

@@ -772,10 +772,15 @@ impl Shape {
rect.bottom += self.blur.value;
}
// For frames without clipping, extend the bounding rectangle to include all nested shapes
// This ensures that frames properly encompass their content when clip_content is false
if let Type::Frame(_) = &self.shape_type {
if !self.clip_content {
// For groups and frames without clipping, extend the bounding rectangle to include all nested shapes
// This ensures that these containers properly encompass their content
let include_children = match &self.shape_type {
Type::Group(_) => true,
Type::Frame(_) => !self.clip_content,
_ => false,
};
if include_children {
for child_id in self.children_ids(false) {
if let Some(child_shape) = shapes_pool.get(&child_id) {
// Create a copy of the child shape to apply any transformations
@@ -784,13 +789,12 @@ impl Shape {
transformed_element.to_mut().apply_transform(modifier);
}
// Get the child's extended rectangle and join it with the frame's rectangle
// Get the child's extended rectangle and join it with the container's rectangle
let child_extrect = transformed_element.extrect(shapes_pool, modifiers);
rect.join(child_extrect);
}
}
}
}
rect
}