Add support for folder bounding boxes (#276)

This commit is contained in:
Simon Desloges
2021-07-16 16:34:04 +02:00
committed by Keavon Chambers
parent 59b817301d
commit 783b7801e6
3 changed files with 48 additions and 8 deletions
+6 -2
View File
@@ -175,8 +175,12 @@ impl Layer {
self.data.to_kurbo_path(self.transform, self.style)
}
pub fn bounding_box(&self, transform: glam::DAffine2, style: style::PathStyle) -> [DVec2; 2] {
self.data.bounding_box(transform, style)
pub fn bounding_box(&self, transform: glam::DAffine2, style: style::PathStyle) -> Option<[DVec2; 2]> {
if let Ok(folder) = self.as_folder() {
folder.bounding_box(transform)
} else {
Some(self.data.bounding_box(transform, style))
}
}
pub fn as_folder_mut(&mut self) -> Result<&mut Folder, DocumentError> {