mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
fix(sw): make knob size calculation more intuitive
This commit is contained in:
parent
1900c21548
commit
5ec532dfd5
@ -173,7 +173,7 @@ static void draw_main(lv_event_t * e)
|
|||||||
/*Draw the knob*/
|
/*Draw the knob*/
|
||||||
lv_coord_t anim_value_x = 0;
|
lv_coord_t anim_value_x = 0;
|
||||||
lv_coord_t knob_size = lv_obj_get_height(obj);
|
lv_coord_t knob_size = lv_obj_get_height(obj);
|
||||||
lv_coord_t anim_length = obj->coords.x2 - bg_right - obj->coords.x1 - bg_left - knob_size;
|
lv_coord_t anim_length = lv_area_get_width(&obj->coords) - knob_size;
|
||||||
|
|
||||||
if(LV_SWITCH_IS_ANIMATING(sw)) {
|
if(LV_SWITCH_IS_ANIMATING(sw)) {
|
||||||
/* Use the animation's coordinate */
|
/* Use the animation's coordinate */
|
||||||
@ -190,7 +190,7 @@ static void draw_main(lv_event_t * e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
lv_area_t knob_area;
|
lv_area_t knob_area;
|
||||||
knob_area.x1 = obj->coords.x1 + bg_left + anim_value_x;
|
knob_area.x1 = obj->coords.x1 + anim_value_x;
|
||||||
knob_area.x2 = knob_area.x1 + knob_size;
|
knob_area.x2 = knob_area.x1 + knob_size;
|
||||||
|
|
||||||
knob_area.y1 = obj->coords.y1;
|
knob_area.y1 = obj->coords.y1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user