Fixed typos, changed macro to static function.
This commit is contained in:
@@ -44,6 +44,9 @@ static void refresh_children_style(lv_obj_t * obj);
|
||||
static void delete_children(lv_obj_t * obj);
|
||||
static bool lv_obj_design(lv_obj_t * obj, const lv_area_t * mask_p, lv_design_mode_t mode);
|
||||
static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
|
||||
#if USE_LV_EXTENDED_CLICK_AREA
|
||||
static void update_ext_coords(lv_area_t *coords, lv_area_t *ext_coords, lv_area_t *paddings);
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -55,20 +58,6 @@ static const void * event_act_data; /*Stores the data passed to the ev
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
#if USE_LV_EXTENDED_CLICK_AREA
|
||||
/**
|
||||
* Update coordinates of extended clickable area from object's coordinates and ext_paddings
|
||||
* @param coords coordinates of an object
|
||||
* @param ext_coords extended coordinates, which will be updated
|
||||
* @param paddings paddings of extended clickable area
|
||||
*/
|
||||
#define UPDATE_EXT_COORDS(coords, ext_coords, paddings) do{\
|
||||
ext_coords.x1 = paddings.x1 > coords.x1 ? 0 : coords.x1 - paddings.x1; \
|
||||
ext_coords.x2 = coords.x2 + paddings.x2; \
|
||||
ext_coords.y1 = paddings.y1 > coords.y1 ? 0 : coords.y1 - paddings.y1; \
|
||||
ext_coords.y2 = coords.y2 + paddings.y2; \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
@@ -593,7 +582,7 @@ void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
|
||||
obj->coords.y2 += diff.y;
|
||||
|
||||
#if USE_LV_EXTENDED_CLICK_AREA
|
||||
UPDATE_EXT_COORDS(obj->coords, obj->ext_coords, obj->ext_paddings);
|
||||
update_ext_coords(&(obj->coords), &(obj->ext_coords), &(obj->ext_paddings));
|
||||
#endif
|
||||
|
||||
refresh_children_position(obj, diff.x, diff.y);
|
||||
@@ -658,7 +647,7 @@ void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
|
||||
obj->coords.y2 = obj->coords.y1 + h - 1;
|
||||
|
||||
#if USE_LV_EXTENDED_CLICK_AREA
|
||||
UPDATE_EXT_COORDS(obj->coords, obj->ext_coords, obj->ext_paddings);
|
||||
update_ext_coords(&(obj->coords), &(obj->ext_coords), &(obj->ext_paddings));
|
||||
#endif
|
||||
|
||||
/*Send a signal to the object with its new coordinates*/
|
||||
@@ -690,14 +679,14 @@ void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
|
||||
* @param w extended width to both sides
|
||||
* @param h extended height to both sides
|
||||
*/
|
||||
void lv_obj_set_ext_paddinds(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
|
||||
void lv_obj_set_ext_paddings(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
|
||||
{
|
||||
obj->ext_paddings.x1 = w;
|
||||
obj->ext_paddings.x2 = w;
|
||||
obj->ext_paddings.y1 = h;
|
||||
obj->ext_paddings.y2 = h;
|
||||
|
||||
UPDATE_EXT_COORDS(obj->coords, obj->ext_coords, obj->ext_paddings);
|
||||
update_ext_coords(&(obj->coords), &(obj->ext_coords), &(obj->ext_paddings));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2042,7 +2031,7 @@ static void refresh_children_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coor
|
||||
i->coords.y2 += y_diff;
|
||||
|
||||
#if USE_LV_EXTENDED_CLICK_AREA
|
||||
UPDATE_EXT_COORDS(i->coords, i->ext_coords, i->ext_paddings);
|
||||
update_ext_coords(&(i->coords), &(i->ext_coords), &(i->ext_paddings));
|
||||
#endif
|
||||
refresh_children_position(i, x_diff, y_diff);
|
||||
}
|
||||
@@ -2154,3 +2143,19 @@ static void delete_children(lv_obj_t * obj)
|
||||
lv_mem_free(obj); /*Free the object itself*/
|
||||
|
||||
}
|
||||
|
||||
#if USE_LV_EXTENDED_CLICK_AREA
|
||||
/**
|
||||
* Update coordinates of extended clickable area from object's coordinates and ext_paddings
|
||||
* @param coords coordinates of an object
|
||||
* @param ext_coords extended coordinates, which will be updated
|
||||
* @param paddings paddings of extended clickable area
|
||||
*/
|
||||
static void update_ext_coords(lv_area_t *coords, lv_area_t *ext_coords, lv_area_t *paddings)
|
||||
{
|
||||
ext_coords->x1 = paddings->x1 > coords->x1 ? 0 : coords->x1 - paddings->x1;
|
||||
ext_coords->x2 = coords->x2 + paddings->x2;
|
||||
ext_coords->y1 = paddings->y1 > coords->y1 ? 0 : coords->y1 - paddings->y1;
|
||||
ext_coords->y2 = coords->y2 + paddings->y2;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -348,7 +348,7 @@ void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h);
|
||||
* @param w extended width to both sides
|
||||
* @param h extended height to both sides
|
||||
*/
|
||||
void lv_obj_set_ext_paddinds(lv_obj_t * obj, lv_coord_t w, lv_coord_t h);
|
||||
void lv_obj_set_ext_paddings(lv_obj_t * obj, lv_coord_t w, lv_coord_t h);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user