🐛 Fix create empty text

This commit is contained in:
Alejandro Alonso
2025-11-11 08:35:16 +01:00
parent e1a275c7a9
commit 7594f1883b

View File

@@ -428,8 +428,17 @@ pub fn resize_matrix(
new_height: f32, new_height: f32,
) -> Matrix { ) -> Matrix {
let mut result = Matrix::default(); let mut result = Matrix::default();
let scale_width = new_width / child_bounds.width();
let scale_height = new_height / child_bounds.height(); let safe_scale = |value: f32, base: f32| -> f32 {
if !value.is_finite() || !base.is_finite() || is_close_to(base, 0.0) {
1.0
} else {
value / base
}
};
let scale_width = safe_scale(new_width, child_bounds.width());
let scale_height = safe_scale(new_height, child_bounds.height());
let center = child_bounds.center(); let center = child_bounds.center();
let mut parent_transform = parent_bounds.transform_matrix().unwrap_or_default(); let mut parent_transform = parent_bounds.transform_matrix().unwrap_or_default();