mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-20 03:18:06 +08:00
Better checks for invalid transforms in the transform cage (#831)
* Better checks for invalid transform * Fix resize cursor * Do not allow resizing with no width/height * Fix pivots for 0 width/height layers
This commit is contained in:
committed by
Keavon Chambers
parent
e4dc368ecc
commit
fa7116133b
@@ -374,7 +374,16 @@ impl Layer {
|
||||
}
|
||||
|
||||
pub fn layerspace_pivot(&self, font_cache: &FontCache) -> DVec2 {
|
||||
let [min, max] = self.aabb_for_transform(DAffine2::IDENTITY, font_cache).unwrap_or([DVec2::ZERO, DVec2::ONE]);
|
||||
let [mut min, max] = self.aabb_for_transform(DAffine2::IDENTITY, font_cache).unwrap_or([DVec2::ZERO, DVec2::ONE]);
|
||||
|
||||
// If the layer bounds are 0 in either axis then set them to one (to avoid div 0)
|
||||
if (max.x - min.x) < f64::EPSILON * 1000. {
|
||||
min.x = max.x - 1.;
|
||||
}
|
||||
if (max.y - min.y) < f64::EPSILON * 1000. {
|
||||
min.y = max.y - 1.;
|
||||
}
|
||||
|
||||
self.pivot * (max - min) + min
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user