mirror of
https://github.com/lvgl/lvgl.git
synced 2025-02-04 07:13:00 +08:00
Revert "feat(style) make transform_zoom use pixel or percentage value"
This reverts commit 5b4e9fc6f35b2be5cd8687d84012d245b5f971e1.
This commit is contained in:
parent
6db12e4997
commit
14bc4e9f8f
@ -87,7 +87,7 @@ typedef struct {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_CHART
|
#if LV_USE_CHART
|
||||||
lv_style_t chart_series, chart_ticks, chart_bg;
|
lv_style_t chart_series, chart_indic, chart_ticks, chart_bg;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_CHECKBOX
|
#if LV_USE_CHECKBOX
|
||||||
@ -427,6 +427,12 @@ static void style_init(void)
|
|||||||
lv_style_set_size(&styles->chart_series, LV_DPX(8));
|
lv_style_set_size(&styles->chart_series, LV_DPX(8));
|
||||||
lv_style_set_pad_column(&styles->chart_series, LV_DPX(2));
|
lv_style_set_pad_column(&styles->chart_series, LV_DPX(2));
|
||||||
|
|
||||||
|
style_init_reset(&styles->chart_indic);
|
||||||
|
lv_style_set_radius(&styles->chart_indic,LV_RADIUS_CIRCLE);
|
||||||
|
lv_style_set_size(&styles->chart_indic, LV_DPX(8));
|
||||||
|
lv_style_set_bg_color(&styles->chart_indic, theme.color_primary);
|
||||||
|
lv_style_set_bg_opa(&styles->chart_indic, LV_OPA_COVER);
|
||||||
|
|
||||||
style_init_reset(&styles->chart_ticks);
|
style_init_reset(&styles->chart_ticks);
|
||||||
lv_style_set_line_width(&styles->chart_ticks, LV_DPX(1));
|
lv_style_set_line_width(&styles->chart_ticks, LV_DPX(1));
|
||||||
lv_style_set_line_color(&styles->chart_ticks, COLOR_SCR_TEXT);
|
lv_style_set_line_color(&styles->chart_ticks, COLOR_SCR_TEXT);
|
||||||
@ -772,7 +778,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
|
|||||||
lv_obj_add_style(obj, &styles->scrollbar, LV_PART_SCROLLBAR);
|
lv_obj_add_style(obj, &styles->scrollbar, LV_PART_SCROLLBAR);
|
||||||
lv_obj_add_style(obj, &styles->scrollbar_scrolled, LV_PART_SCROLLBAR | LV_STATE_SCROLLED);
|
lv_obj_add_style(obj, &styles->scrollbar_scrolled, LV_PART_SCROLLBAR | LV_STATE_SCROLLED);
|
||||||
lv_obj_add_style(obj, &styles->chart_series, LV_PART_ITEMS);
|
lv_obj_add_style(obj, &styles->chart_series, LV_PART_ITEMS);
|
||||||
lv_obj_add_style(obj, &styles->bg_color_primary, LV_PART_ITEMS | LV_STATE_PRESSED);
|
lv_obj_add_style(obj, &styles->chart_indic, LV_PART_INDICATOR);
|
||||||
lv_obj_add_style(obj, &styles->chart_ticks, LV_PART_TICKS);
|
lv_obj_add_style(obj, &styles->chart_ticks, LV_PART_TICKS);
|
||||||
lv_obj_add_style(obj, &styles->chart_series, LV_PART_CURSOR);
|
lv_obj_add_style(obj, &styles->chart_series, LV_PART_CURSOR);
|
||||||
}
|
}
|
||||||
|
@ -103,6 +103,22 @@ uint32_t lv_area_get_size(const lv_area_t * area_p)
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lv_area_increase(lv_area_t * area, lv_coord_t w_extra, lv_coord_t h_extra)
|
||||||
|
{
|
||||||
|
area->x1 -= w_extra;
|
||||||
|
area->x2 += w_extra;
|
||||||
|
area->y1 -= h_extra;
|
||||||
|
area->y2 += h_extra;
|
||||||
|
}
|
||||||
|
|
||||||
|
void lv_area_move(lv_area_t * area, lv_coord_t x_ofs, lv_coord_t y_ofs)
|
||||||
|
{
|
||||||
|
area->x1 += x_ofs;
|
||||||
|
area->x2 += x_ofs;
|
||||||
|
area->y1 += y_ofs;
|
||||||
|
area->y2 += y_ofs;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the common parts of two areas
|
* Get the common parts of two areas
|
||||||
* @param res_p pointer to an area, the result will be stored here
|
* @param res_p pointer to an area, the result will be stored here
|
||||||
|
@ -173,6 +173,10 @@ void _lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y);
|
|||||||
*/
|
*/
|
||||||
uint32_t lv_area_get_size(const lv_area_t * area_p);
|
uint32_t lv_area_get_size(const lv_area_t * area_p);
|
||||||
|
|
||||||
|
void lv_area_increase(lv_area_t * area, lv_coord_t w_extra, lv_coord_t h_extra);
|
||||||
|
|
||||||
|
void lv_area_move(lv_area_t * area, lv_coord_t x_ofs, lv_coord_t y_ofs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the common parts of two areas
|
* Get the common parts of two areas
|
||||||
* @param res_p pointer to an area, the result will be stored her
|
* @param res_p pointer to an area, the result will be stored her
|
||||||
|
@ -734,12 +734,10 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area)
|
|||||||
|
|
||||||
lv_draw_rect_dsc_t point_dsc_default;
|
lv_draw_rect_dsc_t point_dsc_default;
|
||||||
lv_draw_rect_dsc_init(&point_dsc_default);
|
lv_draw_rect_dsc_init(&point_dsc_default);
|
||||||
lv_obj_init_draw_rect_dsc(obj, LV_PART_ITEMS, &point_dsc_default);
|
lv_obj_init_draw_rect_dsc(obj, LV_PART_INDICATOR, &point_dsc_default);
|
||||||
|
|
||||||
lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_ITEMS) / 2;
|
|
||||||
lv_coord_t point_h = lv_obj_get_style_height(obj, LV_PART_ITEMS) / 2;
|
|
||||||
|
|
||||||
|
|
||||||
|
lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_INDICATOR) / 2;
|
||||||
|
lv_coord_t point_h = lv_obj_get_style_height(obj, LV_PART_INDICATOR) / 2;
|
||||||
|
|
||||||
/*Do not bother with line ending is the point will over it*/
|
/*Do not bother with line ending is the point will over it*/
|
||||||
if(LV_MIN(point_w, point_h) > line_dsc_default.width / 2) line_dsc_default.raw_end = 1;
|
if(LV_MIN(point_w, point_h) > line_dsc_default.width / 2) line_dsc_default.raw_end = 1;
|
||||||
@ -1268,22 +1266,22 @@ static void invalidate_point(lv_obj_t * obj, uint16_t i)
|
|||||||
if(chart->type == LV_CHART_TYPE_LINE) {
|
if(chart->type == LV_CHART_TYPE_LINE) {
|
||||||
lv_coord_t x_ofs = obj->coords.x1 + lv_obj_get_style_pad_left(obj, LV_PART_MAIN) - scroll_left;
|
lv_coord_t x_ofs = obj->coords.x1 + lv_obj_get_style_pad_left(obj, LV_PART_MAIN) - scroll_left;
|
||||||
lv_coord_t line_width = lv_obj_get_style_line_width(obj, LV_PART_ITEMS);
|
lv_coord_t line_width = lv_obj_get_style_line_width(obj, LV_PART_ITEMS);
|
||||||
lv_coord_t point_radius = lv_obj_get_style_width(obj, LV_PART_ITEMS);
|
lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_INDICATOR);
|
||||||
|
|
||||||
lv_area_t coords;
|
lv_area_t coords;
|
||||||
lv_area_copy(&coords, &obj->coords);
|
lv_area_copy(&coords, &obj->coords);
|
||||||
coords.y1 -= line_width + point_radius;
|
coords.y1 -= line_width + point_w;
|
||||||
coords.y2 += line_width + point_radius;
|
coords.y2 += line_width + point_w;
|
||||||
|
|
||||||
if(i < chart->point_cnt - 1) {
|
if(i < chart->point_cnt - 1) {
|
||||||
coords.x1 = ((w * i) / (chart->point_cnt - 1)) + x_ofs - line_width - point_radius;
|
coords.x1 = ((w * i) / (chart->point_cnt - 1)) + x_ofs - line_width - point_w;
|
||||||
coords.x2 = ((w * (i + 1)) / (chart->point_cnt - 1)) + x_ofs + line_width + point_radius;
|
coords.x2 = ((w * (i + 1)) / (chart->point_cnt - 1)) + x_ofs + line_width + point_w;
|
||||||
lv_obj_invalidate_area(obj, &coords);
|
lv_obj_invalidate_area(obj, &coords);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i > 0) {
|
if(i > 0) {
|
||||||
coords.x1 = ((w * (i - 1)) / (chart->point_cnt - 1)) + x_ofs - line_width - point_radius;
|
coords.x1 = ((w * (i - 1)) / (chart->point_cnt - 1)) + x_ofs - line_width - point_w;
|
||||||
coords.x2 = ((w * i) / (chart->point_cnt - 1)) + x_ofs + line_width + point_radius;
|
coords.x2 = ((w * i) / (chart->point_cnt - 1)) + x_ofs + line_width + point_w;
|
||||||
lv_obj_invalidate_area(obj, &coords);
|
lv_obj_invalidate_area(obj, &coords);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user