mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-23 05:58:12 +08:00
Cache calculation of bounding boxes with transforms (#3287)
* Cache calculation of bounding boxes with transforms * Reuse bounding boxes across for the same rotation * Cleanup code and add documentation * Add tests
This commit is contained in:
@@ -154,10 +154,7 @@ impl DocumentMetadata {
|
||||
pub fn bounding_box_with_transform(&self, layer: LayerNodeIdentifier, transform: DAffine2) -> Option<[DVec2; 2]> {
|
||||
self.click_targets(layer)?
|
||||
.iter()
|
||||
.filter_map(|click_target| match click_target.target_type() {
|
||||
ClickTargetType::Subpath(subpath) => subpath.bounding_box_with_transform(transform),
|
||||
ClickTargetType::FreePoint(_) => click_target.bounding_box_with_transform(transform),
|
||||
})
|
||||
.filter_map(|click_target| click_target.bounding_box_with_transform(transform))
|
||||
.reduce(Quad::combine_bounds)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user