mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 02:48:12 +08:00
Add a document method that returns a layer's bounding box (#273)
* Add a document method that returns a layer's bounding box * Moved `use` to the top of the file * Add layer local bounding box method
This commit is contained in:
@@ -227,6 +227,16 @@ impl Document {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn layer_axis_aligned_bounding_box(&self, path: &[LayerId]) -> Result<[DVec2; 2], DocumentError> {
|
||||
let layer = self.layer(path)?;
|
||||
Ok(layer.bounding_box(self.root.transform * layer.transform, layer.style))
|
||||
}
|
||||
|
||||
pub fn layer_local_bounding_box(&self, path: &[LayerId]) -> Result<[DVec2; 2], DocumentError> {
|
||||
let layer = self.layer(path)?;
|
||||
Ok(layer.bounding_box(layer.transform, layer.style))
|
||||
}
|
||||
|
||||
fn mark_as_dirty(&mut self, path: &[LayerId]) -> Result<(), DocumentError> {
|
||||
let mut root = &mut self.root;
|
||||
root.cache_dirty = true;
|
||||
|
||||
Reference in New Issue
Block a user