fix(obj) fix invalidation of objects on state change
This commit is contained in:
@@ -114,7 +114,7 @@ html_theme_options = {
|
||||
'logo_only': True,
|
||||
}
|
||||
# For site map generation
|
||||
html_baseurl = 'https://docs.lvgl.io/master/en/html/'
|
||||
html_baseurl = 'https://docs.lvgl.io/' + version + "/"
|
||||
sitemap_url_scheme = "{link}"
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
|
||||
@@ -19,7 +19,7 @@ PDF version: :download:`LVGL.pdf <LVGL.pdf>`
|
||||
<a href="porting/index.html"><img class="home-img" src="_static/img/home_3.png" alt="See how to port LVGL to any platform"></a>
|
||||
<a href="overview/index.html"><img class="home-img" src="_static/img/home_4.png" alt="Learn the how LVGL works in more detail"></a>
|
||||
<a href="widgets/index.html"><img class="home-img" src="_static/img/home_5.png" alt="Take a look at the description of the available widgets"></a>
|
||||
<a href="contributing/index.html"><img class="home-img" src="_static/img/home_6.png" alt="Be part of the development of LVGL"></a>
|
||||
<a href="CONTRIBUTING.html"><img class="home-img" src="_static/img/home_6.png" alt="Be part of the development of LVGL"></a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ void lv_example_dropdown_3(void)
|
||||
lv_dropdown_set_options(dropdown, "New project\n"
|
||||
"New file\n"
|
||||
"Save\n"
|
||||
"Save as\n"
|
||||
"Save as ...\n"
|
||||
"Open project\n"
|
||||
"Recent projects\n"
|
||||
"Preferences\n"
|
||||
|
||||
@@ -728,7 +728,7 @@ static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
|
||||
for(j = 0; tr->props[j] != 0 && tsi < STYLE_TRANSITION_MAX; j++) {
|
||||
uint32_t t;
|
||||
for(t = 0; t < tsi; t++) {
|
||||
lv_style_selector_t selector = lv_obj_style_get_selector_state(ts[t].selector);
|
||||
lv_style_selector_t selector = ts[t].selector;
|
||||
lv_state_t state_ts = lv_obj_style_get_selector_state(selector);
|
||||
lv_part_t part_ts = lv_obj_style_get_selector_part(selector);
|
||||
if(ts[t].prop == tr->props[j] && part_ts == part_act && state_ts >= state_act) break;
|
||||
@@ -756,11 +756,10 @@ static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
|
||||
|
||||
lv_mem_buf_release(ts);
|
||||
|
||||
if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_REDRAW_MAIN) {
|
||||
if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_REDRAW) {
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
|
||||
if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_LAYOUT) {
|
||||
else if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_LAYOUT) {
|
||||
lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ANY);
|
||||
}
|
||||
else if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD) {
|
||||
|
||||
@@ -365,27 +365,28 @@ _lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t sta
|
||||
lv_style_t * style = obj->styles[i].style;
|
||||
lv_style_value_t v;
|
||||
/*If there is layout difference on the main part, return immediately. There is no more serious difference*/
|
||||
_lv_style_state_cmp_t res_tmp = res;
|
||||
if(lv_style_get_prop(style, LV_STYLE_PAD_TOP, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_PAD_BOTTOM, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_PAD_LEFT, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_PAD_RIGHT, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_PAD_COLUMN, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_PAD_ROW, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_LAYOUT, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_TRANSLATE_X, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_TRANSLATE_Y, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_WIDTH, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_HEIGHT, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_MIN_WIDTH, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_MAX_WIDTH, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_MIN_HEIGHT, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_MAX_HEIGHT, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_BORDER_WIDTH, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
bool layout_diff = false;
|
||||
if(lv_style_get_prop(style, LV_STYLE_PAD_TOP, &v))layout_diff = true;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_PAD_BOTTOM, &v)) layout_diff = true;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_PAD_LEFT, &v)) layout_diff = true;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_PAD_RIGHT, &v)) layout_diff = true;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_PAD_COLUMN, &v)) layout_diff = true;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_PAD_ROW, &v)) layout_diff = true;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_LAYOUT, &v)) layout_diff = true;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_TRANSLATE_X, &v)) layout_diff = true;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_TRANSLATE_Y, &v)) layout_diff = true;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_WIDTH, &v)) layout_diff = true;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_HEIGHT, &v)) layout_diff = true;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_MIN_WIDTH, &v)) layout_diff = true;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_MAX_WIDTH, &v)) layout_diff = true;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_MIN_HEIGHT, &v)) layout_diff = true;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_MAX_HEIGHT, &v)) layout_diff = true;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_BORDER_WIDTH, &v)) layout_diff = true;
|
||||
|
||||
if(res_tmp == _LV_STYLE_STATE_CMP_DIFF_LAYOUT) {
|
||||
if(part_act == LV_PART_MAIN) return _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(part_act == LV_PART_SCROLLBAR) return _LV_STYLE_STATE_CMP_DIFF_REDRAW_MAIN;
|
||||
if(layout_diff) {
|
||||
if(part_act == LV_PART_MAIN) {
|
||||
return _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
}
|
||||
else {
|
||||
res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
continue;
|
||||
@@ -406,15 +407,7 @@ _lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t sta
|
||||
else if(lv_style_get_prop(style, LV_STYLE_SHADOW_OFS_Y, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_SHADOW_SPREAD, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(lv_style_get_prop(style, LV_STYLE_LINE_WIDTH, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else {
|
||||
if(res != _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD) {
|
||||
if((part_act == LV_PART_MAIN || part_act == LV_PART_SCROLLBAR)) {
|
||||
res = _LV_STYLE_STATE_CMP_DIFF_REDRAW_MAIN;
|
||||
} else if(res != _LV_STYLE_STATE_CMP_DIFF_REDRAW_MAIN) {
|
||||
res = _LV_STYLE_STATE_CMP_DIFF_REDRAW_PART;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(res == _LV_STYLE_STATE_CMP_SAME) res = _LV_STYLE_STATE_CMP_DIFF_REDRAW;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,7 @@ struct _lv_obj_t;
|
||||
|
||||
typedef enum {
|
||||
_LV_STYLE_STATE_CMP_SAME, /*The style properties in the 2 states are identical*/
|
||||
_LV_STYLE_STATE_CMP_DIFF_REDRAW_MAIN, /*The differences can be shown with a simple redraw*/
|
||||
_LV_STYLE_STATE_CMP_DIFF_REDRAW_PART, /*The differences can be shown with a simple redraw*/
|
||||
_LV_STYLE_STATE_CMP_DIFF_REDRAW, /*The differences can be shown with a simple redraw*/
|
||||
_LV_STYLE_STATE_CMP_DIFF_DRAW_PAD, /*The differences can be shown with a simple redraw*/
|
||||
_LV_STYLE_STATE_CMP_DIFF_LAYOUT, /*The differences can be shown with a simple redraw*/
|
||||
} _lv_style_state_cmp_t;
|
||||
|
||||
@@ -813,10 +813,11 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
|
||||
lv_obj_add_style(obj, &styles->card, 0);
|
||||
lv_obj_add_style(obj, &styles->pad_small, 0);
|
||||
lv_obj_add_style(obj, &styles->transition_delayed, 0);
|
||||
lv_obj_add_style(obj, &styles->pressed, LV_STATE_PRESSED);
|
||||
lv_obj_add_style(obj, &styles->transition_normal, LV_STATE_PRESSED);
|
||||
lv_obj_add_style(obj, &styles->pressed, LV_STATE_PRESSED);
|
||||
lv_obj_add_style(obj, &styles->outline_primary, LV_STATE_FOCUS_KEY);
|
||||
lv_obj_add_style(obj, &styles->outline_secondary, LV_STATE_EDITED);
|
||||
lv_obj_add_style(obj, &styles->transition_normal, LV_PART_INDICATOR);
|
||||
}
|
||||
else if(lv_obj_check_type(obj, &lv_dropdownlist_class)) {
|
||||
lv_obj_add_style(obj, &styles->card, 0);
|
||||
|
||||
Reference in New Issue
Block a user