diff --git a/examples/scroll/lv_example_scroll_3.c b/examples/scroll/lv_example_scroll_3.c index cdc496255..0b169f59f 100644 --- a/examples/scroll/lv_example_scroll_3.c +++ b/examples/scroll/lv_example_scroll_3.c @@ -17,7 +17,7 @@ static void float_btn_event_cb(lv_obj_t * float_btn, lv_event_t e) } /** - * Show an example to scroll snap + * Create a list a with a floating button */ void lv_example_scroll_3(void) { diff --git a/src/extra/themes/default/lv_theme_default.c b/src/extra/themes/default/lv_theme_default.c index cae528396..28b542185 100644 --- a/src/extra/themes/default/lv_theme_default.c +++ b/src/extra/themes/default/lv_theme_default.c @@ -252,7 +252,7 @@ static void style_init(void) style_init_reset(&styles->btn); lv_style_set_radius(&styles->btn, LV_DPX(16)); lv_style_set_bg_opa(&styles->btn, LV_OPA_COVER); - lv_style_set_bg_color(&styles->btn, lv_color_grey()); + lv_style_set_bg_color(&styles->btn, lv_color_grey_lighten_1()); lv_style_set_shadow_color(&styles->btn, lv_color_grey_lighten_2()); lv_style_set_shadow_width(&styles->btn, 1); lv_style_set_shadow_ofs_y(&styles->btn, LV_DPX(4)); @@ -435,13 +435,14 @@ static void style_init(void) lv_style_set_anim_time(&styles->ta_cursor, 400); style_init_reset(&styles->ta_placeholder); - lv_style_set_text_color(&styles->ta_placeholder, lv_color_grey_lighten_3()); + lv_style_set_text_color(&styles->ta_placeholder, lv_color_grey()); #endif #if LV_USE_CALENDAR style_init_reset(&styles->calendar_bg); lv_style_set_pad_all(&styles->calendar_bg, PAD_SMALL); lv_style_set_pad_gap(&styles->calendar_bg, PAD_SMALL / 2); + lv_style_set_radius(&styles->calendar_bg, 0); style_init_reset(&styles->calendar_day); lv_style_set_border_width(&styles->calendar_day, LV_DPX(1)); @@ -849,9 +850,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) #if LV_USE_SPINBOX else if(lv_obj_check_type(obj, &lv_spinbox_class)) { lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->card); + lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->pad_small); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_FOCUS_KEY, &styles->outline_primary); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_EDITED, &styles->outline_secondary); - lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_DEFAULT, &styles->bg_color_grey); + lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_FOCUSED, &styles->bg_color_primary); } #endif #if LV_USE_TILEVIEW diff --git a/src/extra/widgets/calendar/lv_calendar.c b/src/extra/widgets/calendar/lv_calendar.c index 6fef66f2d..b44a8a19e 100644 --- a/src/extra/widgets/calendar/lv_calendar.c +++ b/src/extra/widgets/calendar/lv_calendar.c @@ -249,6 +249,7 @@ static void my_constructor(lv_obj_t * obj, const lv_obj_t * copy) lv_obj_add_event_cb(obj, draw_event_cb, NULL); + } static void draw_event_cb(lv_obj_t * obj, lv_event_t e) diff --git a/src/extra/widgets/calendar/lv_calendar_header_arrow.c b/src/extra/widgets/calendar/lv_calendar_header_arrow.c index a1b9686f0..eadea9316 100644 --- a/src/extra/widgets/calendar/lv_calendar_header_arrow.c +++ b/src/extra/widgets/calendar/lv_calendar_header_arrow.c @@ -50,6 +50,7 @@ lv_obj_t * lv_calendar_header_arrow_create(lv_obj_t * parent, lv_obj_t * calenda lv_obj_set_style_pad_top(header, LV_PART_MAIN, LV_STATE_DEFAULT, lv_obj_get_style_pad_top(calendar, LV_PART_MAIN)); lv_obj_set_style_pad_bottom(header, LV_PART_MAIN, LV_STATE_DEFAULT, lv_obj_get_style_pad_bottom(calendar, LV_PART_MAIN)); lv_obj_set_style_pad_column(header, LV_PART_MAIN, LV_STATE_DEFAULT, lv_obj_get_style_pad_column(calendar, LV_PART_MAIN)); + lv_obj_set_style_radius(header, LV_PART_MAIN, LV_STATE_DEFAULT, lv_obj_get_style_radius(calendar, LV_PART_MAIN)); const lv_calendar_date_t * cur_date = lv_calendar_get_showed_date(calendar); diff --git a/src/extra/widgets/calendar/lv_calendar_header_dropdown.c b/src/extra/widgets/calendar/lv_calendar_header_dropdown.c index 0e2ffcf28..21a36458e 100644 --- a/src/extra/widgets/calendar/lv_calendar_header_dropdown.c +++ b/src/extra/widgets/calendar/lv_calendar_header_dropdown.c @@ -59,6 +59,7 @@ lv_obj_t * lv_calendar_header_dropdown_create(lv_obj_t * parent, lv_obj_t * cale lv_obj_set_style_pad_top(header, LV_PART_MAIN, LV_STATE_DEFAULT, lv_obj_get_style_pad_top(calendar, LV_PART_MAIN)); lv_obj_set_style_pad_bottom(header, LV_PART_MAIN, LV_STATE_DEFAULT, lv_obj_get_style_pad_bottom(calendar, LV_PART_MAIN)); lv_obj_set_style_pad_column(header, LV_PART_MAIN, LV_STATE_DEFAULT, lv_obj_get_style_pad_column(calendar, LV_PART_MAIN)); + lv_obj_set_style_radius(header, LV_PART_MAIN, LV_STATE_DEFAULT, lv_obj_get_style_radius(calendar, LV_PART_MAIN)); const lv_calendar_date_t * cur_date = lv_calendar_get_showed_date(calendar); diff --git a/src/extra/widgets/list/lv_list.c b/src/extra/widgets/list/lv_list.c index 600144ef1..81653057d 100644 --- a/src/extra/widgets/list/lv_list.c +++ b/src/extra/widgets/list/lv_list.c @@ -72,7 +72,7 @@ lv_obj_t * lv_list_add_text(lv_obj_t * list, const char * txt) lv_obj_t * lv_list_add_btn(lv_obj_t * list, const char * icon, const char * txt, lv_event_cb_t event_cb) { lv_obj_t * btn = lv_obj_create_from_class(&lv_list_btn_class, list, NULL); - lv_obj_set_width(btn, LV_SIZE_PCT(100)); + lv_obj_set_size(btn, LV_SIZE_PCT(100), LV_SIZE_CONTENT); lv_obj_add_event_cb(btn, event_cb, NULL); lv_obj_set_layout(btn, &lv_flex_inline); diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index 8c170b760..36831e860 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -912,6 +912,35 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param) } lv_obj_update_layout(obj, NULL); } + + + if(h_new) { + /*Be sure the bottom side is not remains scrolled in*/ + lv_coord_t st = lv_obj_get_scroll_top(obj); + lv_coord_t sb = lv_obj_get_scroll_bottom(obj); + if(sb < 0 && st > 0) { + sb = LV_MIN(st, -sb); + lv_obj_scroll_by(obj, 0, sb, LV_ANIM_OFF); + } + } + + if(w_new) { + lv_coord_t sl = lv_obj_get_scroll_left(obj); + lv_coord_t sr = lv_obj_get_scroll_right(obj); + if(lv_obj_get_base_dir(obj) != LV_BIDI_DIR_RTL) { + /*Be sure the left side is not remains scrolled in*/ + if(sr < 0 && sl > 0) { + sr = LV_MIN(sl, -sr); + lv_obj_scroll_by(obj, 0, sr, LV_ANIM_OFF); + } + } else { + /*Be sure the right side is not remains scrolled in*/ + if(sl < 0 && sr > 0) { + sr = LV_MIN(sr, -sl); + lv_obj_scroll_by(obj, 0, sl, LV_ANIM_OFF); + } + } + } } else if(sign == LV_SIGNAL_CHILD_CHG) { lv_obj_update_layout(obj, param); diff --git a/src/lv_widgets/lv_slider.c b/src/lv_widgets/lv_slider.c index 92e8e6797..48390b93d 100644 --- a/src/lv_widgets/lv_slider.c +++ b/src/lv_widgets/lv_slider.c @@ -87,7 +87,6 @@ static void lv_slider_constructor(lv_obj_t * obj, const lv_obj_t * copy) /*Init the new slider slider*/ if(copy == NULL) { lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLL_CHAIN); - lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_ext_click_area(obj, LV_DPX(8)); lv_obj_set_height(obj, LV_DPX(10)); diff --git a/src/lv_widgets/lv_switch.c b/src/lv_widgets/lv_switch.c index 0a5142735..3d1ea563f 100644 --- a/src/lv_widgets/lv_switch.c +++ b/src/lv_widgets/lv_switch.c @@ -78,7 +78,6 @@ static void lv_switch_constructor(lv_obj_t * obj, const lv_obj_t * copy) if(copy == NULL) { lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE); - lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_add_flag(obj, LV_OBJ_FLAG_CHECKABLE); lv_obj_set_size(obj, LV_DPX(60), LV_DPX(35)); }