improve progress_circle

This commit is contained in:
lixianjing 2024-04-02 18:03:10 +08:00
parent a9dedae87d
commit b884b5d997
4 changed files with 12 additions and 2 deletions

View File

@ -2,6 +2,7 @@
2024/04/02
* 完善针对特定语言加载字体,用'_'代替'.'连接语言名后缀。
* 修复在agge模式下圆形进度条修改值的过程中修改风格颜色或者其他属性会导致画面不正常的问题(感谢智明提供补丁)
2024/04/01
* 增加 debugger 的中断事件对象的函数名字属性(感谢智明提供补丁)

View File

@ -4670,7 +4670,7 @@ ret_t widget_set_style(widget_t* widget, const char* state_and_name, const value
state = WIDGET_STATE_NORMAL;
}
widget_invalidate(widget, NULL);
widget_invalidate_force(widget, NULL);
return style_set(widget->astyle, state, name, value);
}

View File

@ -124,7 +124,7 @@ rect_t progress_circle_calc_line_dirty_rect(widget_t* widget, float_t old_value,
end_angle = t;
}
if ((end_angle - start_angle) < (M_PI / 2)) {
if (!progress_circle->is_redraw && (end_angle - start_angle) < (M_PI / 2)) {
xy_t cx = widget->w / 2;
xy_t cy = widget->h / 2;
float_t r = progress_circle_get_radius(widget);
@ -159,6 +159,7 @@ rect_t progress_circle_calc_line_dirty_rect(widget_t* widget, float_t old_value,
rect.x += cx;
rect.y += cy;
} else {
progress_circle->is_redraw = FALSE;
rect = rect_init(0, 0, widget->w, widget->h);
}
@ -366,22 +367,29 @@ static ret_t progress_circle_set_prop(widget_t* widget, const char* name, const
if (tk_str_eq(name, WIDGET_PROP_VALUE)) {
return progress_circle_set_value(widget, value_float(v));
} else if (tk_str_eq(name, WIDGET_PROP_MAX)) {
progress_circle->is_redraw = TRUE;
return progress_circle_set_max(widget, value_int(v));
} else if (tk_str_eq(name, WIDGET_PROP_FORMAT)) {
return progress_circle_set_format(widget, value_str(v));
} else if (tk_str_eq(name, WIDGET_PROP_SHOW_TEXT)) {
return progress_circle_set_show_text(widget, value_bool(v));
} else if (tk_str_eq(name, PROGRESS_CIRCLE_PROP_COUNTER_CLOCK_WISE)) {
progress_circle->is_redraw = TRUE;
return progress_circle_set_counter_clock_wise(widget, value_bool(v));
} else if (tk_str_eq(name, PROGRESS_CIRCLE_PROP_LINE_WIDTH)) {
progress_circle->is_redraw = TRUE;
return progress_circle_set_line_width(widget, value_int(v));
} else if (tk_str_eq(name, PROGRESS_CIRCLE_PROP_START_ANGLE)) {
progress_circle->is_redraw = TRUE;
return progress_circle_set_start_angle(widget, value_int(v));
} else if (tk_str_eq(name, PROGRESS_CIRCLE_PROP_LINE_CAP)) {
progress_circle->is_redraw = TRUE;
return progress_circle_set_line_cap(widget, value_str(v));
} else if (tk_str_eq(name, WIDGET_PROP_W)) {
progress_circle->is_redraw = TRUE;
progress_circle->dirty_rect = rect_init(0, 0, value_int(v), widget->h);
} else if (tk_str_eq(name, WIDGET_PROP_H)) {
progress_circle->is_redraw = TRUE;
progress_circle->dirty_rect = rect_init(0, 0, widget->w, value_int(v));
}

View File

@ -128,6 +128,7 @@ typedef struct _progress_circle_t {
bool_t show_text;
/* private */
bool_t is_redraw;
rect_t dirty_rect;
rect_t last_dirty_rect;
} progress_circle_t;