mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-24 19:48:12 +08:00
Differentiate between scale and dimensions (#570)
* Differentiate between scale and dimensions * Fix layout and naming of properties
This commit is contained in:
committed by
Keavon Chambers
parent
9ced465150
commit
0ee492a857
@@ -146,12 +146,23 @@ impl Layer {
|
||||
self.data.intersects_quad(transformed_quad, path, intersections)
|
||||
}
|
||||
|
||||
pub fn current_bounding_box_with_transform(&self, transform: DAffine2) -> Option<[DVec2; 2]> {
|
||||
pub fn aabounding_box_for_transform(&self, transform: DAffine2) -> Option<[DVec2; 2]> {
|
||||
self.data.bounding_box(transform)
|
||||
}
|
||||
|
||||
pub fn current_bounding_box(&self) -> Option<[DVec2; 2]> {
|
||||
self.current_bounding_box_with_transform(self.transform)
|
||||
pub fn aabounding_box(&self) -> Option<[DVec2; 2]> {
|
||||
self.aabounding_box_for_transform(self.transform)
|
||||
}
|
||||
pub fn bounding_transform(&self) -> DAffine2 {
|
||||
let scale = match self.aabounding_box_for_transform(DAffine2::IDENTITY) {
|
||||
Some([a, b]) => {
|
||||
let dimensions = b - a;
|
||||
DAffine2::from_scale(dimensions)
|
||||
}
|
||||
_ => DAffine2::IDENTITY,
|
||||
};
|
||||
|
||||
self.transform * scale
|
||||
}
|
||||
|
||||
pub fn as_folder_mut(&mut self) -> Result<&mut FolderLayer, DocumentError> {
|
||||
|
||||
Reference in New Issue
Block a user