feat(style): store layout and position coordinates as style properties
related to #2152
This commit is contained in:
@@ -122,7 +122,7 @@ void lv_bar_set_range(lv_obj_t * obj, int16_t min, int16_t max)
|
||||
bar->max_value = max;
|
||||
bar->min_value = min;
|
||||
|
||||
if(lv_bar_get_type(obj) != LV_BAR_TYPE_RANGE)
|
||||
if(lv_bar_get_mode(obj) != LV_BAR_MODE_RANGE)
|
||||
bar->start_value = min;
|
||||
|
||||
if(bar->cur_value > max) {
|
||||
@@ -136,13 +136,13 @@ void lv_bar_set_range(lv_obj_t * obj, int16_t min, int16_t max)
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
|
||||
void lv_bar_set_type(lv_obj_t * obj, lv_bar_type_t type)
|
||||
void lv_bar_set_mode(lv_obj_t * obj, lv_bar_mode_t mode)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
lv_bar_t * bar = (lv_bar_t *)obj;
|
||||
|
||||
bar->type = type;
|
||||
if(bar->type != LV_BAR_TYPE_RANGE) {
|
||||
bar->mode = mode;
|
||||
if(bar->mode != LV_BAR_MODE_RANGE) {
|
||||
bar->start_value = bar->min_value;
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ int16_t lv_bar_get_start_value(const lv_obj_t * obj)
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
lv_bar_t * bar = (lv_bar_t *)obj;
|
||||
|
||||
if(bar->type != LV_BAR_TYPE_RANGE) return bar->min_value;
|
||||
if(bar->mode != LV_BAR_MODE_RANGE) return bar->min_value;
|
||||
|
||||
return LV_BAR_GET_ANIM_VALUE(bar->start_value, bar->start_value_anim);
|
||||
}
|
||||
@@ -186,12 +186,12 @@ int16_t lv_bar_get_max_value(const lv_obj_t * obj)
|
||||
return bar->max_value;
|
||||
}
|
||||
|
||||
lv_bar_type_t lv_bar_get_type(lv_obj_t * obj)
|
||||
lv_bar_mode_t lv_bar_get_mode(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
lv_bar_t * bar = (lv_bar_t *)obj;
|
||||
|
||||
return bar->type;
|
||||
return bar->mode;
|
||||
}
|
||||
|
||||
/**********************
|
||||
@@ -207,7 +207,7 @@ static void lv_bar_constructor(lv_obj_t * obj, const lv_obj_t * copy)
|
||||
bar->max_value = 100;
|
||||
bar->start_value = 0;
|
||||
bar->cur_value = 0;
|
||||
bar->type = LV_BAR_TYPE_NORMAL;
|
||||
bar->mode = LV_BAR_MODE_NORMAL;
|
||||
|
||||
lv_bar_init_anim(obj, &bar->cur_value_anim);
|
||||
lv_bar_init_anim(obj, &bar->start_value_anim);
|
||||
@@ -223,7 +223,7 @@ static void lv_bar_constructor(lv_obj_t * obj, const lv_obj_t * copy)
|
||||
bar->start_value = copy_bar->start_value;
|
||||
bar->max_value = copy_bar->max_value;
|
||||
bar->cur_value = copy_bar->cur_value;
|
||||
bar->type = copy_bar->type;
|
||||
bar->mode = copy_bar->mode;
|
||||
|
||||
lv_bar_set_value(obj, bar->cur_value, LV_ANIM_OFF);
|
||||
}
|
||||
@@ -258,7 +258,7 @@ static void draw_indic(lv_obj_t * obj)
|
||||
int32_t range = bar->max_value - bar->min_value;
|
||||
bool hor = barw >= barh ? true : false;
|
||||
bool sym = false;
|
||||
if(bar->type == LV_BAR_TYPE_SYMMETRICAL && bar->min_value < 0 && bar->max_value > 0 &&
|
||||
if(bar->mode == LV_BAR_MODE_SYMMETRICAL && bar->min_value < 0 && bar->max_value > 0 &&
|
||||
bar->start_value == bar->min_value) sym = true;
|
||||
|
||||
/*Calculate the indicator area*/
|
||||
|
||||
Reference in New Issue
Block a user