From 8254ee66619032db57d57f25f8de9ced933b64fa Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 7 Jun 2019 14:52:14 +0200 Subject: [PATCH] rename lv_obj_adjust_coords to lv_obj_get_inner_coords --- src/lv_core/lv_obj.c | 17 ++++++++++------- src/lv_core/lv_obj.h | 7 ++++--- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index 3906bafa7..bf7b63315 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -1593,21 +1593,24 @@ void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * cords_p) } /** - * Adjust the coordinates retrieved from lv_obj_get_coords() according - * to the object's style. + * 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_adjust_coords(const lv_obj_t *obj, lv_area_t * cords_p) +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) - cords_p->x1 += style->body.border.width; + coords_p->x1 += style->body.border.width; if(style->body.border.part & LV_BORDER_RIGHT) - cords_p->x2 -= style->body.border.width; + coords_p->x2 -= style->body.border.width; + if(style->body.border.part & LV_BORDER_TOP) - cords_p->y1 += style->body.border.width; + coords_p->y1 += style->body.border.width; + if(style->body.border.part & LV_BORDER_BOTTOM) - cords_p->y2 -= style->body.border.width; + coords_p->y2 -= style->body.border.width; } diff --git a/src/lv_core/lv_obj.h b/src/lv_core/lv_obj.h index 03ffa1978..e993aacb0 100644 --- a/src/lv_core/lv_obj.h +++ b/src/lv_core/lv_obj.h @@ -667,10 +667,11 @@ 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); /** - * Adjust the coordinates retrieved from lv_obj_get_coords() according - * to the object's style. + * 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_adjust_coords(const lv_obj_t *obj, lv_area_t * cords_p); +void lv_obj_get_inner_coords(const lv_obj_t *obj, lv_area_t * coords_p); /** * Get the x coordinate of object