minor fixes
This commit is contained in:
@@ -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)
|
void lv_example_scroll_3(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ static void style_init(void)
|
|||||||
style_init_reset(&styles->btn);
|
style_init_reset(&styles->btn);
|
||||||
lv_style_set_radius(&styles->btn, LV_DPX(16));
|
lv_style_set_radius(&styles->btn, LV_DPX(16));
|
||||||
lv_style_set_bg_opa(&styles->btn, LV_OPA_COVER);
|
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_color(&styles->btn, lv_color_grey_lighten_2());
|
||||||
lv_style_set_shadow_width(&styles->btn, 1);
|
lv_style_set_shadow_width(&styles->btn, 1);
|
||||||
lv_style_set_shadow_ofs_y(&styles->btn, LV_DPX(4));
|
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);
|
lv_style_set_anim_time(&styles->ta_cursor, 400);
|
||||||
|
|
||||||
style_init_reset(&styles->ta_placeholder);
|
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
|
#endif
|
||||||
|
|
||||||
#if LV_USE_CALENDAR
|
#if LV_USE_CALENDAR
|
||||||
style_init_reset(&styles->calendar_bg);
|
style_init_reset(&styles->calendar_bg);
|
||||||
lv_style_set_pad_all(&styles->calendar_bg, PAD_SMALL);
|
lv_style_set_pad_all(&styles->calendar_bg, PAD_SMALL);
|
||||||
lv_style_set_pad_gap(&styles->calendar_bg, PAD_SMALL / 2);
|
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);
|
style_init_reset(&styles->calendar_day);
|
||||||
lv_style_set_border_width(&styles->calendar_day, LV_DPX(1));
|
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
|
#if LV_USE_SPINBOX
|
||||||
else if(lv_obj_check_type(obj, &lv_spinbox_class)) {
|
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->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_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_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
|
#endif
|
||||||
#if LV_USE_TILEVIEW
|
#if LV_USE_TILEVIEW
|
||||||
|
|||||||
@@ -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);
|
lv_obj_add_event_cb(obj, draw_event_cb, NULL);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draw_event_cb(lv_obj_t * obj, lv_event_t e)
|
static void draw_event_cb(lv_obj_t * obj, lv_event_t e)
|
||||||
|
|||||||
@@ -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_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_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_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);
|
const lv_calendar_date_t * cur_date = lv_calendar_get_showed_date(calendar);
|
||||||
|
|
||||||
|
|||||||
@@ -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_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_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_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);
|
const lv_calendar_date_t * cur_date = lv_calendar_get_showed_date(calendar);
|
||||||
|
|
||||||
|
|||||||
@@ -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 * 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_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_add_event_cb(btn, event_cb, NULL);
|
||||||
lv_obj_set_layout(btn, &lv_flex_inline);
|
lv_obj_set_layout(btn, &lv_flex_inline);
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
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) {
|
else if(sign == LV_SIGNAL_CHILD_CHG) {
|
||||||
lv_obj_update_layout(obj, param);
|
lv_obj_update_layout(obj, param);
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ static void lv_slider_constructor(lv_obj_t * obj, const lv_obj_t * copy)
|
|||||||
/*Init the new slider slider*/
|
/*Init the new slider slider*/
|
||||||
if(copy == NULL) {
|
if(copy == NULL) {
|
||||||
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLL_CHAIN);
|
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_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
|
||||||
lv_obj_set_ext_click_area(obj, LV_DPX(8));
|
lv_obj_set_ext_click_area(obj, LV_DPX(8));
|
||||||
lv_obj_set_height(obj, LV_DPX(10));
|
lv_obj_set_height(obj, LV_DPX(10));
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ static void lv_switch_constructor(lv_obj_t * obj, const lv_obj_t * copy)
|
|||||||
|
|
||||||
if(copy == NULL) {
|
if(copy == NULL) {
|
||||||
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
|
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_add_flag(obj, LV_OBJ_FLAG_CHECKABLE);
|
||||||
lv_obj_set_size(obj, LV_DPX(60), LV_DPX(35));
|
lv_obj_set_size(obj, LV_DPX(60), LV_DPX(35));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user