rework arc
This commit is contained in:
@@ -103,8 +103,7 @@ lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
/*Init the new arc arc*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_click(arc, true);
|
||||
lv_obj_add_protect(arc, LV_PROTECT_PRESS_LOST);
|
||||
lv_obj_add_flag(arc, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_ext_click_area(arc, LV_DPI / 10, LV_DPI / 10, LV_DPI / 10, LV_DPI / 10);
|
||||
lv_arc_set_value(arc, ext->min_value);
|
||||
lv_theme_apply(arc, LV_THEME_ARC);
|
||||
@@ -129,7 +128,7 @@ lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_style_list_copy(&ext->style_arc, ©_ext->style_arc);
|
||||
|
||||
/*Refresh the style with new signal function*/
|
||||
lv_obj_refresh_style(arc, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
|
||||
_lv_obj_refresh_style(arc, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
|
||||
}
|
||||
|
||||
LV_LOG_INFO("arc created");
|
||||
@@ -700,22 +699,23 @@ static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area
|
||||
static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param)
|
||||
{
|
||||
lv_res_t res;
|
||||
if(sign == LV_SIGNAL_GET_STYLE) {
|
||||
lv_get_style_info_t * info = param;
|
||||
info->result = lv_arc_get_style(arc, info->part);
|
||||
if(info->result != NULL) return LV_RES_OK;
|
||||
else return ancestor_signal(arc, sign, param);
|
||||
}
|
||||
|
||||
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(arc, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
|
||||
|
||||
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
|
||||
|
||||
if(sign == LV_SIGNAL_PRESSING) {
|
||||
if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
return _lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_GET_STYLE) {
|
||||
lv_get_style_info_t * info = param;
|
||||
info->result = lv_arc_get_style(arc, info->part);
|
||||
if(info->result != NULL) return LV_RES_OK;
|
||||
else return ancestor_signal(arc, sign, param);
|
||||
} else if(sign == LV_SIGNAL_PRESSING) {
|
||||
/* Only adjustable arcs can be dragged */
|
||||
if(!ext->adjustable) return res;
|
||||
|
||||
@@ -832,8 +832,8 @@ static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param)
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CLEANUP) {
|
||||
lv_obj_clean_style_list(arc, LV_ARC_PART_KNOB);
|
||||
lv_obj_clean_style_list(arc, LV_ARC_PART_INDIC);
|
||||
_lv_obj_reset_style_list_no_refr(arc, LV_ARC_PART_KNOB);
|
||||
_lv_obj_reset_style_list_no_refr(arc, LV_ARC_PART_INDIC);
|
||||
}
|
||||
|
||||
return res;
|
||||
@@ -901,7 +901,7 @@ static void inv_arc_area(lv_obj_t * arc, uint16_t start_angle, uint16_t end_angl
|
||||
extra_area = rounded ? w / 2 + 2 : 0;
|
||||
|
||||
if(part == LV_ARC_PART_INDIC && lv_style_list_get_style(&ext->style_knob, 0) != NULL) {
|
||||
lv_coord_t knob_extra_size = lv_obj_get_draw_rect_ext_pad_size(arc, LV_ARC_PART_KNOB);
|
||||
lv_coord_t knob_extra_size = _lv_obj_get_draw_rect_ext_pad_size(arc, LV_ARC_PART_KNOB);
|
||||
|
||||
lv_coord_t knob_left = lv_obj_get_style_pad_left(arc, LV_ARC_PART_KNOB);
|
||||
lv_coord_t knob_right = lv_obj_get_style_pad_right(arc, LV_ARC_PART_KNOB);
|
||||
|
||||
@@ -62,7 +62,6 @@ enum {
|
||||
LV_ARC_PART_INDIC,
|
||||
LV_ARC_PART_KNOB,
|
||||
_LV_ARC_PART_VIRTUAL_LAST,
|
||||
_LV_ARC_PART_REAL_LAST = _LV_OBJ_PART_REAL_LAST,
|
||||
};
|
||||
typedef uint8_t lv_arc_part_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user