mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
refactor(roller): rename LV_ROLLER_MODE_INIFINITE -> LV_ROLLER_MODE_INFINITE
This commit is contained in:
parent
1b37ee8873
commit
4e5b262401
@ -22,6 +22,7 @@
|
||||
- fix(polygon draw) join adjacent points if they are on the same coordinate
|
||||
- fix(linemeter) fix invalidation when setting new value
|
||||
- fix(table) add missing invalidation when changeing cell type
|
||||
- refactor(roller) rename LV_ROLLER_MODE_INIFINITE -> LV_ROLLER_MODE_INFINITE
|
||||
|
||||
## v7.7.2 (17.11.2020)
|
||||
### Bugfixes
|
||||
|
@ -186,6 +186,11 @@ static inline lv_obj_t * lv_page_get_scrl(lv_obj_t * page)
|
||||
* V7.0 COMPATIBILITY
|
||||
*--------------------*/
|
||||
#if LV_USE_API_EXTENSION_V7
|
||||
|
||||
#if LV_USE_ROLLER
|
||||
#define LV_ROLLER_MODE_INFINITE LV_ROLLER_MODE_INIFINITE
|
||||
#endif
|
||||
|
||||
#if LV_USE_WIN
|
||||
|
||||
static inline lv_obj_t * lv_win_add_btn(lv_obj_t * win, const void * img_src)
|
||||
|
@ -177,7 +177,7 @@ void lv_roller_set_options(lv_obj_t * roller, const char * options, lv_roller_mo
|
||||
lv_label_set_text(label, options);
|
||||
}
|
||||
else {
|
||||
ext->mode = LV_ROLLER_MODE_INIFINITE;
|
||||
ext->mode = LV_ROLLER_MODE_INFINITE;
|
||||
|
||||
size_t opt_len = strlen(options) + 1; /*+1 to add '\n' after option lists*/
|
||||
char * opt_extra = _lv_mem_buf_get(opt_len * LV_ROLLER_INF_PAGES);
|
||||
@ -238,7 +238,7 @@ void lv_roller_set_selected(lv_obj_t * roller, uint16_t sel_opt, lv_anim_enable_
|
||||
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
|
||||
|
||||
/*In infinite mode interpret the new ID relative to the currently visible "page"*/
|
||||
if(ext->mode == LV_ROLLER_MODE_INIFINITE) {
|
||||
if(ext->mode == LV_ROLLER_MODE_INFINITE) {
|
||||
int32_t sel_opt_signed = sel_opt;
|
||||
uint16_t page = ext->sel_opt_id / LV_ROLLER_INF_PAGES;
|
||||
|
||||
@ -302,7 +302,7 @@ uint16_t lv_roller_get_selected(const lv_obj_t * roller)
|
||||
LV_ASSERT_OBJ(roller, LV_OBJX_NAME);
|
||||
|
||||
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
|
||||
if(ext->mode == LV_ROLLER_MODE_INIFINITE) {
|
||||
if(ext->mode == LV_ROLLER_MODE_INFINITE) {
|
||||
uint16_t real_id_cnt = ext->option_cnt / LV_ROLLER_INF_PAGES;
|
||||
return ext->sel_opt_id % real_id_cnt;
|
||||
}
|
||||
@ -355,7 +355,7 @@ uint16_t lv_roller_get_option_cnt(const lv_obj_t * roller)
|
||||
LV_ASSERT_OBJ(roller, LV_OBJX_NAME);
|
||||
|
||||
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
|
||||
if(ext->mode == LV_ROLLER_MODE_INIFINITE) {
|
||||
if(ext->mode == LV_ROLLER_MODE_INFINITE) {
|
||||
return ext->option_cnt / LV_ROLLER_INF_PAGES;
|
||||
}
|
||||
else {
|
||||
@ -1005,7 +1005,7 @@ static void inf_normalize(void * scrl)
|
||||
lv_obj_t * roller = lv_obj_get_parent(roller_scrl);
|
||||
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
|
||||
|
||||
if(ext->mode == LV_ROLLER_MODE_INIFINITE) {
|
||||
if(ext->mode == LV_ROLLER_MODE_INFINITE) {
|
||||
uint16_t real_id_cnt = ext->option_cnt / LV_ROLLER_INF_PAGES;
|
||||
ext->sel_opt_id = ext->sel_opt_id % real_id_cnt;
|
||||
ext->sel_opt_id += (LV_ROLLER_INF_PAGES / 2) * real_id_cnt; /*Select the middle page*/
|
||||
|
@ -37,7 +37,7 @@ extern "C" {
|
||||
/** Roller mode. */
|
||||
enum {
|
||||
LV_ROLLER_MODE_NORMAL, /**< Normal mode (roller ends at the end of the options). */
|
||||
LV_ROLLER_MODE_INIFINITE, /**< Infinite mode (roller can be scrolled forever). */
|
||||
LV_ROLLER_MODE_INFINITE, /**< Infinite mode (roller can be scrolled forever). */
|
||||
};
|
||||
|
||||
typedef uint8_t lv_roller_mode_t;
|
||||
|
Loading…
x
Reference in New Issue
Block a user