mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-21 06:53:01 +08:00
Merge branch 'border_styles' into dev-6.0
This commit is contained in:
commit
a1d2d631f0
@ -1598,6 +1598,28 @@ void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * cords_p)
|
|||||||
lv_area_copy(cords_p, &obj->coords);
|
lv_area_copy(cords_p, &obj->coords);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reduce area retried by `lv_obj_get_coords()` the get graphically usable area of an object.
|
||||||
|
* (Without the size of the border or other extra graphical elements)
|
||||||
|
* @param coords_p store the result area here
|
||||||
|
*/
|
||||||
|
void lv_obj_get_inner_coords(const lv_obj_t *obj, lv_area_t * coords_p)
|
||||||
|
{
|
||||||
|
const lv_style_t *style = lv_obj_get_style(obj);
|
||||||
|
if(style->body.border.part & LV_BORDER_LEFT)
|
||||||
|
coords_p->x1 += style->body.border.width;
|
||||||
|
|
||||||
|
if(style->body.border.part & LV_BORDER_RIGHT)
|
||||||
|
coords_p->x2 -= style->body.border.width;
|
||||||
|
|
||||||
|
if(style->body.border.part & LV_BORDER_TOP)
|
||||||
|
coords_p->y1 += style->body.border.width;
|
||||||
|
|
||||||
|
if(style->body.border.part & LV_BORDER_BOTTOM)
|
||||||
|
coords_p->y2 -= style->body.border.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the x coordinate of object
|
* Get the x coordinate of object
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
|
@ -663,6 +663,13 @@ uint16_t lv_obj_count_children_recursive(const lv_obj_t * obj);
|
|||||||
*/
|
*/
|
||||||
void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * cords_p);
|
void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * cords_p);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reduce area retried by `lv_obj_get_coords()` the get graphically usable area of an object.
|
||||||
|
* (Without the size of the border or other extra graphical elements)
|
||||||
|
* @param coords_p store the result area here
|
||||||
|
*/
|
||||||
|
void lv_obj_get_inner_coords(const lv_obj_t *obj, lv_area_t * coords_p);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the x coordinate of object
|
* Get the x coordinate of object
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
|
@ -324,8 +324,12 @@ static bool lv_roller_design(lv_obj_t * roller, const lv_area_t * mask, lv_desig
|
|||||||
rect_area.y1 = roller->coords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - style->text.line_space / 2;
|
rect_area.y1 = roller->coords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - style->text.line_space / 2;
|
||||||
if((font_h & 0x1) && (style->text.line_space & 0x1)) rect_area.y1--; /*Compensate the two rounding error*/
|
if((font_h & 0x1) && (style->text.line_space & 0x1)) rect_area.y1--; /*Compensate the two rounding error*/
|
||||||
rect_area.y2 = rect_area.y1 + font_h + style->text.line_space - 1;
|
rect_area.y2 = rect_area.y1 + font_h + style->text.line_space - 1;
|
||||||
rect_area.x1 = roller->coords.x1;
|
lv_area_t roller_coords;
|
||||||
rect_area.x2 = roller->coords.x2;
|
lv_obj_get_coords(roller, &roller_coords);
|
||||||
|
lv_obj_adjust_coords(roller, &roller_coords);
|
||||||
|
|
||||||
|
rect_area.x1 = roller_coords.x1;
|
||||||
|
rect_area.x2 = roller_coords.x2;
|
||||||
|
|
||||||
lv_draw_rect(&rect_area, mask, ext->ddlist.sel_style, opa_scale);
|
lv_draw_rect(&rect_area, mask, ext->ddlist.sel_style, opa_scale);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user