Fix crashes related to 0-scale shapes (#777)

* Fix crashes when dragging the bounding box/transform cage of a 0-scale shape.

* Fix crashes when dragging the pivot point of a 0-scale shape

* Fix rotation computation on DAffine2 when scale.x is 0, avoids Nan display

* remove remaining log::info that I introduced in earlier commit

* Fix crash when updating the scale of a transform that was already 0.

* Fix NumberInput behaviour when the requested value changed is does not happen.

* Fix rotation computation when Scale X and Scale Y are both 0. Display 0. This also fixes crashes when modifying the rotation in such case
This commit is contained in:
Boutillier
2022-09-12 10:46:11 +02:00
committed by Keavon Chambers
parent 788552e10c
commit 54b63c3eb5
4 changed files with 41 additions and 11 deletions
@@ -158,9 +158,12 @@ impl Pivot {
for layer_path in document.selected_visible_layers() {
if let Ok(layer) = document.graphene_document.layer(layer_path) {
let transform = Self::get_layer_pivot_transform(layer_path, layer, document, font_cache);
let pivot = transform.inverse().transform_point2(position).into();
let layer_path = layer_path.to_owned();
responses.push_back(Operation::SetPivot { layer_path, pivot }.into());
let pivot = transform.inverse().transform_point2(position);
// Only update the pivot when computed position is finite. Infinite can happen when scale is 0.
if pivot.is_finite() {
let layer_path = layer_path.to_owned();
responses.push_back(Operation::SetPivot { layer_path, pivot: pivot.into() }.into());
}
}
}
}