mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-12-01 15:53:26 -10:00
Fix crash when scaling something with 0 width or height (#1078)
* resolve NaN value when trying to change scale value from zero to other numbers * resolve NaN value when trying to change scale value from zero to other numbers --------- Co-authored-by: Keavon Chambers <[email protected]>
This commit is contained in:
1 parent
d6ab417bcb
commit
dbcb854cd2
2 files changed
+4
-1
No files matched your search
@@ -59,7 +59,7 @@ impl LayerData for ShapeLayer {
|
||||
|
||||
fn bounding_box(&self, transform: glam::DAffine2, _render_data: &RenderData) -> Option<[DVec2; 2]> {
|
||||
let mut subpath = self.shape.clone();
|
||||
if transform.matrix2 == DMat2::ZERO {
|
||||
if transform.matrix2 == DMat2::ZERO || !transform.is_finite() {
|
||||
return None;
|
||||
}
|
||||
subpath.apply_affine(transform);
|
||||
|
||||
@@ -48,6 +48,9 @@ pub fn apply_transform_operation(layer: &Layer, transform_op: TransformOp, value
|
||||
|
||||
// Find the delta transform
|
||||
let mut delta = layer.transform.inverse() * transform;
|
||||
if !delta.is_finite() {
|
||||
return layer.transform.to_cols_array();
|
||||
}
|
||||
|
||||
// Preserve aspect ratio
|
||||
if matches!(transform_op, TransformOp::ScaleX | TransformOp::Width) && layer.preserve_aspect {
|
||||
|
||||
Reference in new issue
Block a user