mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
Merge pull request #7125 from penpot/elenatorro-11842-fix-groups-rendering-on-drag
🐛 Fix Group extrect calculation
This commit is contained in:
@@ -772,22 +772,26 @@ impl Shape {
|
|||||||
rect.bottom += self.blur.value;
|
rect.bottom += self.blur.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For frames without clipping, extend the bounding rectangle to include all nested shapes
|
// For groups and 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
|
// This ensures that these containers properly encompass their content
|
||||||
if let Type::Frame(_) = &self.shape_type {
|
let include_children = match &self.shape_type {
|
||||||
if !self.clip_content {
|
Type::Group(_) => true,
|
||||||
for child_id in self.children_ids(false) {
|
Type::Frame(_) => !self.clip_content,
|
||||||
if let Some(child_shape) = shapes_pool.get(&child_id) {
|
_ => false,
|
||||||
// Create a copy of the child shape to apply any transformations
|
};
|
||||||
let mut transformed_element: Cow<Shape> = Cow::Borrowed(child_shape);
|
|
||||||
if let Some(modifier) = modifiers.get(&child_id) {
|
|
||||||
transformed_element.to_mut().apply_transform(modifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the child's extended rectangle and join it with the frame's rectangle
|
if include_children {
|
||||||
let child_extrect = transformed_element.extrect(shapes_pool, modifiers);
|
for child_id in self.children_ids(false) {
|
||||||
rect.join(child_extrect);
|
if let Some(child_shape) = shapes_pool.get(&child_id) {
|
||||||
|
// Create a copy of the child shape to apply any transformations
|
||||||
|
let mut transformed_element: Cow<Shape> = Cow::Borrowed(child_shape);
|
||||||
|
if let Some(modifier) = modifiers.get(&child_id) {
|
||||||
|
transformed_element.to_mut().apply_transform(modifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user