mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-27 11:57:48 +08:00
fix(roller): avoid divided-by-zero during draw event (#6285)
This commit is contained in:
@@ -474,7 +474,10 @@ static void draw_main(lv_event_t * e)
|
|||||||
|
|
||||||
/*Proportional position from the middle line.
|
/*Proportional position from the middle line.
|
||||||
*Will be 0 for the first option, and 1 for the last option (upscaled by << 14)*/
|
*Will be 0 for the first option, and 1 for the last option (upscaled by << 14)*/
|
||||||
label_y_prop = (label_y_prop << 14) / (lv_obj_get_height(label) - normal_label_font->line_height);
|
int32_t remain_h = lv_obj_get_height(label) - normal_label_font->line_height;
|
||||||
|
if(remain_h > 0) {
|
||||||
|
label_y_prop = (label_y_prop << 14) / remain_h;
|
||||||
|
}
|
||||||
|
|
||||||
/*We don't want the selected label start and end exactly where the normal label is as
|
/*We don't want the selected label start and end exactly where the normal label is as
|
||||||
*a larger font won't centered on selected area.*/
|
*a larger font won't centered on selected area.*/
|
||||||
|
|||||||
Reference in New Issue
Block a user