mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
fix(indev): prevent division by zero (#7354)
This commit is contained in:
parent
ecfed6bc07
commit
78be963c22
@ -1428,6 +1428,14 @@ static void indev_proc_release(lv_indev_t * indev)
|
|||||||
parent = lv_obj_get_parent(parent);
|
parent = lv_obj_get_parent(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(scale_x == 0) {
|
||||||
|
scale_x = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(scale_y == 0) {
|
||||||
|
scale_y = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if(angle != 0 || scale_y != LV_SCALE_NONE || scale_x != LV_SCALE_NONE) {
|
if(angle != 0 || scale_y != LV_SCALE_NONE || scale_x != LV_SCALE_NONE) {
|
||||||
angle = -angle;
|
angle = -angle;
|
||||||
scale_x = (256 * 256) / scale_x;
|
scale_x = (256 * 256) / scale_x;
|
||||||
|
@ -76,6 +76,14 @@ void lv_indev_scroll_handler(lv_indev_t * indev)
|
|||||||
parent = lv_obj_get_parent(parent);
|
parent = lv_obj_get_parent(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(scale_x == 0) {
|
||||||
|
scale_x = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(scale_y == 0) {
|
||||||
|
scale_y = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if(angle != 0 || scale_x != LV_SCALE_NONE || scale_y != LV_SCALE_NONE) {
|
if(angle != 0 || scale_x != LV_SCALE_NONE || scale_y != LV_SCALE_NONE) {
|
||||||
angle = -angle;
|
angle = -angle;
|
||||||
scale_x = (256 * 256) / scale_x;
|
scale_x = (256 * 256) / scale_x;
|
||||||
@ -292,6 +300,14 @@ lv_obj_t * lv_indev_find_scroll_obj(lv_indev_t * indev)
|
|||||||
parent = lv_obj_get_parent(parent);
|
parent = lv_obj_get_parent(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(scale_x == 0) {
|
||||||
|
scale_x = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(scale_y == 0) {
|
||||||
|
scale_y = 1;
|
||||||
|
}
|
||||||
|
|
||||||
lv_point_t obj_scroll_sum = indev->pointer.scroll_sum;
|
lv_point_t obj_scroll_sum = indev->pointer.scroll_sum;
|
||||||
if(angle != 0 || scale_x != LV_SCALE_NONE || scale_y != LV_SCALE_NONE) {
|
if(angle != 0 || scale_x != LV_SCALE_NONE || scale_y != LV_SCALE_NONE) {
|
||||||
angle = -angle;
|
angle = -angle;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user