fix(roller): fix typo in scaling; prevent division by zero (#7263)

This commit is contained in:
Paul Vogel 2024-11-12 22:22:03 -06:00 committed by GitHub
parent 590299a820
commit 547c2ef226
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -880,12 +880,20 @@ static void transform_vect_recursive(lv_obj_t * roller, lv_point_t * vect)
angle += lv_obj_get_style_transform_rotation(parent, 0);
int32_t zoom_act_x = lv_obj_get_style_transform_scale_x_safe(parent, 0);
int32_t zoom_act_y = lv_obj_get_style_transform_scale_y_safe(parent, 0);
scale_x = (scale_y * zoom_act_x) >> 8;
scale_x = (scale_x * zoom_act_x) >> 8;
scale_y = (scale_y * zoom_act_y) >> 8;
parent = lv_obj_get_parent(parent);
}
lv_point_t pivot = { 0, 0 };
if(scale_x == 0) {
scale_x = 1;
}
if(scale_y == 0) {
scale_y = 1;
}
scale_x = 256 * 256 / scale_x;
scale_y = 256 * 256 / scale_y;
lv_point_transform(vect, -angle, scale_x, scale_y, &pivot, false);