Respect 'Clip' on Artboards when exporting "All Artworks". (#1916)

* Add constraint_bounds function to Quad implementation

* Respect Clip property when exporting All Artworks and centering document using the ctrl + 0 hotkey.
Calculate  artboard_clip_bounds  and then constraint the  all_layer_bounds  to respect the bounds of the Clipped Artboards.

* Use parent_artboard to find ancestor artboards of each layer and constrain bounds if artboard is clipped

* Remove redundant comments
This commit is contained in:
Utsav Singh 2024-08-11 11:59:34 +05:30 committed by GitHub
parent 193f757c45
commit 1b6d45ad30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 34 additions and 1 deletions

View file

@ -49,6 +49,14 @@ impl Quad {
[a[0].min(b[0]), a[1].max(b[1])]
}
/// "Clip" bounds of 'a' to the limits of 'b'
pub fn constraint_bounds(a: [DVec2; 2], b: [DVec2; 2]) -> [DVec2; 2] {
[
a[0].max(b[0]), // Constrain min corner
a[1].min(b[1]), // Constrain max corner
]
}
/// Expand a quad by a certain amount on all sides.
///
/// Not currently very optimised