Fix dropdown graphical issues.
The scrollbar would go out of bounds if DROPDOWN_PART_LIST had uneven padding. Also enable clip_corner feature to stop the selected item from overflowing.
This commit is contained in:
parent
8160748733
commit
2b9418c7f8
|
@ -26,7 +26,6 @@ static void theme_apply(lv_obj_t* obj, lv_theme_style_t name);
|
|||
**********************/
|
||||
static lv_theme_t theme;
|
||||
|
||||
static lv_style_t style_pad;
|
||||
static lv_style_t style_circle;
|
||||
|
||||
static lv_style_t style_bg;
|
||||
|
@ -77,12 +76,6 @@ static void style_init_reset(lv_style_t* style) {
|
|||
|
||||
static void basic_init(void) {
|
||||
|
||||
style_init_reset(&style_pad);
|
||||
lv_style_set_pad_top(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 30);
|
||||
lv_style_set_pad_bottom(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 30);
|
||||
lv_style_set_pad_left(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 40);
|
||||
lv_style_set_pad_right(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 40);
|
||||
|
||||
style_init_reset(&style_circle);
|
||||
lv_style_set_radius(&style_circle, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
|
||||
|
||||
|
@ -188,10 +181,12 @@ static void basic_init(void) {
|
|||
lv_style_set_pad_inner(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 50);
|
||||
|
||||
style_init_reset(&style_ddlist_list);
|
||||
lv_style_set_clip_corner(&style_ddlist_list, LV_STATE_DEFAULT, true);
|
||||
lv_style_set_text_line_space(&style_ddlist_list, LV_STATE_DEFAULT, LV_VER_RES / 25);
|
||||
lv_style_set_shadow_width(&style_ddlist_list, LV_STATE_DEFAULT, LV_VER_RES / 20);
|
||||
lv_style_set_shadow_color(&style_ddlist_list, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0));
|
||||
lv_style_set_bg_color(&style_ddlist_list, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0));
|
||||
lv_style_set_pad_all(&style_ddlist_list, LV_STATE_DEFAULT, 20);
|
||||
|
||||
style_init_reset(&style_ddlist_selected);
|
||||
lv_style_set_bg_opa(&style_ddlist_selected, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
|
@ -479,13 +474,11 @@ static void theme_apply(lv_obj_t* obj, lv_theme_style_t name) {
|
|||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_pad);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||
_lv_style_list_add_style(list, &style_box);
|
||||
_lv_style_list_add_style(list, &style_ddlist_list);
|
||||
_lv_style_list_add_style(list, &style_pad);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
|
|
|
@ -47,8 +47,6 @@ Metronome::Metronome(DisplayApp* app, Controllers::MotorController& motorControl
|
|||
bpbDropdown = lv_dropdown_create(lv_scr_act(), nullptr);
|
||||
bpbDropdown->user_data = this;
|
||||
lv_obj_set_event_cb(bpbDropdown, eventHandler);
|
||||
lv_obj_set_style_local_pad_left(bpbDropdown, LV_DROPDOWN_PART_MAIN, LV_STATE_DEFAULT, 20);
|
||||
lv_obj_set_style_local_pad_left(bpbDropdown, LV_DROPDOWN_PART_LIST, LV_STATE_DEFAULT, 20);
|
||||
lv_obj_set_size(bpbDropdown, 115, 50);
|
||||
lv_obj_align(bpbDropdown, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
|
||||
lv_dropdown_set_options(bpbDropdown, "1\n2\n3\n4\n5\n6\n7\n8\n9");
|
||||
|
|
Loading…
Reference in New Issue
Block a user