forked from enlightenment/efl
efl_ui_focus_manager_calc: refactor calculation logic
This commit is contained in:
parent
5e3c641438
commit
44d7ff1fb3
|
@ -289,6 +289,21 @@ _distance(Eina_Rect node, Eina_Rect op, Dimension dim)
|
|||
return v2;
|
||||
}
|
||||
|
||||
static inline void
|
||||
_min_max_gen(Dimension dim, Eina_Rect rect, int *min, int *max)
|
||||
{
|
||||
if (dim == DIMENSION_X)
|
||||
{
|
||||
*min = rect.y;
|
||||
*max = eina_rectangle_max_y(&rect.rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
*min = rect.x;
|
||||
*max = eina_rectangle_max_x(&rect.rect);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
_calculate_node(Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Object *node, Dimension dim, Eina_List **pos, Eina_List **neg)
|
||||
{
|
||||
|
@ -305,16 +320,7 @@ _calculate_node(Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Object *node, D
|
|||
*pos = NULL;
|
||||
*neg = NULL;
|
||||
|
||||
if (dim == DIMENSION_X)
|
||||
{
|
||||
dim_min = rect.y;
|
||||
dim_max = rect.y + rect.h;
|
||||
}
|
||||
else
|
||||
{
|
||||
dim_min = rect.x;
|
||||
dim_max = rect.x + rect.w;
|
||||
}
|
||||
_min_max_gen(dim, rect, &dim_min, &dim_max);
|
||||
|
||||
EINA_ITERATOR_FOREACH(nodes, n)
|
||||
{
|
||||
|
@ -328,17 +334,7 @@ _calculate_node(Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Object *node, D
|
|||
|
||||
op_rect = efl_ui_focus_object_focus_geometry_get(op);
|
||||
|
||||
if (dim == DIMENSION_X)
|
||||
{
|
||||
min = op_rect.y;
|
||||
max = eina_rectangle_max_y(&op_rect.rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
min = op_rect.x;
|
||||
max = eina_rectangle_max_x(&op_rect.rect);
|
||||
}
|
||||
|
||||
_min_max_gen(dim, op_rect, &min, &max);
|
||||
|
||||
/* The only way the calculation does make sense is if the two number
|
||||
* lines are not disconnected.
|
||||
|
|
Loading…
Reference in New Issue